diff options
author | Shibin George <shibing@codeaurora.org> | 2015-10-29 16:32:30 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-11-04 02:39:36 -0800 |
commit | e75f8a55f66eae218433efaf3626bb9c89d18bc2 (patch) | |
tree | b21b4441949ba9a19ef042de27f34c80ce604933 /core/jni | |
parent | 7d73765111025eb9944580777260d4cdf0fb3d7e (diff) | |
download | frameworks_base-e75f8a55f66eae218433efaf3626bb9c89d18bc2.zip frameworks_base-e75f8a55f66eae218433efaf3626bb9c89d18bc2.tar.gz frameworks_base-e75f8a55f66eae218433efaf3626bb9c89d18bc2.tar.bz2 |
Add additional checks for overriding ABI for apps
Scan 'assets' folder for native libraries only if ABI after
scanning 'lib' folder was not set to 32-bit.
Change-Id: I55e4a8531d2a772037e634a34c40280cc33fab8e
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/com_android_internal_content_NativeLibraryHelper.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp index f7f19b4..e6e413d 100644 --- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp +++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp @@ -499,17 +499,28 @@ static int findSupportedAbi(JNIEnv *env, jlong apkHandle, jobjectArray supported } } } - int asset_status = NO_NATIVE_LIBRARIES; - int rc = initAssetsVerifierLib(); - if (rc == LIB_INITED_AND_SUCCESS) { - asset_status = GetAssetsStatusFunc(zipFile, supportedAbis, numAbis); - } else { - ALOGE("Failed to load assets verifier: %d", rc); - } - if (asset_status == 1) { - // override the status if asset_status hints at 32-bit abi - status = 1; + if(status <= 0) { + // Scan the 'assets' folder only if + // the abi (after scanning the lib folder) + // is not already set to 32-bit (i.e '1' or '2'). + + int asset_status = NO_NATIVE_LIBRARIES; + int rc = initAssetsVerifierLib(); + + if (rc == LIB_INITED_AND_SUCCESS) { + asset_status = GetAssetsStatusFunc(zipFile, supportedAbis, numAbis); + } else { + ALOGE("Failed to load assets verifier: %d", rc); + } + if(asset_status >= 0) { + // Override the ABI only if + // 'asset_status' is a valid ABI (64-bit or 32-bit). + // This is to prevent cases where 'lib' folder + // has native libraries, but + // 'assets' folder has none. + status = asset_status; + } } for (int i = 0; i < numAbis; ++i) { |