Add Work Challenge Notifications Setting

Bug: 26844582
Change-Id: Ib1eb28cfebcc0c8d23ec8669f2777ccb822d7bf3
This commit is contained in:
Clara Bayarri
2016-02-18 12:09:21 +00:00
parent eb8962d273
commit 462cce1a4c
6 changed files with 174 additions and 30 deletions

View File

@@ -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.
*