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

Commit 6dc4e652 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pre-grant permissions split from install permissions"

parents d76793e2 c1537dc7
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -1242,6 +1242,9 @@ public class PermissionManagerService {
                        && ps.getRuntimePermissionState(sourcePerm, userId).isGranted()) {
                    isGranted = true;
                    break;
                } else if (ps.hasInstallPermission(sourcePerm)) {
                    isGranted = true;
                    break;
                }
            }

@@ -1348,8 +1351,18 @@ public class PermissionManagerService {
                                }
                            }
                        } else {
                            if (!origPs.hasRequestedPermission(sourcePerms)) {
                                // Both permissions are new, do nothing
                            boolean inheritsFromInstallPerm = false;
                            for (int sourcePermNum = 0; sourcePermNum < sourcePerms.size();
                                    sourcePermNum++) {
                                if (ps.hasInstallPermission(sourcePerms.valueAt(sourcePermNum))) {
                                    inheritsFromInstallPerm = true;
                                    break;
                                }
                            }

                            if (!origPs.hasRequestedPermission(sourcePerms)
                                    && !inheritsFromInstallPerm) {
                                // Both permissions are new so nothing to inherit.
                                if (DEBUG_PERMISSIONS) {
                                    Slog.i(TAG, newPerm + " does not inherit from " + sourcePerms
                                            + " for " + pkgName
@@ -1358,6 +1371,7 @@ public class PermissionManagerService {

                                break;
                            } else {
                                // Inherit from new install or existing runtime permissions
                                inheritPermissionStateToNewImplicitPermissionLocked(sourcePerms,
                                        newPerm, ps, pkg, userId);
                            }