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

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

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
parent 61139356
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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");
            // 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);
        }
    }