| Index: content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| index 8883255ca4d10707c22872202df91b0a63e6659e..07f4835e51ded1221f637890ba496c4f7afad866 100644
|
| --- a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| +++ b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
|
| @@ -135,6 +135,11 @@ public class LibraryLoader {
|
| } catch (UnsatisfiedLinkError e) {
|
| throw new ProcessInitException(ResultCodes.RESULT_CODE_NATIVE_LIBRARY_LOAD_FAILED, e);
|
| }
|
| + // Check that the version of the library we have loaded matches the version we expect
|
| + if(! NativeLibraries.VersionName.equals(nativeGetVersionName()) ) {
|
| + throw new ProcessInitException(ResultCodes.RESULT_CODE_NATIVE_LIBRARY_WRONG_VERSION);
|
| + }
|
| +
|
| }
|
|
|
|
|
| @@ -157,13 +162,13 @@ public class LibraryLoader {
|
| TraceEvent.setEnabledToMatchNative();
|
| // Record histogram for the content linker.
|
| if (Linker.isUsed())
|
| - nativeRecordContentAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed(),
|
| + nativeRecordContentAndroidLinkerHistogram(Linker.loadAtFixedAddressFailed(),
|
| SysUtils.isLowEndDevice());
|
| }
|
|
|
| - // This is the only method that is registered during System.loadLibrary. We then call it
|
| - // to register everything else. This process is called "initialization".
|
| - // This method will be mapped (by generated code) to the LibraryLoaded
|
| + // Only methods needed before or during normal JNI registration are during System.OnLoad.
|
| + // nativeLibraryLoaded is then called to register everything else. This process is called
|
| + // "initialization". This method will be mapped (by generated code) to the LibraryLoaded
|
| // definition in content/app/android/library_loader_hooks.cc.
|
| //
|
| // Return 0 on success, otherwise return the error code from
|
| @@ -176,4 +181,8 @@ public class LibraryLoader {
|
| private static native void nativeRecordContentAndroidLinkerHistogram(
|
| boolean loadedAtFixedAddressFailed,
|
| boolean isLowMemoryDevice);
|
| +
|
| + // Get the version of the native library. This is needed so that we can check we
|
| + // have the right version before initializing the (rest of the) JNI.
|
| + private static native String nativeGetVersionName();
|
| }
|
|
|