Add Work Challenge Notifications Setting
Bug: 26844582 Change-Id: Ib1eb28cfebcc0c8d23ec8669f2777ccb822d7bf3
This commit is contained in:
@@ -595,6 +595,23 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return isManagedProfile(userManager, UserHandle.myUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the id for the given user's managed profile.
|
||||
*
|
||||
* @return the managed profile id or UserHandle.USER_NULL if there is none.
|
||||
*/
|
||||
public static int getManagedProfileId(UserManager um, int parentUserId) {
|
||||
List<UserInfo> profiles = um.getProfiles(parentUserId);
|
||||
int numProfiles = profiles.size();
|
||||
for (int i = 0; i < numProfiles; ++i) {
|
||||
UserInfo profile = profiles.get(i);
|
||||
if (profile.id != parentUserId) {
|
||||
return profile.id;
|
||||
}
|
||||
}
|
||||
return UserHandle.USER_NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the userId passed in is a managed profile.
|
||||
*
|
||||
|
Reference in New Issue
Block a user