blob: a79e8483bf6b9ba65fe9d0cf243f0a47f9fd5283 [file] [log] [blame]
Agatha Man36fc50c2015-07-27 10:34:24 -07001# 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
Brett Chabot43905f82019-02-15 14:22:14 -080020DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner
Aaron Holden850562b2017-11-09 16:07:31 -080021DEVICE_INFO_USES_LIBRARY := android.test.runner
Chris Lid77dd252020-09-29 14:53:15 -070022DEVICE_INFO_USES_OPTIONAL_LIBRARIES := \
23 androidx.window.sidecar
Agatha Man2ba85452017-12-07 09:02:56 -080024DEVICE_INFO_PERMISSIONS += \
25 android.permission.READ_PHONE_STATE \
26 android.permission.WRITE_EXTERNAL_STORAGE
Nicholas Sauerc7d0ede2015-12-08 11:56:30 -080027DEVICE_INFO_ACTIVITIES += \
Suprabh Shukla66d54972018-05-15 18:04:50 -070028 $(DEVICE_INFO_PACKAGE).AppStandbyDeviceInfo \
Aaron Holden2769ff32019-04-22 16:21:51 -070029 $(DEVICE_INFO_PACKAGE).ClientIdDeviceInfo \
Nicholas Sauerc7d0ede2015-12-08 11:56:30 -080030 $(DEVICE_INFO_PACKAGE).ConfigurationDeviceInfo \
31 $(DEVICE_INFO_PACKAGE).CpuDeviceInfo \
32 $(DEVICE_INFO_PACKAGE).FeatureDeviceInfo \
33 $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \
Agatha Man7941c812016-01-07 10:22:17 -080034 $(DEVICE_INFO_PACKAGE).GlesStubActivity \
Nicholas Sauerc7d0ede2015-12-08 11:56:30 -080035 $(DEVICE_INFO_PACKAGE).GraphicsDeviceInfo \
Nicholas Sauerc7d0ede2015-12-08 11:56:30 -080036 $(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 Hong53b415d2017-04-28 16:59:28 -070043 $(DEVICE_INFO_PACKAGE).UserDeviceInfo \
Chris Lid77dd252020-09-29 14:53:15 -070044 $(DEVICE_INFO_PACKAGE).VintfDeviceInfo \
45 com.android.compatibility.common.util.DummyActivity
Agatha Man36fc50c2015-07-27 10:34:24 -070046
Agatha Manf2ea3fb2015-10-21 19:30:36 -070047ifeq ($(DEVICE_INFO_MIN_SDK),)
48DEVICE_INFO_MIN_SDK := 8
49endif
50
51ifeq ($(DEVICE_INFO_TARGET_SDK),)
Przemyslaw Szczepaniakaed87e92017-12-05 13:23:30 +000052DEVICE_INFO_TARGET_SDK := 17
Agatha Manf2ea3fb2015-10-21 19:30:36 -070053endif
54
Agatha Man36fc50c2015-07-27 10:34:24 -070055# Add the base device info
Brett Chabot43905f82019-02-15 14:22:14 -080056LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt
Agatha Man36fc50c2015-07-27 10:34:24 -070057
Agatha Man36fc50c2015-07-27 10:34:24 -070058# Generator of APK manifests.
59MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
Colin Cross95fa0512017-06-30 14:19:12 -070060MANIFEST_GENERATOR := $(JAVA) -jar $(MANIFEST_GENERATOR_JAR)
Agatha Man36fc50c2015-07-27 10:34:24 -070061
62# Generate the manifest
63manifest_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 Holden850562b2017-11-09 16:07:31 -080066$(manifest_xml): PRIVATE_USES_LIBRARY := $(DEVICE_INFO_USES_LIBRARY)
Chris Lid77dd252020-09-29 14:53:15 -070067$(manifest_xml): PRIVATE_USES_OPTIONAL_LIBRARIES := $(foreach library,$(DEVICE_INFO_USES_OPTIONAL_LIBRARIES),-lo $(library))
Agatha Man36fc50c2015-07-27 10:34:24 -070068$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE)
69$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT)
Agatha Manf2ea3fb2015-10-21 19:30:36 -070070$(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK)
71$(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK)
Agatha Man62a97bf2015-07-14 13:47:47 -070072
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 Man36fc50c2015-07-27 10:34:24 -070075 $(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 Holden850562b2017-11-09 16:07:31 -080080 -l $(PRIVATE_USES_LIBRARY) \
Chris Lid77dd252020-09-29 14:53:15 -070081 $(PRIVATE_USES_OPTIONAL_LIBRARIES) \
Agatha Man36fc50c2015-07-27 10:34:24 -070082 -p $(PRIVATE_PACKAGE) \
83 -i $(PRIVATE_INSTRUMENT) \
Agatha Manf2ea3fb2015-10-21 19:30:36 -070084 -s $(PRIVATE_MIN_SDK) \
85 -t $(PRIVATE_TARGET_SDK) \
Agatha Man36fc50c2015-07-27 10:34:24 -070086 -o $@
87
88# Reset variables
Agatha Manf2ea3fb2015-10-21 19:30:36 -070089DEVICE_INFO_MIN_SDK :=
90DEVICE_INFO_TARGET_SDK :=
Agatha Man36fc50c2015-07-27 10:34:24 -070091DEVICE_INFO_PACKAGE :=
92DEVICE_INFO_INSTRUMENT :=
93DEVICE_INFO_PERMISSIONS :=
94DEVICE_INFO_ACTIVITIES :=
95
96LOCAL_FULL_MANIFEST_FILE := $(manifest_xml)
97# Disable by default
98LOCAL_DEX_PREOPT := false
99LOCAL_PROGUARD_ENABLED := disabled
100
101# Don't include this package in any target
102LOCAL_MODULE_TAGS := optional
103# And when built explicitly put it in the data partition
104LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
105
Jiyong Park2b2405c2018-03-05 20:30:52 +0900106
107#TODO(b/72620511) remove this condition when AtsDeviceInfo can be built with SDK again
108ifneq ($(LOCAL_PRIVATE_PLATFORM_APIS),true)
Agatha Man36fc50c2015-07-27 10:34:24 -0700109LOCAL_SDK_VERSION := current
Jiyong Park2b2405c2018-03-05 20:30:52 +0900110endif
Agatha Man36fc50c2015-07-27 10:34:24 -0700111
Agatha Man22851292015-06-29 16:54:32 -0700112include $(BUILD_CTS_SUPPORT_PACKAGE)