Revert "Don't extract jni from prebuilt apks."

This reverts commit 3797466fbd31cc3ca5a1eddea64e7fdf0921ea67.

Bug: 20810492
Bug: 20811499
Change-Id: Ic922d9daccc4550db489c0f3d4ad6b4ff85b5e60
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 19fdad6..8d03746 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -195,18 +195,14 @@
 include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
 #######################################
 # Sign and align non-presigned .apks.
-
-# The embedded prebuilt jni to uncompress.
-ifndef embedded_prebuilt_jni_libs
-# No LOCAL_PREBUILT_JNI_LIBS, uncompress all.
-embedded_prebuilt_jni_libs := 'lib/*.so'
-endif
-$(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs)
-
+$(built_module) : PRIVATE_PAGE_ALIGN_JNI_SHARED_LIBRARIES := $(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES)
 $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
 	$(transform-prebuilt-to-target)
 ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
 	@# Only strip out files if we can re-sign the package.
+ifdef extracted_jni_libs
+	$(hide) zip -d $@ 'lib/*.so'  # strip embedded JNI libraries.
+endif
 ifdef LOCAL_DEX_PREOPT
 ifneq (nostripping,$(LOCAL_DEX_PREOPT))
 	$(call dexpreopt-remove-classes.dex,$@)
@@ -214,7 +210,9 @@
 endif
 	$(sign-package)
 endif
+ifeq ($(LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES),true)
 	$(uncompress-shared-libs)
+endif
 	$(align-package)
 
 ###############################