| Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| index 78bff6b0b11973400bc2477119534e395850d5de..78d1bdcabeb8e39be0ff8ac08e014620d0efb23a 100644
|
| --- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| +++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
|
| @@ -87,7 +87,6 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| private WebStorageAdapter mWebStorage;
|
| private WebViewDatabaseAdapter mWebViewDatabase;
|
| private AwDevToolsServer mDevToolsServer;
|
| - private Context mWrappedAppContext;
|
|
|
| private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart =
|
| new ArrayList<WeakReference<WebViewChromium>>();
|
| @@ -116,6 +115,11 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")
|
| private void initialize(WebViewDelegate webViewDelegate) {
|
| mWebViewDelegate = webViewDelegate;
|
| +
|
| + // WebView needs to make sure to always use the wrapped application context.
|
| + ContextUtils.initApplicationContext(
|
| + ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplication()));
|
| +
|
| if (isBuildDebuggable()) {
|
| // Suppress the StrictMode violation as this codepath is only hit on debugglable builds.
|
| StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
| @@ -127,7 +131,7 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
|
|
| ThreadUtils.setWillOverrideUiThread();
|
| // Load chromium library.
|
| - AwBrowserProcess.loadLibrary(getWrappedCurrentApplicationContext());
|
| + AwBrowserProcess.loadLibrary(ContextUtils.getApplicationContext());
|
|
|
| final PackageInfo packageInfo = WebViewFactory.getLoadedPackageInfo();
|
|
|
| @@ -264,7 +268,7 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| return;
|
| }
|
|
|
| - Context context = getWrappedCurrentApplicationContext();
|
| + Context context = ContextUtils.getApplicationContext();
|
| try {
|
| LibraryLoader.get(LibraryProcessType.PROCESS_WEBVIEW).ensureInitialized(context);
|
| } catch (ProcessInitException e) {
|
| @@ -322,14 +326,6 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| }
|
| }
|
|
|
| - private Context getWrappedCurrentApplicationContext() {
|
| - if (mWrappedAppContext == null) {
|
| - mWrappedAppContext = ResourcesContextWrapperFactory.get(
|
| - mWebViewDelegate.getApplication());
|
| - }
|
| - return mWrappedAppContext;
|
| - }
|
| -
|
| AwBrowserContext getBrowserContext() {
|
| synchronized (mLock) {
|
| return getBrowserContextLocked();
|
| @@ -341,7 +337,7 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| assert mStarted;
|
| if (mBrowserContext == null) {
|
| mBrowserContext =
|
| - new AwBrowserContext(mWebViewPrefs, getWrappedCurrentApplicationContext());
|
| + new AwBrowserContext(mWebViewPrefs, ContextUtils.getApplicationContext());
|
| }
|
| return mBrowserContext;
|
| }
|
| @@ -451,13 +447,6 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
|
| public CookieManager getCookieManager() {
|
| synchronized (mLock) {
|
| if (mCookieManager == null) {
|
| - if (!mStarted) {
|
| - // We can use CookieManager without starting Chromium; the native code
|
| - // will bring up just the parts it needs to make this work on a temporary
|
| - // basis until Chromium is started for real. The temporary cookie manager
|
| - // needs the application context to have been set.
|
| - ContextUtils.initApplicationContext(getWrappedCurrentApplicationContext());
|
| - }
|
| mCookieManager = new CookieManagerAdapter(new AwCookieManager());
|
| }
|
| }
|
|
|