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

Commit 4b3a1f5f authored by Anton Philippov's avatar Anton Philippov
Browse files

Grant SharedStorageBackup storage access.

Shared storage backup had been relying on the WRITE_MEDIA_STORAGE permission to access
files on external storage, but that permission has been locked down,
and we need to use the real WRITE_EXTERNAL_STORAGE permission now.

Bug: 78938482
Test: build && boot && 'adb backup -shared' && 'adb restore backup.ab'
Test: make gts -j32 && gts-tradefed run gts -m GtsPermissionTestCases
Change-Id: Id244a1178936e8ffcccc7f95bcb120809a4b4607
parent eb43503f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -841,6 +841,14 @@ public final class DefaultPermissionGrantPolicy {
            }
        }

        // There is no real "marker" interface to identify the shared storage backup, it is
        // hardcoded in BackupManagerService.SHARED_BACKUP_AGENT_PACKAGE.
        PackageParser.Package sharedStorageBackupPackage = getSystemPackage(
                "com.android.sharedstoragebackup");
        if (sharedStorageBackupPackage != null) {
            grantRuntimePermissions(sharedStorageBackupPackage, STORAGE_PERMISSIONS, true, userId);
        }

        if (mPermissionGrantedCallback != null) {
            mPermissionGrantedCallback.onDefaultRuntimePermissionsGranted(userId);
        }