UserManagerService.hasManagedProfile fix

hasManagedProfile checks if it has a profile, not necessarily a managed
profile. There's no reason to limit the check specifically to managed
profiles though.

Test: none
Bug: 31000380
Bug: 170249807
Change-Id: Iba33528ecdddc5d5034ae6733241cbe1cfd4da7e
This commit is contained in:
Adam Bookatz
2022-02-16 12:06:16 -08:00
parent cafcc80f5e
commit 3f7d81ec4a
2 changed files with 4 additions and 4 deletions

View File

@@ -2812,8 +2812,8 @@ public class ComputerEngine implements Computer {
"MATCH_ANY_USER flag requires INTERACT_ACROSS_USERS permission");
} else if ((flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0
&& isCallerSystemUser
&& mUserManager.hasManagedProfile(UserHandle.USER_SYSTEM)) {
// If the caller wants all packages and has a restricted profile associated with it,
&& mUserManager.hasProfile(UserHandle.USER_SYSTEM)) {
// If the caller wants all packages and has a profile associated with it,
// then match all users. This is to make sure that launchers that need to access
//work
// profile apps don't start breaking. TODO: Remove this hack when launchers stop

View File

@@ -6263,11 +6263,11 @@ public class UserManagerService extends IUserManager.Stub {
}
/**
* Checks if the given user has a managed profile associated with it.
* Checks if the given user has a profile associated with it.
* @param userId The parent user
* @return
*/
boolean hasManagedProfile(@UserIdInt int userId) {
boolean hasProfile(@UserIdInt int userId) {
synchronized (mUsersLock) {
UserInfo userInfo = getUserInfoLU(userId);
final int userSize = mUsers.size();