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

Commit 21c8dc25 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Correctly backup granted state for pre-M apps

Pre-M apps always have the permission granted. The revocation state is
stored inside of the app-op matching the permission.

Hence we have to take the app-op into account when backing up the
permission. Please note that if the permission still requires review,
the permission state is irrelevant as it will always be overridden
during review.

The restore path already calls group.grantRuntimePermissions which
handles the app-ops correctly.

Test: Built
Change-Id: Ic151c61839292ca88f71bf54b23ccd6ff20f3c69
parent 6f08e5d5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -413,8 +413,9 @@ public class BackupHelper {
            boolean permissionWasReviewed =
                    !appSupportsRuntimePermissions && !perm.isReviewRequired();

            if (perm.isGranted() || perm.isUserSet() || perm.isUserFixed() || permissionWasReviewed) {
                return new BackupPermissionState(perm.getName(), perm.isGranted(),
            if (perm.isGrantedIncludingAppOp() || perm.isUserSet() || perm.isUserFixed()
                    || permissionWasReviewed) {
                return new BackupPermissionState(perm.getName(), perm.isGrantedIncludingAppOp(),
                        perm.isUserSet(), perm.isUserFixed(), permissionWasReviewed);
            } else {
                return null;