Add support for visualizing secondary users.

This functionality adds the secondary users to the screen, but
currently does not populate the information for them. Once the
external stats query works, I will add a loader which will
populate this information.

This also does not cover work profiles. Support for that is
forthcoming.

Bug: 34715777, 34225103
Test: Settings Robotest
Change-Id: Ib9b692b214f5ce5d303dfd64516381443d4acebd
This commit is contained in:
Daniel Nishi
2017-01-19 16:32:41 -08:00
parent aba2c95ae0
commit dfed8a2acb
9 changed files with 390 additions and 8 deletions

View File

@@ -1246,4 +1246,16 @@ public final class Utils extends com.android.settingslib.Utils {
&& (Settings.Secure.getInt(context.getContentResolver(),
carrierDemoModeSetting, 0) == 1);
}
/**
* Returns if a given user is a profile of another user.
* @param user The user whose profiles will be checked.
* @param profile The (potential) profile.
* @return if the profile is actually a profile
*/
public static boolean isProfileOf(UserInfo user, UserInfo profile) {
return user.id == profile.id ||
(user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID
&& user.profileGroupId == profile.profileGroupId);
}
}