• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Builds a package which can be instrumented to retrieve information about the device under test.
17#
18
19DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo
20DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner
21DEVICE_INFO_USES_LIBRARY := android.test.runner
22DEVICE_INFO_USES_OPTIONAL_LIBRARIES += \
23  androidx.window.extensions \
24  androidx.window.sidecar
25DEVICE_INFO_PERMISSIONS += \
26  android.permission.READ_PHONE_STATE \
27  android.permission.WRITE_EXTERNAL_STORAGE
28DEVICE_INFO_ACTIVITIES += \
29  $(DEVICE_INFO_PACKAGE).AppStandbyDeviceInfo \
30  $(DEVICE_INFO_PACKAGE).ClientIdDeviceInfo \
31  $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \
32  $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \
33  $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \
34  $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \
35  $(DEVICE_INFO_PACKAGE).GlesStubActivity \
36  $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \
37  $(DEVICE_INFO_PACKAGE).HapticsDeviceInfo \
38  $(DEVICE_INFO_PACKAGE).InputDeviceInfo \
39  $(DEVICE_INFO_PACKAGE).LocaleDeviceInfo \
40  $(DEVICE_INFO_PACKAGE).MediaDeviceInfo \
41  $(DEVICE_INFO_PACKAGE).MemoryDeviceInfo \
42  $(DEVICE_INFO_PACKAGE).PackageDeviceInfo \
43  $(DEVICE_INFO_PACKAGE).ScreenDeviceInfo \
44  $(DEVICE_INFO_PACKAGE).StorageDeviceInfo \
45  $(DEVICE_INFO_PACKAGE).UserDeviceInfo \
46  $(DEVICE_INFO_PACKAGE).VintfDeviceInfo \
47  com.android.compatibility.common.util.DummyActivity
48
49ifeq ($(DEVICE_INFO_MIN_SDK),)
50DEVICE_INFO_MIN_SDK := 8
51endif
52
53ifeq ($(DEVICE_INFO_TARGET_SDK),)
54DEVICE_INFO_TARGET_SDK := 17
55endif
56
57# Add the base device info
58LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt
59
60# Generator of APK manifests.
61MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
62MANIFEST_GENERATOR := $(JAVA) -jar $(MANIFEST_GENERATOR_JAR)
63
64# Generate the manifest
65manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml
66$(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission))
67$(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity))
68$(manifest_xml): PRIVATE_USES_LIBRARY := $(DEVICE_INFO_USES_LIBRARY)
69$(manifest_xml): PRIVATE_USES_OPTIONAL_LIBRARIES := $(foreach library,$(DEVICE_INFO_USES_OPTIONAL_LIBRARIES),-lo $(library))
70$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE)
71$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT)
72$(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK)
73$(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK)
74
75# Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed.
76$(manifest_xml): $(MANIFEST_GENERATOR_JAR) $(LOCAL_PATH)/Android.mk cts/build/device_info_package.mk
77	$(hide) echo Generating manifest for $(PRIVATE_NAME)
78	$(hide) mkdir -p $(dir $@)
79	$(hide) $(MANIFEST_GENERATOR) \
80						$(PRIVATE_INFO_PERMISSIONS) \
81						$(PRIVATE_INFO_ACTIVITIES) \
82						-l $(PRIVATE_USES_LIBRARY) \
83						$(PRIVATE_USES_OPTIONAL_LIBRARIES) \
84						-p $(PRIVATE_PACKAGE) \
85						-i $(PRIVATE_INSTRUMENT) \
86						-s $(PRIVATE_MIN_SDK) \
87						-t $(PRIVATE_TARGET_SDK) \
88						-o $@
89
90# Reset variables
91DEVICE_INFO_MIN_SDK :=
92DEVICE_INFO_TARGET_SDK :=
93DEVICE_INFO_PACKAGE :=
94DEVICE_INFO_INSTRUMENT :=
95DEVICE_INFO_PERMISSIONS :=
96DEVICE_INFO_ACTIVITIES :=
97
98LOCAL_FULL_MANIFEST_FILE := $(manifest_xml)
99# Disable by default
100LOCAL_DEX_PREOPT := false
101LOCAL_PROGUARD_ENABLED := disabled
102
103# Don't include this package in any target
104LOCAL_MODULE_TAGS := optional
105# And when built explicitly put it in the data partition
106LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
107
108
109#TODO(b/72620511) remove this condition when AtsDeviceInfo can be built with SDK again
110ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),true)
111LOCAL_SDK_VERSION := current
112endif
113
114include $(BUILD_CTS_SUPPORT_PACKAGE)
115