blob: 5e048b3b882548560895e6b0fd8ddf53f8eab835 [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
20DEVICE_INFO_INSTRUMENT := com.android.compatibility.common.deviceinfo.DeviceInfoInstrument
Agatha Man62a97bf2015-07-14 13:47:47 -070021DEVICE_INFO_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE
Yin-Chia Yehcab7ded2016-02-23 14:57:21 -080022DEVICE_INFO_ACTIVITIES += \
23 $(DEVICE_INFO_PACKAGE).CameraDeviceInfo \
24 $(DEVICE_INFO_PACKAGE).GenericDeviceInfo \
25 $(DEVICE_INFO_PACKAGE).PackageDeviceInfo
Agatha Man36fc50c2015-07-27 10:34:24 -070026
27# Add the base device info
28LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info
29
Agatha Man36fc50c2015-07-27 10:34:24 -070030# Generator of APK manifests.
31MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
32MANIFEST_GENERATOR := java -jar $(MANIFEST_GENERATOR_JAR)
33
34# Generate the manifest
35manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml
36$(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission))
37$(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity))
38$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE)
39$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT)
Agatha Man62a97bf2015-07-14 13:47:47 -070040
41# Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed.
42$(manifest_xml): $(MANIFEST_GENERATOR_JAR) $(LOCAL_PATH)/Android.mk cts/build/device_info_package.mk
Agatha Man36fc50c2015-07-27 10:34:24 -070043 $(hide) echo Generating manifest for $(PRIVATE_NAME)
44 $(hide) mkdir -p $(dir $@)
45 $(hide) $(MANIFEST_GENERATOR) \
46 $(PRIVATE_INFO_PERMISSIONS) \
47 $(PRIVATE_INFO_ACTIVITIES) \
48 -p $(PRIVATE_PACKAGE) \
49 -i $(PRIVATE_INSTRUMENT) \
50 -o $@
51
52# Reset variables
53DEVICE_INFO_PACKAGE :=
54DEVICE_INFO_INSTRUMENT :=
55DEVICE_INFO_PERMISSIONS :=
56DEVICE_INFO_ACTIVITIES :=
57
58LOCAL_FULL_MANIFEST_FILE := $(manifest_xml)
59# Disable by default
60LOCAL_DEX_PREOPT := false
61LOCAL_PROGUARD_ENABLED := disabled
62
63# Don't include this package in any target
64LOCAL_MODULE_TAGS := optional
65# And when built explicitly put it in the data partition
66LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
67
68LOCAL_SDK_VERSION := current
69
Agatha Man22851292015-06-29 16:54:32 -070070include $(BUILD_CTS_SUPPORT_PACKAGE)