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
This commit is contained in:
Torne (Richard Coles)
2019-05-28 16:02:19 -04:00
parent 1ac3f11205
commit d6c5a30ceb

View File

@@ -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) {