Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2739)

Unified Diff: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java

Issue 1137313003: Add use_apk_split parameter to java_apk.gypi / android_apk (gn) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@package_resources
Patch Set: Fixed Linker to look in split for .so Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/finalize_apk_action.gypi » ('j') | build/java_apk.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | build/android/finalize_apk_action.gypi » ('j') | build/java_apk.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698