Improve handling of devices without a WebView.
Use the presence of FEATURE_WEBVIEW to determine whether a device is intended to have a WebView implementation or not, instead of trying to fall back to NullWebViewFactoryProvider after loading WebView fails. This removes the need for nullwebview entirely, and eliminates a class of possible bug where unexpected exceptions during loading cause the fallback mechanism not to work reliably. On devices which don't have the feature, don't start WebViewUpdateService at all. Guard all the places which try to access the service to return reasonable (empty/null) results when this is the case, instead of throwing exceptions. Change-Id: I839adaaf0abee28f4989e3fbc0c49c0732d0ec1c Bug: 31849211 Fixes: 28529980 Test: on wear and non-wear, cts-tradefed run cts -m CtsWebkitTestCases
This commit is contained in:
@@ -668,9 +668,11 @@ public final class SystemServer {
|
||||
traceEnd();
|
||||
|
||||
// Tracks whether the updatable WebView is in a ready state and watches for update installs.
|
||||
traceBeginAndSlog("StartWebViewUpdateService");
|
||||
mWebViewUpdateService = mSystemServiceManager.startService(WebViewUpdateService.class);
|
||||
traceEnd();
|
||||
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_WEBVIEW)) {
|
||||
traceBeginAndSlog("StartWebViewUpdateService");
|
||||
mWebViewUpdateService = mSystemServiceManager.startService(WebViewUpdateService.class);
|
||||
traceEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1687,10 +1689,10 @@ public final class SystemServer {
|
||||
traceEnd();
|
||||
|
||||
// No dependency on Webview preparation in system server. But this should
|
||||
// be completed before allowring 3rd party
|
||||
// be completed before allowing 3rd party
|
||||
final String WEBVIEW_PREPARATION = "WebViewFactoryPreparation";
|
||||
Future<?> webviewPrep = null;
|
||||
if (!mOnlyCore) {
|
||||
if (!mOnlyCore && mWebViewUpdateService != null) {
|
||||
webviewPrep = SystemServerInitThreadPool.get().submit(() -> {
|
||||
Slog.i(TAG, WEBVIEW_PREPARATION);
|
||||
TimingsTraceLog traceLog = new TimingsTraceLog(
|
||||
|
||||
Reference in New Issue
Block a user