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

Commit 9a944532 authored by Jason Monk's avatar Jason Monk
Browse files

Fix UserManagerService.setUserIcon throwing expt.

setUserIcon sends a broadcast that requires INTERACT_ACROSS_USERS.
Since the function directly checks MANAGE_USERS permission, added
a clear calling identity.

Alternative solution would be to make function check for one of
INTERACT_ACROSS_USERS permissions before performing any actions.

Change-Id: Ibbf27d4e188d059671024e4bb62f92a2daea3661
parent 4c8d3149
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -394,6 +394,8 @@ public class UserManagerService extends IUserManager.Stub {
    @Override
    public void setUserIcon(int userId, Bitmap bitmap) {
        checkManageUsersPermission("update users");
        long ident = Binder.clearCallingIdentity();
        try {
            synchronized (mPackagesLock) {
                UserInfo info = mUsers.get(userId);
                if (info == null || info.partial) {
@@ -404,6 +406,9 @@ public class UserManagerService extends IUserManager.Stub {
                writeUserLocked(info);
            }
            sendUserInfoChangedBroadcast(userId);
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
    }

    private void sendUserInfoChangedBroadcast(int userId) {