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

Commit 1b248143 authored by Svet Ganov's avatar Svet Ganov Committed by android-build-merger
Browse files

DO NOT MERGE: Propagate revoked permissions in permission review mode am: 4518d0be

am: 20cf769d

Change-Id: I9fb218768a53a5f60aa90d1be34a6abfb2e8367d
parents 3181ba52 20cf769d
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -10173,12 +10173,30 @@ public class PackageManagerService extends IPackageManager.Stub {
                            int flags = permissionState != null
                                    ? permissionState.getFlags() : 0;
                            if (origPermissions.hasRuntimePermission(bp.name, userId)) {
                                // Don't propagate the permission in a permission review mode if
                                // the former was revoked, i.e. marked to not propagate on upgrade.
                                // Note that in a permission review mode install permissions are
                                // represented as constantly granted runtime ones since we need to
                                // keep a per user state associated with the permission. Also the
                                // revoke on upgrade flag is no longer applicable and is reset.
                                final boolean revokeOnUpgrade = (flags & PackageManager
                                        .FLAG_PERMISSION_REVOKE_ON_UPGRADE) != 0;
                                if (revokeOnUpgrade) {
                                    flags &= ~PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRADE;
                                    // Since we changed the flags, we have to write.
                                    changedRuntimePermissionUserIds = ArrayUtils.appendInt(
                                            changedRuntimePermissionUserIds, userId);
                                }
                                if (!mPermissionReviewRequired || !revokeOnUpgrade) {
                                    if (permissionsState.grantRuntimePermission(bp, userId) ==
                                            PermissionsState.PERMISSION_OPERATION_FAILURE) {
                                    // If we cannot put the permission as it was, we have to write.
                                        // If we cannot put the permission as it was,
                                        // we have to write.
                                        changedRuntimePermissionUserIds = ArrayUtils.appendInt(
                                                changedRuntimePermissionUserIds, userId);
                                    }
                                }
                                // If the app supports runtime permissions no need for a review.
                                if ((mPermissionReviewRequired || Build.PERMISSIONS_REVIEW_REQUIRED)
                                        && appSupportsRuntimePermissions