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 |
Agatha Man | 71ba78d | 2015-10-05 20:14:31 -0700 | [diff] [blame] | 20 | DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner |
Agatha Man | 62a97bf | 2015-07-14 13:47:47 -0700 | [diff] [blame] | 21 | DEVICE_INFO_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 22 | DEVICE_INFO_ACTIVITIES += \ |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 23 | $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \ |
| 24 | $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \ |
| 25 | $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \ |
| 26 | $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \ |
Agatha Man | 7941c81 | 2016-01-07 10:22:17 -0800 | [diff] [blame] | 27 | $(DEVICE_INFO_PACKAGE).GlesStubActivity \ |
Nicholas Sauer | c7d0ede | 2015-12-08 11:56:30 -0800 | [diff] [blame] | 28 | $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \ |
| 29 | $(DEVICE_INFO_PACKAGE).LibraryDeviceInfo \ |
| 30 | $(DEVICE_INFO_PACKAGE).LocaleDeviceInfo \ |
| 31 | $(DEVICE_INFO_PACKAGE).MediaDeviceInfo \ |
| 32 | $(DEVICE_INFO_PACKAGE).MemoryDeviceInfo \ |
| 33 | $(DEVICE_INFO_PACKAGE).PackageDeviceInfo \ |
| 34 | $(DEVICE_INFO_PACKAGE).PropertyDeviceInfo \ |
| 35 | $(DEVICE_INFO_PACKAGE).ScreenDeviceInfo \ |
| 36 | $(DEVICE_INFO_PACKAGE).StorageDeviceInfo \ |
| 37 | $(DEVICE_INFO_PACKAGE).UserDeviceInfo |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 38 | |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 39 | ifeq ($(DEVICE_INFO_MIN_SDK),) |
| 40 | DEVICE_INFO_MIN_SDK := 8 |
| 41 | endif |
| 42 | |
| 43 | ifeq ($(DEVICE_INFO_TARGET_SDK),) |
| 44 | DEVICE_INFO_TARGET_SDK := 8 |
| 45 | endif |
| 46 | |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 47 | # Add the base device info |
Stuart Scott | 252d375 | 2016-02-02 13:09:47 -0800 | [diff] [blame] | 48 | LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 49 | |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 50 | # Generator of APK manifests. |
| 51 | MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar |
| 52 | MANIFEST_GENERATOR := java -jar $(MANIFEST_GENERATOR_JAR) |
| 53 | |
| 54 | # Generate the manifest |
| 55 | manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml |
| 56 | $(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission)) |
| 57 | $(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity)) |
| 58 | $(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE) |
| 59 | $(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT) |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 60 | $(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK) |
| 61 | $(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK) |
Agatha Man | 62a97bf | 2015-07-14 13:47:47 -0700 | [diff] [blame] | 62 | |
| 63 | # Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed. |
| 64 | $(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] | 65 | $(hide) echo Generating manifest for $(PRIVATE_NAME) |
| 66 | $(hide) mkdir -p $(dir $@) |
| 67 | $(hide) $(MANIFEST_GENERATOR) \ |
| 68 | $(PRIVATE_INFO_PERMISSIONS) \ |
| 69 | $(PRIVATE_INFO_ACTIVITIES) \ |
| 70 | -p $(PRIVATE_PACKAGE) \ |
| 71 | -i $(PRIVATE_INSTRUMENT) \ |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 72 | -s $(PRIVATE_MIN_SDK) \ |
| 73 | -t $(PRIVATE_TARGET_SDK) \ |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 74 | -o $@ |
| 75 | |
| 76 | # Reset variables |
Agatha Man | f2ea3fb | 2015-10-21 19:30:36 -0700 | [diff] [blame] | 77 | DEVICE_INFO_MIN_SDK := |
| 78 | DEVICE_INFO_TARGET_SDK := |
Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 79 | DEVICE_INFO_PACKAGE := |
| 80 | DEVICE_INFO_INSTRUMENT := |
| 81 | DEVICE_INFO_PERMISSIONS := |
| 82 | DEVICE_INFO_ACTIVITIES := |
| 83 | |
| 84 | LOCAL_FULL_MANIFEST_FILE := $(manifest_xml) |
| 85 | # Disable by default |
| 86 | LOCAL_DEX_PREOPT := false |
| 87 | LOCAL_PROGUARD_ENABLED := disabled |
| 88 | |
| 89 | # Don't include this package in any target |
| 90 | LOCAL_MODULE_TAGS := optional |
| 91 | # And when built explicitly put it in the data partition |
| 92 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) |
| 93 | |
| 94 | LOCAL_SDK_VERSION := current |
| 95 | |
Agatha Man | 2285129 | 2015-06-29 16:54:32 -0700 | [diff] [blame] | 96 | include $(BUILD_CTS_SUPPORT_PACKAGE) |