Add LOCAL_JNI_SHARED_LIBRARIES_ABI build variable.

LOCAL_JNI_SHARED_LIBRARIES_ABI allows individual APKs to specify
specify the path where JNI shared libraries are stored in the APK. This
is useful if you want to build an APK that supports a generic version of
an ABI (e.g. armeabi) from a device configuration where
TARGET_CPU_ABI is set to a more specific version of an ABI (e.g.
armeabi-v7a.)

Note that specifying the LOCAL_JNI_SHARED_LIBRARIES_ABI does not
affect how the local JNI shared libraries are built. It just controls
where the local JNI shared libraries are placed within the APK.

Defaults to TARGET_CPU_ABI.

Change-Id: I1cbb293e0c953688945fc147c7fc367421cf860b
diff --git a/core/package.mk b/core/package.mk
index cdeefb4..bffda93 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -278,6 +278,16 @@
       $(addsuffix $(so_suffix), \
         $(LOCAL_JNI_SHARED_LIBRARIES)))
 
+# Set the abi directory used by the local JNI shared libraries.
+# (Doesn't change how the local shared libraries are compiled, just
+# sets where they are stored in the apk.)
+
+ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
+    jni_shared_libraries_abi := $(TARGET_CPU_ABI)
+else
+    jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
+endif
+
 # Pick a key to sign the package with.  If this package hasn't specified
 # an explicit certificate, use the default.
 # Secure release builds will have their packages signed after the fact,
@@ -311,6 +321,7 @@
 # Define the rule to build the actual package.
 $(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
 $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
+$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
 ifneq ($(TARGET_BUILD_APPS),)
     # Include all resources for unbundled apps.
     $(LOCAL_BUILT_MODULE): PRODUCT_AAPT_CONFIG :=