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 20 DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner 21 DEVICE_INFO_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE 22 DEVICE_INFO_ACTIVITIES += \ 23 $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \ 24 $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \ 25 $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \ 26 $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \ 27 $(DEVICE_INFO_PACKAGE).GlesStubActivity \ 28 $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \ 29 $(DEVICE_INFO_PACKAGE).LocaleDeviceInfo \ 30 $(DEVICE_INFO_PACKAGE).MediaDeviceInfo \ 31 $(DEVICE_INFO_PACKAGE).MemoryDeviceInfo \ 32 $(DEVICE_INFO_PACKAGE).PackageDeviceInfo \ 33 $(DEVICE_INFO_PACKAGE).PropertyDeviceInfo \ 34 $(DEVICE_INFO_PACKAGE).ScreenDeviceInfo \ 35 $(DEVICE_INFO_PACKAGE).StorageDeviceInfo \ 36 $(DEVICE_INFO_PACKAGE).UserDeviceInfo \ 37 $(DEVICE_INFO_PACKAGE).VintfDeviceInfo 38 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 47 # Add the base device info 48 LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util 49 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) 60 $(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK) 61 $(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK) 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 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) \ 72 -s $(PRIVATE_MIN_SDK) \ 73 -t $(PRIVATE_TARGET_SDK) \ 74 -o $@ 75 76 # Reset variables 77 DEVICE_INFO_MIN_SDK := 78 DEVICE_INFO_TARGET_SDK := 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 96 include $(BUILD_CTS_SUPPORT_PACKAGE) 97