From beec08679b7e0cfc10f1ef57072716b17ce417c3 Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Wed, 21 Jun 2017 17:51:27 +0100 Subject: Use classloader namespace instead of lib paths to load WebView libs. When loading WebView's native libraries we now have a classloader pointing to the namespace of thise libraries - so we no longer need to explicitly reference those libraries by their path names. Bug: 62860565 Test: Start a WebView-using app. Ensure that libwebviewchromium.so is loaded into the app process. Change-Id: I205131f4b5fac7c33374560515b85ddef19a7ce9 --- core/java/android/webkit/WebViewLibraryLoader.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'core/java/android/webkit/WebViewLibraryLoader.java') diff --git a/core/java/android/webkit/WebViewLibraryLoader.java b/core/java/android/webkit/WebViewLibraryLoader.java index e385a4832a0c..6f9e8ece4b13 100644 --- a/core/java/android/webkit/WebViewLibraryLoader.java +++ b/core/java/android/webkit/WebViewLibraryLoader.java @@ -215,12 +215,10 @@ class WebViewLibraryLoader { return WebViewFactory.LIBLOAD_ADDRESS_SPACE_NOT_RESERVED; } - String[] args = getWebViewNativeLibraryPaths(packageInfo); - int result = nativeLoadWithRelroFile(args[0] /* path32 */, - args[1] /* path64 */, - CHROMIUM_WEBVIEW_NATIVE_RELRO_32, - CHROMIUM_WEBVIEW_NATIVE_RELRO_64, - clazzLoader); + final String libraryFileName = + WebViewFactory.getWebViewLibrary(packageInfo.applicationInfo); + int result = nativeLoadWithRelroFile(libraryFileName, CHROMIUM_WEBVIEW_NATIVE_RELRO_32, + CHROMIUM_WEBVIEW_NATIVE_RELRO_64, clazzLoader); if (result != WebViewFactory.LIBLOAD_SUCCESS) { Log.w(LOGTAG, "failed to load with relro file, proceeding without"); } else if (DEBUG) { @@ -317,7 +315,6 @@ class WebViewLibraryLoader { static native boolean nativeReserveAddressSpace(long addressSpaceToReserve); static native boolean nativeCreateRelroFile(String lib32, String lib64, String relro32, String relro64); - static native int nativeLoadWithRelroFile(String lib32, String lib64, - String relro32, String relro64, + static native int nativeLoadWithRelroFile(String lib, String relro32, String relro64, ClassLoader clazzLoader); } -- cgit v1.2.3