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

Commit 5c153c51 authored by Gustav Sennton's avatar Gustav Sennton
Browse files

Disable fallback webview package before downgrading it.

Now that we support disabling packages before downgrading them we can
do this for the webview fallback mechanism to avoid disabling a fallback
asynchronously (downgrading a package is an asynchronous operation).

We also check that the package is an upgraded app before downgrading it,
to not try to downgrade it unnecessarily.

Bug: 27894939

Change-Id: I541c2fcfe8016e4bcc2d5afff6e393c81e2749a2
parent 3ed501c1
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -184,16 +184,19 @@ public class SystemImpl implements SystemInterface {

    @Override
    public void uninstallAndDisablePackageForAllUsers(Context context, String packageName) {
        context.getPackageManager().deletePackage(packageName,
                new IPackageDeleteObserver.Stub() {
        enablePackageForAllUsers(context, packageName, false);
        try {
            PackageManager pm = AppGlobals.getInitialApplication().getPackageManager();
            if (pm.getApplicationInfo(packageName, 0).isUpdatedSystemApp()) {
                pm.deletePackage(packageName, new IPackageDeleteObserver.Stub() {
                        public void packageDeleted(String packageName, int returnCode) {
                // Ignore returnCode since the deletion could fail, e.g. we might be trying
                // to delete a non-updated system-package (and we should still disable the
                // package)
                            enablePackageForAllUsers(context, packageName, false);
                        }
                    }, PackageManager.DELETE_SYSTEM_APP | PackageManager.DELETE_ALL_USERS);
            }
        } catch (NameNotFoundException e) {
        }
    }

    @Override
    public void enablePackageForAllUsers(Context context, String packageName, boolean enable) {