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
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 0ac5c6a..d6b962d 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1246,4 +1246,16 @@
&& (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);
+ }
}