Merge "Revert "Persist permission state for updated apps synchronously.""
This commit is contained in:
@@ -2626,7 +2626,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
final int[] userIds = filterUserId == UserHandle.USER_ALL ? getAllUserIds()
|
final int[] userIds = filterUserId == UserHandle.USER_ALL ? getAllUserIds()
|
||||||
: new int[] { filterUserId };
|
: new int[] { filterUserId };
|
||||||
|
|
||||||
boolean installPermissionsChanged = false;
|
|
||||||
boolean runtimePermissionsRevoked = false;
|
boolean runtimePermissionsRevoked = false;
|
||||||
int[] updatedUserIds = EMPTY_INT_ARRAY;
|
int[] updatedUserIds = EMPTY_INT_ARRAY;
|
||||||
|
|
||||||
@@ -2740,7 +2739,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
|
|
||||||
UidPermissionState origState = uidState;
|
UidPermissionState origState = uidState;
|
||||||
|
|
||||||
boolean installPermissionsChangedForUser = false;
|
boolean changedInstallPermission = false;
|
||||||
|
|
||||||
if (replace) {
|
if (replace) {
|
||||||
userState.setInstallPermissionsFixed(ps.name, false);
|
userState.setInstallPermissionsFixed(ps.name, false);
|
||||||
@@ -2905,7 +2904,7 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
&& origState.isPermissionGranted(permName))))) {
|
&& origState.isPermissionGranted(permName))))) {
|
||||||
// Grant an install permission.
|
// Grant an install permission.
|
||||||
if (uidState.grantPermission(bp)) {
|
if (uidState.grantPermission(bp)) {
|
||||||
installPermissionsChangedForUser = true;
|
changedInstallPermission = true;
|
||||||
}
|
}
|
||||||
} else if (bp.isRuntime()) {
|
} else if (bp.isRuntime()) {
|
||||||
boolean hardRestricted = bp.isHardRestricted();
|
boolean hardRestricted = bp.isHardRestricted();
|
||||||
@@ -3035,12 +3034,12 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uidState.removePermissionState(bp.getName())) {
|
if (uidState.removePermissionState(bp.getName())) {
|
||||||
installPermissionsChangedForUser = true;
|
changedInstallPermission = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((installPermissionsChangedForUser || replace)
|
if ((changedInstallPermission || replace)
|
||||||
&& !userState.areInstallPermissionsFixed(ps.name)
|
&& !userState.areInstallPermissionsFixed(ps.name)
|
||||||
&& !ps.isSystem() || ps.getPkgState().isUpdatedSystemApp()) {
|
&& !ps.isSystem() || ps.getPkgState().isUpdatedSystemApp()) {
|
||||||
// This is the first that we have heard about this package, so the
|
// This is the first that we have heard about this package, so the
|
||||||
@@ -3049,12 +3048,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
userState.setInstallPermissionsFixed(ps.name, true);
|
userState.setInstallPermissionsFixed(ps.name, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (installPermissionsChangedForUser) {
|
|
||||||
installPermissionsChanged = true;
|
|
||||||
if (replace) {
|
|
||||||
updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updatedUserIds = revokePermissionsNoLongerImplicitLocked(uidState,
|
updatedUserIds = revokePermissionsNoLongerImplicitLocked(uidState,
|
||||||
pkg.getPackageName(), uidImplicitPermissions, uidTargetSdkVersion, userId,
|
pkg.getPackageName(), uidImplicitPermissions, uidTargetSdkVersion, userId,
|
||||||
updatedUserIds);
|
updatedUserIds);
|
||||||
@@ -3071,12 +3064,8 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
// Persist the runtime permissions state for users with changes. If permissions
|
// Persist the runtime permissions state for users with changes. If permissions
|
||||||
// were revoked because no app in the shared user declares them we have to
|
// were revoked because no app in the shared user declares them we have to
|
||||||
// write synchronously to avoid losing runtime permissions state.
|
// write synchronously to avoid losing runtime permissions state.
|
||||||
// Also write synchronously if we changed any install permission for an updated app, because
|
|
||||||
// the install permission state is likely already fixed before update, and if we lose the
|
|
||||||
// changes here the app won't be reconsidered for newly-added install permissions.
|
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onPermissionUpdated(updatedUserIds,
|
callback.onPermissionUpdated(updatedUserIds, runtimePermissionsRevoked);
|
||||||
(replace && installPermissionsChanged) || runtimePermissionsRevoked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int userId : updatedUserIds) {
|
for (int userId : updatedUserIds) {
|
||||||
|
|||||||
Reference in New Issue
Block a user