Index: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
index 9dc686572d0bb4a5f85b2b74c8fa5d012c6fb480..43cd3ab1add0ed802448bc6b2405537ad7c9cdd5 100644 |
--- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
+++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java |
@@ -5,7 +5,12 @@ |
package org.chromium.base.library_loader; |
import android.content.Context; |
+import android.content.pm.ApplicationInfo; |
+import android.content.pm.PackageInfo; |
+import android.content.pm.PackageManager; |
+import android.content.pm.PackageManager.NameNotFoundException; |
import android.os.AsyncTask; |
+import android.os.Build; |
import android.os.SystemClock; |
import android.util.Log; |
@@ -250,7 +255,7 @@ public class LibraryLoader { |
// Check if the device supports memory mapping the APK file |
// with executable permissions. |
if (context != null) { |
- apkFilePath = context.getApplicationInfo().sourceDir; |
+ apkFilePath = getLibraryApkPath(context); |
Yaron
2015/05/13 21:38:22
I'm confused. Isn't this for the case where load_l
agrieve
2015/05/14 14:53:34
This is the linker patch. The fix was easy enough
|
if (mProbeMapApkWithExecPermission) { |
mMapApkWithExecPermission = Linker.checkMapExecSupport(apkFilePath); |
} |
@@ -364,6 +369,30 @@ public class LibraryLoader { |
} |
} |
+ // Returns the path to the .apk that holds the native libraries. |
+ // This is either the main .apk, or the abi split apk. |
+ private static String getLibraryApkPath(Context context) { |
Yaron
2015/05/13 21:38:22
I think you need to add:
@TargetApi(Build.VERSION
agrieve
2015/05/14 14:53:34
Done.
|
+ ApplicationInfo appInfo = context.getApplicationInfo(); |
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { |
+ return appInfo.sourceDir; |
+ } |
+ PackageManager manager = context.getPackageManager(); |
+ PackageInfo packageInfo = null; |
+ try { |
+ packageInfo = manager.getPackageInfo(context.getPackageName(), 0); |
+ } catch (NameNotFoundException e) { |
+ // Should never happen. |
+ } |
+ if (packageInfo.splitNames != null) { |
+ for (int i = 0; i < packageInfo.splitNames.length; ++i) { |
+ if (packageInfo.splitNames[i].startsWith("abi_")) { |
+ return appInfo.splitSourceDirs[i]; |
+ } |
+ } |
+ } |
+ return appInfo.sourceDir; |
+ } |
+ |
// Load a native shared library with the Chromium linker. If the zip file |
// path is not null, the library is loaded directly from the zip file. |
private void loadLibrary(@Nullable String zipFilePath, String libFilePath) { |