Puts dispatchUserAdded inside Binder.withCleanCallingIdentity

dispatchUserAdded eventually calls handleIncomingUser. And it requires
callingUid to have INTERACT_ACROSS_USERS permission.
That was failing some tests for auto.
This CL makes sure that method is called with clean calling identity.

Bug: 232945806
Test: atest CtsMultiUserTestCases:android.multiuser.cts.UserManagerTest#testCreateUser_withNewUserRequest_shouldCreateUserWithCorrectProperties
Change-Id: I2d0984c5166dd650f81a3a72696cece8054da26a
This commit is contained in:
Yasin Kilicdere
2022-05-17 18:42:11 +01:00
parent 66642324cb
commit 6bd5c32a3e

View File

@@ -4209,8 +4209,8 @@ public class UserManagerService extends IUserManager.Stub {
updateUserIds();
Binder.withCleanCallingIdentity(() -> {
mPm.onNewUserCreated(preCreatedUser.id, /* convertedFromPreCreated= */ true);
dispatchUserAdded(preCreatedUser, token);
});
dispatchUserAdded(preCreatedUser, token);
return preCreatedUser;
}