Don't let failures to load the null WebView propagate.
We load the null WebView if the real WebView package is not available to support devices that aren't intended to have a WebView, but this results in confusing log messages if the real WebView is supposed to be present but is broken/unloadable for some reason. Since the null WebView is in the system classpath on devices that should use it, swallow any failures to load it on the assumption that this is actually just a failure of the real WebView to be loaded. Change-Id: I15820da3517daffde6169343c648a4486c0309d7
This commit is contained in:
@@ -118,8 +118,17 @@ public final class WebViewFactory {
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(CHROMIUM_WEBVIEW_FACTORY, true,
|
||||
clazzLoader);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e(LOGTAG, "Chromium WebView package does not exist");
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(NULL_WEBVIEW_FACTORY);
|
||||
// If the package doesn't exist, then try loading the null WebView instead.
|
||||
// If that succeeds, then this is a device without WebView support; if it fails then
|
||||
// swallow the failure, complain that the real WebView is missing and rethrow the
|
||||
// original exception.
|
||||
try {
|
||||
return (Class<WebViewFactoryProvider>) Class.forName(NULL_WEBVIEW_FACTORY);
|
||||
} catch (ClassNotFoundException e2) {
|
||||
// Ignore.
|
||||
}
|
||||
Log.e(LOGTAG, "Chromium WebView package does not exist", e);
|
||||
throw new AndroidRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user