Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63d3d8a4 authored by Marcin Kosiba's avatar Marcin Kosiba Committed by Ben Murdoch
Browse files

Cherry pick Append WebView assets to AssetManager when loading the WebView. DO NOT MERGE

This makes the code loading the WebView Java code from the .apk
also load the WebView assets into the current AssetManager.

Original BUG: 11505352
Original Change-Id: Ib6203f79b98805012ffa20b233037b7da221624c

Bug: 16723226
Change-Id: Ie7b0b22df9727c72debfb9ccfcd84c95bf41e039
parent 810c052d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.webkit;

import android.app.ActivityManagerInternal;
import android.app.Application;
import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -104,10 +105,13 @@ public final class WebViewFactory {
    }

    private static Class<WebViewFactoryProvider> getFactoryClass() throws ClassNotFoundException {
        Application initialApplication = AppGlobals.getInitialApplication();
        try {
            Context webViewContext = AppGlobals.getInitialApplication().createPackageContext(
            Context webViewContext = initialApplication.createPackageContext(
                    getWebViewPackageName(),
                    Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
            initialApplication.getAssets().addAssetPath(
                    webViewContext.getApplicationInfo().sourceDir);
            ClassLoader clazzLoader = webViewContext.getClassLoader();
            return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY, true,
                                                                 clazzLoader);