Move removeUserWithProfilesUnchecked outside of mPackagesLock.
In UserManagerService.removeUserWhenPossible we're first trying to remove the user immediately by calling removeUserWithProfilesUnchecked or otherwise marking it as ephemeral. In that flow if the user's type is a profile, we're calling sendProfileRemovedBroadcast inside removeUserUnchecked method. Which requires an ActivityManager lock and shouldn't be called while holding PackageManager lock, or it might cause a deadlock. This CL moves that call outside of mPackagesLock to prevent such a deadlock possibility. And also deduplicates the user removal validation logic into getUserRemovabilityLocked. Bug: 269077555 Test: atest com.android.server.pm.UserManagerTest Change-Id: I46a1675fe181892eac3fba6625ff49adb60441bb
Loading
Please register or sign in to comment