diff --git a/src/com/android/settings/deviceinfo/storage/NonCurrentUserController.java b/src/com/android/settings/deviceinfo/storage/NonCurrentUserController.java index fe7fa7c5d71..b631e353ba5 100644 --- a/src/com/android/settings/deviceinfo/storage/NonCurrentUserController.java +++ b/src/com/android/settings/deviceinfo/storage/NonCurrentUserController.java @@ -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 getNonCurrentUserControllers( Context context, UserManager userManager) { @@ -73,7 +73,7 @@ public class NonCurrentUserController extends AbstractPreferenceController imple List controllers = new ArrayList<>(); List 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 diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/NonCurrentUserControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/NonCurrentUserControllerTest.java index 684128c436f..61d3bed91c7 100644 --- a/tests/robotests/src/com/android/settings/deviceinfo/storage/NonCurrentUserControllerTest.java +++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/NonCurrentUserControllerTest.java @@ -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);