Embed jni libs in vendor apks for treble-ized devices

JNI libs used by bundled APKs have been installed outside of the APK
(e.g. /system/lib and /vendor/lib) to save space because multiple APKs
may share the same set of JNI libs.

However, this causes problem for treble-ized devices where access to
/vendor/lib is prohibited for system processes including Java apps.

So, the JNI libs are embedded into the APK when the APK is installed to
/vendor partition and the device is fully treble-ized.

Bug: 37491282
Test: Move an APK and its JNI libraries to vendor partition by setting
LOCAL_PROPRIETARY_MODULE := true and build:
The jni lib does not exist under /system or /vendor. unzipping
the apk reveals the jni lib under ./lib/<abi> directory.

Merged-In: I8389761dfbd28d181869d79f0bf988a1e4df2fca
Change-Id: I8389761dfbd28d181869d79f0bf988a1e4df2fca
(cherry picked from commit 1cb8dea625)
This commit is contained in:
Jiyong Park 2017-04-19 18:06:45 +09:00 committed by Iliyan Malchev
parent f4ccb4f735
commit e1a3b367fe
1 changed files with 13 additions and 3 deletions

View File

@ -18,9 +18,19 @@ endif
ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
my_embed_jni := true
endif
ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
# If this app isn't to be installed to system partitions.
my_embed_jni := true
ifeq ($(PRODUCT_FULL_TREBLE),true)
ifeq ($(filter $(TARGET_OUT)/%, $(my_module_path)),)
# If this app isn't to be installed to the system partition, and the device
# is fully treble-ized then jni libs are embedded, Otherwise, access to the
# directory where the lib is installed to (usually /vendor/lib) needs to be
# allowed for system processes, which is a Treble violation.
my_embed_jni := true
endif
else
ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
# If this app isn't to be installed to system, vendor, or oem partitions.
my_embed_jni := true
endif
endif
jni_shared_libraries :=