Merge "Make manifest and APK agree on uncompressed native libs" am: 010df4b471
am: b568c2e15d
am: 2197223be0
Change-Id: Iafc06c2cfb9ccdcb3d6774863c1a146977277ded
This commit is contained in:
commit
e8903ad55c
|
@ -1,5 +1,6 @@
|
|||
# Handle AndroidManifest.xmls
|
||||
# Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES
|
||||
# Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES,
|
||||
# LOCAL_USE_EMBEDDED_NATIVE_LIBS
|
||||
# Output: full_android_manifest
|
||||
|
||||
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
||||
|
@ -65,6 +66,18 @@ ifeq (true,$(LOCAL_USE_EMBEDDED_DEX))
|
|||
my_manifest_fixer_flags += --use-embedded-dex
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_MODULE_CLASS),APPS)
|
||||
ifeq (true,$(call math_gt_or_eq,$(patsubst $(PLATFORM_VERSION_CODENAME),100,$(call module-min-sdk-version)),23))
|
||||
ifeq (true,$(LOCAL_USE_EMBEDDED_NATIVE_LIBS))
|
||||
my_manifest_fixer_flags += --extract-native-libs=false
|
||||
else
|
||||
my_manifest_fixer_flags += --extract-native-libs=true
|
||||
endif
|
||||
else ifeq (true,$(LOCAL_USE_EMBEDDED_NATIVE_LIBS))
|
||||
$(call pretty-error,LOCAL_USE_EMBEDDED_NATIVE_LIBS is set but minSdkVersion $(call module-min-sdk-version) does not support it)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := $(my_manifest_fixer_flags)
|
||||
# These two libs are added as optional dependencies (<uses-library> with
|
||||
# android:required set to false). This is because they haven't existed in pre-P
|
||||
|
|
|
@ -211,6 +211,7 @@ LOCAL_PREBUILT_OBJ_FILES:=
|
|||
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
|
||||
LOCAL_PREBUILT_STRIP_COMMENTS:=
|
||||
LOCAL_USE_EMBEDDED_DEX:=
|
||||
LOCAL_USE_EMBEDDED_NATIVE_LIBS:=
|
||||
LOCAL_PRESUBMIT_DISABLED:=
|
||||
LOCAL_PRIVATE_PLATFORM_APIS:=
|
||||
LOCAL_PRIVILEGED_MODULE:=
|
||||
|
|
|
@ -2275,24 +2275,15 @@ $(hide) cp $(3) $(dir $(1))lib/$(2)
|
|||
|
||||
endef
|
||||
|
||||
# For apps_only build, don't uncompress/page-align the jni libraries,
|
||||
# because the apk may be run on older platforms that don't support loading jni directly from apk.
|
||||
ifdef TARGET_BUILD_APPS
|
||||
JNI_COMPRESS_FLAGS :=
|
||||
ZIPALIGN_PAGE_ALIGN_FLAGS :=
|
||||
else
|
||||
JNI_COMPRESS_FLAGS := -L 0
|
||||
ZIPALIGN_PAGE_ALIGN_FLAGS := -p
|
||||
endif
|
||||
|
||||
# $(1): the package file
|
||||
# $(2): if true, uncompress jni libs
|
||||
define create-jni-shared-libs-package
|
||||
rm -rf $(dir $(1))lib
|
||||
mkdir -p $(addprefix $(dir $(1))lib/,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI))
|
||||
$(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\
|
||||
$(call _add-jni-shared-libs-to-package-per-abi,$(1),$(abi),\
|
||||
$(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES)))))
|
||||
$(SOONG_ZIP) $(JNI_COMPRESS_FLAGS) -o $(1) -C $(dir $(1)) -D $(dir $(1))lib
|
||||
$(SOONG_ZIP) $(if $(2),-L 0) -o $(1) -C $(dir $(1)) -D $(dir $(1))lib
|
||||
rm -rf $(dir $(1))lib
|
||||
endef
|
||||
|
||||
|
@ -2360,7 +2351,7 @@ $(hide) if ! $(ZIPALIGN) -c $(ZIPALIGN_PAGE_ALIGN_FLAGS) 4 $@ >/dev/null ; then
|
|||
mv $@ $@.unaligned; \
|
||||
$(ZIPALIGN) \
|
||||
-f \
|
||||
$(ZIPALIGN_PAGE_ALIGN_FLAGS) \
|
||||
-p \
|
||||
4 \
|
||||
$@.unaligned $@.aligned; \
|
||||
mv $@.aligned $@; \
|
||||
|
|
|
@ -332,6 +332,12 @@ ifdef LOCAL_COMPRESSED_MODULE
|
|||
LOCAL_DEX_PREOPT := false
|
||||
endif
|
||||
|
||||
# Default to use uncompressed native libraries in APKs if minSdkVersion >= marshmallow
|
||||
ifndef LOCAL_USE_EMBEDDED_NATIVE_LIBS
|
||||
LOCAL_USE_EMBEDDED_NATIVE_LIBS := $(call math_gt_or_eq, \
|
||||
$(patsubst $(PLATFORM_VERSION_CODENAME),100,$(call module-min-sdk-version)),23)
|
||||
endif
|
||||
|
||||
include $(BUILD_SYSTEM)/android_manifest.mk
|
||||
|
||||
resource_export_package :=
|
||||
|
@ -612,6 +618,7 @@ $(LOCAL_BUILT_MODULE) : $(intermediates)/strip.sh
|
|||
$(LOCAL_BUILT_MODULE) : | $(DEXPREOPT_STRIP_DEPS)
|
||||
$(LOCAL_BUILT_MODULE): .KATI_DEPFILE := $(LOCAL_BUILT_MODULE).d
|
||||
endif
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_USE_EMBEDDED_NATIVE_LIBS := $(LOCAL_USE_EMBEDDED_NATIVE_LIBS)
|
||||
$(LOCAL_BUILT_MODULE):
|
||||
@echo "target Package: $(PRIVATE_MODULE) ($@)"
|
||||
rm -rf $@.parts
|
||||
|
@ -622,7 +629,7 @@ else # ! LOCAL_USE_AAPT2
|
|||
$(call create-assets-package,$@.parts/apk.zip)
|
||||
endif # LOCAL_USE_AAPT2
|
||||
ifneq ($(jni_shared_libraries),)
|
||||
$(call create-jni-shared-libs-package,$@.parts/jni.zip)
|
||||
$(call create-jni-shared-libs-package,$@.parts/jni.zip,$(PRIVATE_USE_EMBEDDED_NATIVE_LIBS))
|
||||
endif
|
||||
ifeq ($(full_classes_jar),)
|
||||
# We don't build jar, need to add the Java resources here.
|
||||
|
|
Loading…
Reference in New Issue