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

Commit 92c87568 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Support bmgr wipe also for full backup apps

Previously we'd only really clear data for K/V packages,
now we consult with the journal of ever backed apps.

Bug: 28405555
Test: manual (adb shell bmgr wipe com.google.android.gms/.backup.BackupTransportService com.android.wallpaperbackup
      after adb shell bmgr backupnow --all)
Test: m -j RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Change-Id: If99cb2c8ab9ddc05386d634818f4585ec47efc00
parent add2d38c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2357,7 +2357,7 @@ public class BackupManagerService implements BackupManagerServiceInterface {

        // If the caller does not hold the BACKUP permission, it can only request a
        // wipe of its own backed-up data.
        HashSet<String> apps;
        Set<String> apps;
        if ((mContext.checkPermission(android.Manifest.permission.BACKUP, Binder.getCallingPid(),
                Binder.getCallingUid())) == PackageManager.PERMISSION_DENIED) {
            apps = mBackupParticipants.get(Binder.getCallingUid());
@@ -2365,10 +2365,9 @@ public class BackupManagerService implements BackupManagerServiceInterface {
            // a caller with full permission can ask to back up any participating app
            // !!! TODO: allow data-clear of ANY app?
            if (MORE_DEBUG) Slog.v(TAG, "Privileged caller, allowing clear of other apps");
            apps = SparseArrayUtils.union(mBackupParticipants);
            apps = mProcessedPackagesJournal.getPackagesCopy();
        }

        // Is the given app an available participant?
        if (apps.contains(packageName)) {
            // found it; fire off the clear request
            if (MORE_DEBUG) Slog.v(TAG, "Found the app - running clear process");