Send correct UID on perm flag update

Ensure that the correct per-user UID (not the appId) is used when
notifying permission change listeners of a permission flag update.

Fixes: 145945426

Test: In a secondary user, navigate to the permission groups page of a
pre-M application, and grant or revoke a permission. The permission UI
should update upon backing out of the App Permission Screen.

Change-Id: If540a5e87f915a7cc6aa400b33aa178c2e30f5b9
This commit is contained in:
Nate Myren
2019-12-11 12:30:39 -08:00
parent a53deec1fc
commit 3fb13a1f82

View File

@@ -321,7 +321,10 @@ public class PermissionManagerService extends IPermissionManager.Stub {
public void onPermissionUpdatedNotifyListener(@UserIdInt int[] updatedUserIds, boolean sync,
int uid) {
onPermissionUpdated(updatedUserIds, sync);
mOnPermissionChangeListeners.onPermissionsChanged(uid);
for (int i = 0; i < updatedUserIds.length; i++) {
int userUid = UserHandle.getUid(updatedUserIds[i], UserHandle.getAppId(uid));
mOnPermissionChangeListeners.onPermissionsChanged(userUid);
}
}
public void onInstallPermissionUpdatedNotifyListener(int uid) {
onInstallPermissionUpdated();
@@ -733,7 +736,8 @@ public class PermissionManagerService extends IPermissionManager.Stub {
// Install and runtime permissions are stored in different places,
// so figure out what permission changed and persist the change.
if (permissionsState.getInstallPermissionState(permName) != null) {
callback.onInstallPermissionUpdatedNotifyListener(pkg.getUid());
int userUid = UserHandle.getUid(userId, UserHandle.getAppId(pkg.getUid()));
callback.onInstallPermissionUpdatedNotifyListener(userUid);
} else if (permissionsState.getRuntimePermissionState(permName, userId) != null
|| hadState) {
callback.onPermissionUpdatedNotifyListener(new int[]{userId}, false,