am 69b20474: Merge "Support LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES for prebuilt APKs"

* commit '69b20474d578ea6313570c29526fc0854a920946':
  Support LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES for prebuilt APKs
diff --git a/core/definitions.mk b/core/definitions.mk
index 6114395..8087f79 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1944,6 +1944,16 @@
 $(hide) mv $@.aligned $@
 endef
 
+define uncompress-shared-libs
+$(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
 $(hide) if [ -f "$(PRIVATE_INTERMEDIATES_DIR)/classes.dex" ]; then \
 	    mkdir -p $(TOP)/dalvik/DEBUG-FILES; \
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 8595bce..0a0a2ff 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -205,6 +205,9 @@
 endif
 	$(sign-package)
 endif
+ifeq ($(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES),true)
+	$(uncompress-shared-libs)
+endif
 	$(align-package)
 
 ###############################