Index: base/android/java/src/org/chromium/base/library_loader/Linker.java |
diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java |
index 8ad26d8a8391237e3dd60511487f10842deee12b..32d22fb6c549d3e28bc4036ab4a9facc559804e7 100644 |
--- a/base/android/java/src/org/chromium/base/library_loader/Linker.java |
+++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java |
@@ -727,8 +727,7 @@ public class Linker { |
// Don't self-load the linker. This is because the build system is |
// not clever enough to understand that all the libraries packaged |
// in the final .apk don't need to be explicitly loaded. |
- // Also deal with the component build that adds a .cr suffix to the name. |
- if (library.equals(TAG) || library.equals(TAG + ".cr")) { |
+ if (isLinkerLibrary(library)) { |
if (DEBUG) Log.i(TAG, "ignoring self-linker load"); |
return; |
} |
@@ -821,6 +820,14 @@ public class Linker { |
} |
/** |
+ * Determine whether a library is the linker library. Also deal with the |
+ * component build that adds a .cr suffix to the name. |
+ */ |
+ public static boolean isLinkerLibrary(String library) { |
+ return library.equals(TAG) || library.equals(TAG + ".cr"); |
+ } |
+ |
+ /** |
* Check whether the device supports loading a library directly from the APK file. |
* |
* @param apkFile Filename of the APK. |
@@ -840,6 +847,25 @@ public class Linker { |
} |
/** |
+ * Check whether a library is page aligned in the APK file. |
+ * |
+ * @param apkFile Filename of the APK. |
+ * @param library The library's base name. |
+ * @return true if page aligned. |
+ */ |
+ public static boolean checkLibraryAlignedInApk(String apkFile, String library) { |
+ synchronized (Linker.class) { |
+ ensureInitializedLocked(); |
+ |
+ if (DEBUG) Log.i(TAG, "checkLibraryAlignedInApk: " + apkFile + ", " + library); |
+ boolean aligned = nativeCheckLibraryAlignedInApk(apkFile, library); |
+ if (DEBUG) Log.i(TAG, library + " is " + (aligned ? "" : "NOT ") + |
+ "page aligned in " + apkFile); |
+ return aligned; |
+ } |
+ } |
+ |
+ /** |
* Move activity from the native thread to the main UI thread. |
* Called from native code on its own thread. Posts a callback from |
* the UI thread back to native code. |
@@ -942,11 +968,19 @@ public class Linker { |
* |
* @param apkFile Filename of the APK. |
* @return true if supported. |
- * |
*/ |
private static native boolean nativeCheckLibraryLoadFromApkSupport(String apkFile); |
/** |
+ * Native method which checks whether a library is page aligned in the APK file. |
+ * |
+ * @param apkFile Filename of the APK. |
+ * @param library The library's base name. |
+ * @return true if page aligned. |
+ */ |
+ private static native boolean nativeCheckLibraryAlignedInApk(String apkFile, String library); |
+ |
+ /** |
* Record information for a given library. |
* IMPORTANT: Native code knows about this class's fields, so |
* don't change them without modifying the corresponding C++ sources. |