Revert "Don't extract jni from prebuilt apks."
This reverts commit 3797466fbd31cc3ca5a1eddea64e7fdf0921ea67.
Bug: 20810492
Bug: 20811499
Change-Id: Ic922d9daccc4550db489c0f3d4ad6b4ff85b5e60
diff --git a/core/definitions.mk b/core/definitions.mk
index f674d9f..fc18ee3 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2097,7 +2097,8 @@
$(foreach abi,$(PRIVATE_JNI_SHARED_LIBRARIES_ABI),\
$(call _add-jni-shared-libs-to-package-per-abi,$(abi),\
$(patsubst $(abi):%,%,$(filter $(abi):%,$(PRIVATE_JNI_SHARED_LIBRARIES)))))
-$(hide) (cd $(dir $@) && zip -r -0 $(notdir $@) lib)
+$(hide) (cd $(dir $@) && zip -r \
+ $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-0,) $(notdir $@) lib)
$(hide) rm -rf $(dir $@)lib
endef
@@ -2143,22 +2144,21 @@
define align-package
$(hide) mv $@ $@.unaligned
$(hide) $(ZIPALIGN) \
- -f -p \
+ -f \
+ $(if $(filter true, $(PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES)),-p,) \
4 \
$@.unaligned $@.aligned
$(hide) mv $@.aligned $@
endef
-# Uncompress shared libraries embedded in an apk.
-#
define uncompress-shared-libs
-$(hide) if unzip -l $@ $(PRIVATE_EMBEDDED_JNI_LIBS) >/dev/null ; then \
- rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
- unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
- zip -d $@ 'lib/*.so' && \
- ( cd $(dir $@)uncompressedlibs && zip -D -r -0 ../$(notdir $@) lib ) && \
- rm -rf $(dir $@)uncompressedlibs; \
- fi
+$(hide) rm -rf $(dir $@)/tmpworkdir
+$(hide) mv $@ $@.compressed
+$(hide) mkdir $(dir $@)/tmpworkdir
+$(hide) unzip $@.compressed 'lib/*.so' -d $(dir $@)/tmpworkdir
+$(hide) ( cd $(dir $@)/tmpworkdir && zip -D -r -0 ../$(notdir $@).compressed lib )
+$(hide) mv $@.compressed $@
+$(hide) rm -rf $(dir $@)/tmpworkdir
endef
define install-dex-debug