blob: e0b2ad9fc005623d4b7ba0a522436dac44247386 [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
21DEVICE_INFO_PERMISSIONS := android.permission.WRITE_EXTERNAL_STORAGE
22
23# Add the base device info
24LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info
25
26# DEVICE_INFO_ACTIVITIES += $(DEVICE_INFO_PACKAGE).GenericDeviceInfo
27
28# Generator of APK manifests.
29MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
30MANIFEST_GENERATOR := java -jar $(MANIFEST_GENERATOR_JAR)
31
32# Generate the manifest
33manifest_xml := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME))/AndroidManifest.xml
34$(manifest_xml): PRIVATE_INFO_PERMISSIONS := $(foreach permission, $(DEVICE_INFO_PERMISSIONS),-r $(permission))
35$(manifest_xml): PRIVATE_INFO_ACTIVITIES := $(foreach activity,$(DEVICE_INFO_ACTIVITIES),-a $(activity))
36$(manifest_xml): PRIVATE_PACKAGE := $(DEVICE_INFO_PACKAGE)
37$(manifest_xml): PRIVATE_INSTRUMENT := $(DEVICE_INFO_INSTRUMENT)
38$(manifest_xml): $(MANIFEST_GENERATOR_JAR)
39 $(hide) echo Generating manifest for $(PRIVATE_NAME)
40 $(hide) mkdir -p $(dir $@)
41 $(hide) $(MANIFEST_GENERATOR) \
42 $(PRIVATE_INFO_PERMISSIONS) \
43 $(PRIVATE_INFO_ACTIVITIES) \
44 -p $(PRIVATE_PACKAGE) \
45 -i $(PRIVATE_INSTRUMENT) \
46 -o $@
47
48# Reset variables
49DEVICE_INFO_PACKAGE :=
50DEVICE_INFO_INSTRUMENT :=
51DEVICE_INFO_PERMISSIONS :=
52DEVICE_INFO_ACTIVITIES :=
53
54LOCAL_FULL_MANIFEST_FILE := $(manifest_xml)
55# Disable by default
56LOCAL_DEX_PREOPT := false
57LOCAL_PROGUARD_ENABLED := disabled
58
59# Don't include this package in any target
60LOCAL_MODULE_TAGS := optional
61# And when built explicitly put it in the data partition
62LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
63
64LOCAL_SDK_VERSION := current
65
66include $(BUILD_PACKAGE)
67