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

Commit d6c5a30c authored by Torne (Richard Coles)'s avatar Torne (Richard Coles)
Browse files

Always re-enable the fallback WebView if needed.

If there's no valid WebView implementation at boot time, attempt to
re-enable the fallback package, even if we already did the one-time
migration from an earlier OS version.

This may help to ensure devices don't end up with no WebView if
something went wrong with the migration.

Bug: 132815849
Test: manual
Change-Id: I9c9cf634ea0de9b52a27d4c1100d95fad6047b05
parent 1ac3f112
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -82,6 +82,22 @@ public class WebViewUpdateServiceImpl {
    void prepareWebViewInSystemServer() {
        migrateFallbackStateOnBoot();
        mWebViewUpdater.prepareWebViewInSystemServer();
        if (getCurrentWebViewPackage() == null) {
            // We didn't find a valid WebView implementation. Try explicitly re-enabling the
            // fallback package for all users in case it was disabled, even if we already did the
            // one-time migration before. If this actually changes the state, WebViewUpdater will
            // see the PackageManager broadcast shortly and try again.
            WebViewProviderInfo[] webviewProviders = mSystemInterface.getWebViewPackages();
            WebViewProviderInfo fallbackProvider = getFallbackProvider(webviewProviders);
            if (fallbackProvider != null) {
                Slog.w(TAG, "No valid provider, trying to enable " + fallbackProvider.packageName);
                mSystemInterface.enablePackageForAllUsers(mContext, fallbackProvider.packageName,
                                                          true);
            } else {
                Slog.e(TAG, "No valid provider and no fallback available.");
            }
        }

        boolean multiProcessEnabled = isMultiProcessEnabled();
        mSystemInterface.notifyZygote(multiProcessEnabled);
        if (multiProcessEnabled) {