Agatha Man | 36fc50c | 2015-07-27 10:34:24 -0700 | [diff] [blame] | 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 | |
| 19 | DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo |
| 20 | DEVICE_INFO_INSTRUMENT := com.android.compatibility.common.deviceinfo.DeviceInfoInstrument |
| 21 | DEVICE_INFO_PERMISSIONS := android.permission.WRITE_EXTERNAL_STORAGE |
| 22 | |
| 23 | # Add the base device info |
| 24 | LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info |
| 25 | |
| 26 | # DEVICE_INFO_ACTIVITIES += $(DEVICE_INFO_PACKAGE).GenericDeviceInfo |
| 27 | |
| 28 | # Generator of APK manifests. |
| 29 | MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar |
| 30 | MANIFEST_GENERATOR := java -jar $(MANIFEST_GENERATOR_JAR) |
| 31 | |
| 32 | # Generate the manifest |
| 33 | manifest_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 |
| 49 | DEVICE_INFO_PACKAGE := |
| 50 | DEVICE_INFO_INSTRUMENT := |
| 51 | DEVICE_INFO_PERMISSIONS := |
| 52 | DEVICE_INFO_ACTIVITIES := |
| 53 | |
| 54 | LOCAL_FULL_MANIFEST_FILE := $(manifest_xml) |
| 55 | # Disable by default |
| 56 | LOCAL_DEX_PREOPT := false |
| 57 | LOCAL_PROGUARD_ENABLED := disabled |
| 58 | |
| 59 | # Don't include this package in any target |
| 60 | LOCAL_MODULE_TAGS := optional |
| 61 | # And when built explicitly put it in the data partition |
| 62 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) |
| 63 | |
| 64 | LOCAL_SDK_VERSION := current |
| 65 | |
| 66 | include $(BUILD_PACKAGE) |
| 67 | |