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

@@ -228,7 +228,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
// Add current user and its profiles first
for (int userIndex = 0; userIndex < userCount; ++userIndex) {
final UserInfo userInfo = allUsers.get(userIndex);
if (isProfileOf(mCurrentUser, userInfo)) {
if (Utils.isProfileOf(mCurrentUser, userInfo)) {
final PreferenceGroup details = showHeaders ?
addCategory(screen, userInfo.name) : screen;
addDetailItems(details, showShared, userInfo.id);
@@ -242,7 +242,7 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
getText(R.string.storage_other_users));
for (int userIndex = 0; userIndex < userCount; ++userIndex) {
final UserInfo userInfo = allUsers.get(userIndex);
if (!isProfileOf(mCurrentUser, userInfo)) {
if (!Utils.isProfileOf(mCurrentUser, userInfo)) {
addItem(otherUsers, /* titleRes */ 0, userInfo.name, userInfo.id);
}
}
@@ -649,12 +649,6 @@ public class PrivateVolumeSettings extends SettingsPreferenceFragment {
pref.setStorageSize(size, mTotalSize);
}
private boolean isProfileOf(UserInfo user, UserInfo profile) {
return user.id == profile.id ||
(user.profileGroupId != UserInfo.NO_PROFILE_GROUP_ID
&& user.profileGroupId == profile.profileGroupId);
}
private static long totalValues(MeasurementDetails details, int userId, String... keys) {
long total = 0;
HashMap<String, Long> map = details.mediaSize.get(userId);