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

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

Log the version of the WebView package used.

To aid in debugging app behaviour when WebView updates may be present,
log the package name, version name, and version code of the WebView
package when we are about to load it into an application. Do this before
we actually load any part of the package in case of an issue loading it
in the first place.

Change-Id: Id653bad431760b7ead8e3f8eb29f9d6a8bb68d07
parent 6aae6528
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.Application;
import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Process;
@@ -109,8 +110,14 @@ public final class WebViewFactory {
    private static Class<WebViewFactoryProvider> getFactoryClass() throws ClassNotFoundException {
        Application initialApplication = AppGlobals.getInitialApplication();
        try {
            Context webViewContext = initialApplication.createPackageContext(
                    getWebViewPackageName(),
            // First fetch the package info so we can log the webview package version.
            String packageName = getWebViewPackageName();
            PackageInfo pi = initialApplication.getPackageManager().getPackageInfo(packageName, 0);
            Log.i(LOGTAG, "Loading " + packageName + " version " + pi.versionName +
                          " (code " + pi.versionCode + ")");

            // Construct a package context to load the Java code into the current app.
            Context webViewContext = initialApplication.createPackageContext(packageName,
                    Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
            initialApplication.getAssets().addAssetPath(
                    webViewContext.getApplicationInfo().sourceDir);