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

Commit 0c098c47 authored by Ruslan Tkhakokhov's avatar Ruslan Tkhakokhov
Browse files

Don't check allowBackup in PackageManager

During restore at install, PackageManager checks the allowBackup flag for
the package to determine whether or not to request a restore by calling
BackupManager::restoreAtInstall().

The above check isn't needed because B&R code verifies package elibility
before running backup / restore anyway. Furthermore, this check breaks
device-to-device migrations where we ignore allowBackup flag:
PackageManager doesn't know if the data is restored to the device from
cloud or directrly transferred from another device.

Remove the check altogether since it's not needed as described above.

Bug: 160407842
Test: 1. atest PackageManagerServiceTest
      2. Manual: Run restore at install for packages with
      allowBackup=true/false and verify the flag is respected.
Change-Id: I6ca61869129f5fabd40c01cd314cbf0f15e1f7fc
parent d72af5ff
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -14541,13 +14541,11 @@ public class PackageManagerService extends IPackageManager.Stub
            Log.v(TAG, "restoreAndPostInstall userId=" + userId + " package=" + res.pkg);
        }
        // A restore should be performed at this point if (a) the install
        // succeeded, (b) the operation is not an update, and (c) the new
        // package has not opted out of backup participation.
        // A restore should be requested at this point if (a) the install
        // succeeded, (b) the operation is not an update.
        final boolean update = res.removedInfo != null
                && res.removedInfo.removedPackage != null;
        boolean allowBackup = res.pkg != null && res.pkg.isAllowBackup();
        boolean doRestore = !update && allowBackup;
        boolean doRestore = !update;
        // Set up the post-install work request bookkeeping.  This will be used
        // and cleaned up by the post-install event handling regardless of whether