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

Commit 3098cf2e authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Trigger WebView relro creation when new provider package installed.

Previously, the switching of WebView providers was only triggered when a
WebView provider package was replaced. The new channels (e.g. Dev/Beta)
do not exist in the system image which means that we might install a
new WebView provider package without having to replace an existing one
(which before this change meant we didn't trigger the WebView updating
service).

Change-Id: I0933cb5cfc05c64dd950e0b405ede918c2791798
parent a76bafdc
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -54,6 +54,15 @@ public class WebViewUpdateService extends SystemService {
                @Override
                public void onReceive(Context context, Intent intent) {

                    // When a package is replaced we will receive two intents, one representing the
                    // removal of the old package and one representing the addition of the new
                    // package. We here ignore the intent representing the removed package to make
                    // sure we don't change WebView provider twice.
                    if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED)
                            && intent.getExtras().getBoolean(Intent.EXTRA_REPLACING)) {
                        return;
                    }

                    for (String packageName : WebViewFactory.getWebViewPackageNames()) {
                        String webviewPackage = "package:" + packageName;

@@ -73,7 +82,8 @@ public class WebViewUpdateService extends SystemService {
                }
        };
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
        filter.addAction(Intent.ACTION_PACKAGE_ADDED);
        filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        filter.addDataScheme("package");
        getContext().registerReceiver(mWebViewUpdatedReceiver, filter);