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.ACCESS_FINE_LOCATION \ 27 android.permission.READ_PHONE_STATE \ 28 android.permission.WRITE_EXTERNAL_STORAGE 29DEVICE_INFO_ACTIVITIES += \ 30 $(DEVICE_INFO_PACKAGE).AppStandbyDeviceInfo \ 31 $(DEVICE_INFO_PACKAGE).BiometricsDeviceInfo \ 32 $(DEVICE_INFO_PACKAGE).ClientIdDeviceInfo \ 33 $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \ 34 $(DEVICE_INFO_PACKAGE).ConnectivityDeviceInfo \ 35 $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \ 36 $(DEVICE_INFO_PACKAGE).DefaultAppDeviceInfo \ 37 $(DEVICE_INFO_PACKAGE).DeviceIdleDeviceInfo \ 38 $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \ 39 $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \ 40 $(DEVICE_INFO_PACKAGE).GlesStubActivity \ 41 $(DEVICE_INFO_PACKAGE).GnssDeviceInfo \ 42 $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \ 43 $(DEVICE_INFO_PACKAGE).HapticsDeviceInfo \ 44 $(DEVICE_INFO_PACKAGE).InputDeviceInfo \ 45 $(DEVICE_INFO_PACKAGE).KeystoreAttestationDeviceInfo \ 46 $(DEVICE_INFO_PACKAGE).LocaleDeviceInfo \ 47 $(DEVICE_INFO_PACKAGE).MediaDeviceInfo \ 48 $(DEVICE_INFO_PACKAGE).MediaOutputDeviceInfo \ 49 $(DEVICE_INFO_PACKAGE).MemoryDeviceInfo \ 50 $(DEVICE_INFO_PACKAGE).PackageDeviceInfo \ 51 $(DEVICE_INFO_PACKAGE).PermissionDeviceInfo \ 52 $(DEVICE_INFO_PACKAGE).ScreenDeviceInfo \ 53 $(DEVICE_INFO_PACKAGE).StorageDeviceInfo \ 54 $(DEVICE_INFO_PACKAGE).UserDeviceInfo \ 55 $(DEVICE_INFO_PACKAGE).VintfDeviceInfo \ 56 com.android.compatibility.common.util.DummyActivity 57 58ifeq ($(DEVICE_INFO_MIN_SDK),) 59DEVICE_INFO_MIN_SDK := 8 60endif 61 62ifeq ($(DEVICE_INFO_TARGET_SDK),) 63DEVICE_INFO_TARGET_SDK := 17 64endif 65 66# Add the base device info 67LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt 68 69# Generator of APK manifests. 70MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar 71MANIFEST_GENERATOR := $(JAVA) -jar $(MANIFEST_GENERATOR_JAR) 72 73# Generate the manifest 74manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml 75$(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission)) 76$(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity)) 77$(manifest_xml): PRIVATE_USES_LIBRARY := $(DEVICE_INFO_USES_LIBRARY) 78$(manifest_xml): PRIVATE_USES_OPTIONAL_LIBRARIES := $(foreach library,$(DEVICE_INFO_USES_OPTIONAL_LIBRARIES),-lo $(library)) 79$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE) 80$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT) 81$(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK) 82$(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK) 83 84# Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed. 85$(manifest_xml): $(MANIFEST_GENERATOR_JAR) $(LOCAL_PATH)/Android.mk cts/build/device_info_package.mk 86 $(hide) echo Generating manifest for $(PRIVATE_NAME) 87 $(hide) mkdir -p $(dir $@) 88 $(hide) $(MANIFEST_GENERATOR) \ 89 $(PRIVATE_INFO_PERMISSIONS) \ 90 $(PRIVATE_INFO_ACTIVITIES) \ 91 -l $(PRIVATE_USES_LIBRARY) \ 92 $(PRIVATE_USES_OPTIONAL_LIBRARIES) \ 93 -p $(PRIVATE_PACKAGE) \ 94 -i $(PRIVATE_INSTRUMENT) \ 95 -s $(PRIVATE_MIN_SDK) \ 96 -t $(PRIVATE_TARGET_SDK) \ 97 -o $@ 98 99# Reset variables 100DEVICE_INFO_MIN_SDK := 101DEVICE_INFO_TARGET_SDK := 102DEVICE_INFO_PACKAGE := 103DEVICE_INFO_INSTRUMENT := 104DEVICE_INFO_PERMISSIONS := 105DEVICE_INFO_ACTIVITIES := 106 107LOCAL_FULL_MANIFEST_FILE := $(manifest_xml) 108# Disable by default 109LOCAL_DEX_PREOPT := false 110LOCAL_PROGUARD_ENABLED := disabled 111 112# Don't include this package in any target 113LOCAL_MODULE_TAGS := optional 114# And when built explicitly put it in the data partition 115LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) 116 117 118#TODO(b/72620511) remove this condition when AtsDeviceInfo can be built with SDK again 119ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),true) 120LOCAL_SDK_VERSION := current 121endif 122 123include $(BUILD_CTS_SUPPORT_PACKAGE) 124