From e53dd7b20bcdeda45424109bc85a42f945ecd41d Mon Sep 17 00:00:00 2001 From: Victor Hsieh Date: Mon, 22 Oct 2018 11:25:05 -0700 Subject: [PATCH] Allow target to specify LOCAL_PREFER_INTEGRITY The option will: - Produce APK with uncompressed dex - Declare to prefer integrity in manifest Test: unzip -vl, dex compression looks correct with the option provided or not. Test: similarly, aapt dump correct attribute Bug: None Change-Id: I16b9a37255150c2ad84af84087dfabb536a3b07a --- core/android_manifest.mk | 5 +++++ core/clear_vars.mk | 1 + core/dex_preopt_odex_install.mk | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/core/android_manifest.mk b/core/android_manifest.mk index 8608ca1df1..c3af942f9a 100644 --- a/core/android_manifest.mk +++ b/core/android_manifest.mk @@ -71,6 +71,11 @@ endif ifeq ($(LOCAL_PRIVATE_PLATFORM_APIS),true) my_manifest_fixer_flags += --uses-non-sdk-api endif + +ifeq (true,$(LOCAL_PREFER_INTEGRITY)) + my_manifest_fixer_flags += --prefer-integrity +endif + $(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := $(my_manifest_fixer_flags) # These two libs are added as optional dependencies ( with # android:required set to false). This is because they haven't existed in pre-P diff --git a/core/clear_vars.mk b/core/clear_vars.mk index a036267fba..6fe9d02b90 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -213,6 +213,7 @@ LOCAL_PREBUILT_MODULE_FILE:= LOCAL_PREBUILT_OBJ_FILES:= LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:= LOCAL_PREBUILT_STRIP_COMMENTS:= +LOCAL_PREFER_INTEGRITY:= LOCAL_PRESUBMIT_DISABLED:= LOCAL_PRIVATE_PLATFORM_APIS:= LOCAL_PRIVILEGED_MODULE:= diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 62597d14df..ff49fe8413 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -3,6 +3,12 @@ # Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex, # dexpreopt_boot_jar_module +ifeq (true,$(LOCAL_PREFER_INTEGRITY)) + LOCAL_UNCOMPRESS_DEX := true +else + LOCAL_UNCOMPRESS_DEX := +endif + # We explicitly uncompress APKs of privileged apps, and used by # privileged apps ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))