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

Commit 3fb13a1f authored by Nate Myren's avatar Nate Myren
Browse files

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
parent a53deec1
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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,