Merge "Remove system user from displaying in Storage Settings in HSUM"

This commit is contained in:
Tetiana Meronyk
2022-11-30 12:51:22 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 6 deletions

View File

@@ -64,8 +64,8 @@ public class NonCurrentUserController extends AbstractPreferenceController imple
* Adds the appropriate controllers to a controller list for handling all full non current
* users on a device.
*
* @param context Context for initializing the preference controllers.
* @param userManager UserManagerWrapper for figuring out which controllers to add.
* @param context Context for initializing the preference controllers.
* @param userManager UserManagerWrapper for figuring out which controllers to add.
*/
public static List<NonCurrentUserController> getNonCurrentUserControllers(
Context context, UserManager userManager) {
@@ -73,7 +73,7 @@ public class NonCurrentUserController extends AbstractPreferenceController imple
List<NonCurrentUserController> controllers = new ArrayList<>();
List<UserInfo> infos = userManager.getUsers();
for (UserInfo info : infos) {
if (info.id == currentUserId || info.isProfile()) {
if (info.id == currentUserId || !info.isFull()) {
continue;
}
int[] profiles = userManager.getProfileIds(info.id, false /* enabledOnly */);
@@ -85,8 +85,8 @@ public class NonCurrentUserController extends AbstractPreferenceController imple
/**
* Constructor for a given non-current user.
*
* @param context Context to initialize the underlying {@link AbstractPreferenceController}.
* @param info {@link UserInfo} for the non-current user which these controllers cover.
* @param context Context to initialize the underlying {@link AbstractPreferenceController}.
* @param info {@link UserInfo} for the non-current user which these controllers cover.
* @param profiles list of IDs or user and its profiles
*/
@VisibleForTesting

View File

@@ -80,7 +80,7 @@ public class NonCurrentUserControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPrimaryUser = new UserInfo();
mPrimaryUser.flags = UserInfo.FLAG_PRIMARY;
mPrimaryUser.flags = UserInfo.FLAG_PRIMARY | UserInfo.FLAG_FULL;
mController = new NonCurrentUserController(mContext, mPrimaryUser);
ShadowActivityManager.setService(mActivityService);
@@ -267,6 +267,8 @@ public class NonCurrentUserControllerTest {
secondaryUser.id = 10;
final UserInfo secondaryUser1 = spy(new UserInfo());
secondaryUser1.id = 11;
secondaryUser.flags = UserInfo.FLAG_FULL;
secondaryUser1.flags = UserInfo.FLAG_FULL;
userInfo.add(mPrimaryUser);
userInfo.add(secondaryUser);
userInfo.add(secondaryUser1);