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

Commit 444280d2 authored by Gustav Sennton's avatar Gustav Sennton Committed by Android (Google) Code Review
Browse files

Merge "Fetch WebView package even if it is uninstalled for the current user."

parents 1db8ba1b b1e45cd0
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -295,15 +295,27 @@ public final class WebViewFactory {

            Application initialApplication = AppGlobals.getInitialApplication();
            Context webViewContext = null;
            Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "initialApplication.createPackageContext()");
            Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW, "PackageManager.getApplicationInfo()");
            try {
                // Construct a package context to load the Java code into the current app.
                // This is done as early as possible since by constructing a package context we
                // register the WebView package as a dependency for the current application so that
                // when the WebView package is updated this application will be killed.
                webViewContext = initialApplication.createPackageContext(
                        sPackageInfo.packageName,
                ApplicationInfo applicationInfo =
                    initialApplication.getPackageManager().getApplicationInfo(
                        sPackageInfo.packageName, PackageManager.GET_SHARED_LIBRARY_FILES
                        | PackageManager.MATCH_DEBUG_TRIAGED_MISSING
                        // make sure that we fetch the current provider even if its not installed
                        // for the current user
                        | PackageManager.MATCH_UNINSTALLED_PACKAGES);
                Trace.traceBegin(Trace.TRACE_TAG_WEBVIEW,
                        "initialApplication.createApplicationContext");
                try {
                    webViewContext = initialApplication.createApplicationContext(applicationInfo,
                            Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
                } finally {
                    Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW);
                }
            } catch (PackageManager.NameNotFoundException e) {
                throw new MissingWebViewPackageException(e);
            } finally {