blob: f46b5ed6be52c6afe54264ebcd46d6ee70afb1fb [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
Agatha Man71ba78d2015-10-05 20:14:31 -070020DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner
Agatha Man62a97bf2015-07-14 13:47:47 -070021DEVICE_INFO_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE
Agatha Man1dc45a92015-09-02 11:13:20 -070022DEVICE_INFO_ACTIVITIES += $(DEVICE_INFO_PACKAGE).GenericDeviceInfo $(DEVICE_INFO_PACKAGE).PackageDeviceInfo
Agatha Man36fc50c2015-07-27 10:34:24 -070023
Agatha Manf2ea3fb2015-10-21 19:30:36 -070024ifeq ($(DEVICE_INFO_MIN_SDK),)
25DEVICE_INFO_MIN_SDK := 8
26endif
27
28ifeq ($(DEVICE_INFO_TARGET_SDK),)
29DEVICE_INFO_TARGET_SDK := 8
30endif
31
Agatha Man36fc50c2015-07-27 10:34:24 -070032# Add the base device info
33LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info
34
Agatha Man36fc50c2015-07-27 10:34:24 -070035# Generator of APK manifests.
36MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
37MANIFEST_GENERATOR := java -jar $(MANIFEST_GENERATOR_JAR)
38
39# Generate the manifest
40manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml
41$(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission))
42$(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity))
43$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE)
44$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT)
Agatha Manf2ea3fb2015-10-21 19:30:36 -070045$(manifest_xml): PRIVATE_MIN_SDK := $(DEVICE_INFO_MIN_SDK)
46$(manifest_xml): PRIVATE_TARGET_SDK := $(DEVICE_INFO_TARGET_SDK)
Agatha Man62a97bf2015-07-14 13:47:47 -070047
48# Regenerate manifest.xml if the generator jar, */cts-device-info/Android.mk, or this file is changed.
49$(manifest_xml): $(MANIFEST_GENERATOR_JAR) $(LOCAL_PATH)/Android.mk cts/build/device_info_package.mk
Agatha Man36fc50c2015-07-27 10:34:24 -070050 $(hide) echo Generating manifest for $(PRIVATE_NAME)
51 $(hide) mkdir -p $(dir $@)
52 $(hide) $(MANIFEST_GENERATOR) \
53 $(PRIVATE_INFO_PERMISSIONS) \
54 $(PRIVATE_INFO_ACTIVITIES) \
55 -p $(PRIVATE_PACKAGE) \
56 -i $(PRIVATE_INSTRUMENT) \
Agatha Manf2ea3fb2015-10-21 19:30:36 -070057 -s $(PRIVATE_MIN_SDK) \
58 -t $(PRIVATE_TARGET_SDK) \
Agatha Man36fc50c2015-07-27 10:34:24 -070059 -o $@
60
61# Reset variables
Agatha Manf2ea3fb2015-10-21 19:30:36 -070062DEVICE_INFO_MIN_SDK :=
63DEVICE_INFO_TARGET_SDK :=
Agatha Man36fc50c2015-07-27 10:34:24 -070064DEVICE_INFO_PACKAGE :=
65DEVICE_INFO_INSTRUMENT :=
66DEVICE_INFO_PERMISSIONS :=
67DEVICE_INFO_ACTIVITIES :=
68
69LOCAL_FULL_MANIFEST_FILE := $(manifest_xml)
70# Disable by default
71LOCAL_DEX_PREOPT := false
72LOCAL_PROGUARD_ENABLED := disabled
73
74# Don't include this package in any target
75LOCAL_MODULE_TAGS := optional
76# And when built explicitly put it in the data partition
77LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
78
79LOCAL_SDK_VERSION := current
80
Agatha Man22851292015-06-29 16:54:32 -070081include $(BUILD_CTS_SUPPORT_PACKAGE)