Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 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 | |
| 19 | DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo |
Brett Chabot | 43905f8 | 2019-02-15 14:22:14 -0800 | [diff] [blame] | 20 | DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner |
Aaron Holden | 850562b | 2017-11-09 16:07:31 -0800 | [diff] [blame] | 21 | DEVICE_INFO_USES_LIBRARY := android.test.runner |
Chris Li | d77dd25 | 2020-09-29 14:53:15 -0700 | [diff] [blame] | 22 | DEVICE_INFO_USES_OPTIONAL_LIBRARIES := \ |
| 23 | androidx.window.sidecar |
Agatha Man | 2ba8545 | 2017-12-07 09:02:56 -0800 | [diff] [blame] | 24 | DEVICE_INFO_PERMISSIONS += \ |
| 25 | android.permission.READ_PHONE_STATE \ |
| 26 | android.permission.WRITE_EXTERNAL_STORAGE |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 27 | DEVICE_INFO_ACTIVITIES += \ |
Suprabh Shukla | 66d5497 | 2018-05-15 18:04:50 -0700 | [diff] [blame] | 28 | $(DEVICE_INFO_PACKAGE).AppStandbyDeviceInfo \ |
Aaron Holden | 2769ff3 | 2019-04-22 16:21:51 -0700 | [diff] [blame] | 29 | $(DEVICE_INFO_PACKAGE).ClientIdDeviceInfo \ |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 30 | $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \ |
| 31 | $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \ |
| 32 | $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \ |
| 33 | $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \ |
Agatha Man | 7941c81 | 2016-01-07 10:22:17 -0800 | [diff] [blame] | 34 | $(DEVICE_INFO_PACKAGE).GlesStubActivity \ |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 35 | $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \ |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 36 | $(DEVICE_INFO_PACKAGE).LocaleDeviceInfo \ |
| 37 | $(DEVICE_INFO_PACKAGE).MediaDeviceInfo \ |
| 38 | $(DEVICE_INFO_PACKAGE).MemoryDeviceInfo \ |
| 39 | $(DEVICE_INFO_PACKAGE).PackageDeviceInfo \ |
| 40 | $(DEVICE_INFO_PACKAGE).PropertyDeviceInfo \ |
| 41 | $(DEVICE_INFO_PACKAGE).ScreenDeviceInfo \ |
| 42 | $(DEVICE_INFO_PACKAGE).StorageDeviceInfo \ |
Yifan Hong | 53b415d | 2017-04-28 16:59:28 -0700 | [diff] [blame] | 43 | $(DEVICE_INFO_PACKAGE).UserDeviceInfo \ |
Chris Li | d77dd25 | 2020-09-29 14:53:15 -0700 | [diff] [blame] | 44 | $(DEVICE_INFO_PACKAGE).VintfDeviceInfo \ |
| 45 | com.android.compatibility.common.util.DummyActivity |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 46 | |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 47 | ifeq ($(DEVICE_INFO_MIN_SDK),) |
| 48 | DEVICE_INFO_MIN_SDK := 8 |
| 49 | endif |
| 50 | |
| 51 | ifeq ($(DEVICE_INFO_TARGET_SDK),) |
Przemyslaw Szczepaniak | aed87e9 | 2017-12-05 13:23:30 +0000 | [diff] [blame] | 52 | DEVICE_INFO_TARGET_SDK := 17 |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 53 | endif |
| 54 | |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 55 | # Add the base device info |
Brett Chabot | 43905f8 | 2019-02-15 14:22:14 -0800 | [diff] [blame] | 56 | LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 57 | |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 58 | # Generator of APK manifests. |
| 59 | MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar |
Colin Cross | 95fa051 | 2017-06-30 14:19:12 -0700 | [diff] [blame] | 60 | MANIFEST_GENERATOR := $(JAVA) -jar $(MANIFEST_GENERATOR_JAR) |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 61 | |
| 62 | # Generate the manifest |
| 63 | manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml |
| 64 | $(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission)) |
| 65 | $(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity)) |
Aaron Holden | 850562b | 2017-11-09 16:07:31 -0800 | [diff] [blame] | 66 | $(manifest_xml): PRIVATE_USES_LIBRARY := $(DEVICE_INFO_USES_LIBRARY) |
Chris Li | d77dd25 | 2020-09-29 14:53:15 -0700 | [diff] [blame] | 67 | $(manifest_xml): PRIVATE_USES_OPTIONAL_LIBRARIES := $(foreach library,$(DEVICE_INFO_USES_OPTIONAL_LIBRARIES),-lo $(library)) |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 68 | $(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE) |
| 69 | $(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT) |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 70 | $(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK) |
| 71 | $(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK) |
Agatha Man | 62a97bf | 2015-07-14 13:47:47 -0700 | [diff] [blame] | 72 | |
| 73 | # Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed. |
| 74 | $(manifest_xml): $(MANIFEST_GENERATOR_JAR) $(LOCAL_PATH)/Android.mk cts/build/device_info_package.mk |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 75 | $(hide) echo Generating manifest for $(PRIVATE_NAME) |
| 76 | $(hide) mkdir -p $(dir $@) |
| 77 | $(hide) $(MANIFEST_GENERATOR) \ |
| 78 | $(PRIVATE_INFO_PERMISSIONS) \ |
| 79 | $(PRIVATE_INFO_ACTIVITIES) \ |
Aaron Holden | 850562b | 2017-11-09 16:07:31 -0800 | [diff] [blame] | 80 | -l $(PRIVATE_USES_LIBRARY) \ |
Chris Li | d77dd25 | 2020-09-29 14:53:15 -0700 | [diff] [blame] | 81 | $(PRIVATE_USES_OPTIONAL_LIBRARIES) \ |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 82 | -p $(PRIVATE_PACKAGE) \ |
| 83 | -i $(PRIVATE_INSTRUMENT) \ |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 84 | -s $(PRIVATE_MIN_SDK) \ |
| 85 | -t $(PRIVATE_TARGET_SDK) \ |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 86 | -o $@ |
| 87 | |
| 88 | # Reset variables |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 89 | DEVICE_INFO_MIN_SDK := |
| 90 | DEVICE_INFO_TARGET_SDK := |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 91 | DEVICE_INFO_PACKAGE := |
| 92 | DEVICE_INFO_INSTRUMENT := |
| 93 | DEVICE_INFO_PERMISSIONS := |
| 94 | DEVICE_INFO_ACTIVITIES := |
| 95 | |
| 96 | LOCAL_FULL_MANIFEST_FILE := $(manifest_xml) |
| 97 | # Disable by default |
| 98 | LOCAL_DEX_PREOPT := false |
| 99 | LOCAL_PROGUARD_ENABLED := disabled |
| 100 | |
| 101 | # Don't include this package in any target |
| 102 | LOCAL_MODULE_TAGS := optional |
| 103 | # And when built explicitly put it in the data partition |
| 104 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) |
| 105 | |
Jiyong Park | 2b2405c | 2018-03-05 20:30:52 +0900 | [diff] [blame] | 106 | |
| 107 | #TODO(b/72620511) remove this condition when AtsDeviceInfo can be built with SDK again |
| 108 | ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),true) |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 109 | LOCAL_SDK_VERSION := current |
Jiyong Park | 2b2405c | 2018-03-05 20:30:52 +0900 | [diff] [blame] | 110 | endif |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 111 | |
Agatha Man | 2285129 | 2015-06-29 16:54:32 -0700 | [diff] [blame] | 112 | include $(BUILD_CTS_SUPPORT_PACKAGE) |