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

Commit 1b861af0 authored by Hai Zhang's avatar Hai Zhang Committed by Android (Google) Code Review
Browse files

Merge "Fix install permission fixed handling."

parents 5c0c83f8 78d80b3c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5497,6 +5497,12 @@ public final class Settings implements Watchable, Snappable {
                    List<RuntimePermissionsState.PermissionState> permissions =
                            getPermissionsFromPermissionsState(
                                    packageSetting.getLegacyPermissionState(), userId);
                    if (permissions.isEmpty() && !packageSetting.areInstallPermissionsFixed()) {
                        // Storing an empty state means the package is known to the system and its
                        // install permissions have been granted and fixed. If this is not the case,
                        // we should not store anything.
                        continue;
                    }
                    packagePermissions.put(packageName, permissions);
                }
            }
+4 −2
Original line number Diff line number Diff line
@@ -4547,13 +4547,15 @@ public class PermissionManagerService extends IPermissionManager.Stub {
        return userState.getUidState(appId);
    }

    private void removeUidState(@AppIdInt int appId, @UserIdInt int userId) {
    private void removeUidStateAndResetPackageInstallPermissionsFixed(@AppIdInt int appId,
            @NonNull String packageName, @UserIdInt int userId) {
        synchronized (mLock) {
            final UserPermissionState userState = mState.getUserState(userId);
            if (userState == null) {
                return;
            }
            userState.removeUidState(appId);
            userState.setInstallPermissionsFixed(packageName, false);
        }
    }

@@ -4828,7 +4830,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
        }
        updatePermissions(packageName, null);
        if (sharedUserPkgs.isEmpty()) {
            removeUidState(appId, userId);
            removeUidStateAndResetPackageInstallPermissionsFixed(appId, packageName, userId);
        } else {
            // Remove permissions associated with package. Since runtime
            // permissions are per user we have to kill the removed package