Merge "Remove system user from displaying in Storage Settings in HSUM"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7eadcb9b20
@@ -64,8 +64,8 @@ public class NonCurrentUserController extends AbstractPreferenceController imple
|
|||||||
* Adds the appropriate controllers to a controller list for handling all full non current
|
* Adds the appropriate controllers to a controller list for handling all full non current
|
||||||
* users on a device.
|
* users on a device.
|
||||||
*
|
*
|
||||||
* @param context Context for initializing the preference controllers.
|
* @param context Context for initializing the preference controllers.
|
||||||
* @param userManager UserManagerWrapper for figuring out which controllers to add.
|
* @param userManager UserManagerWrapper for figuring out which controllers to add.
|
||||||
*/
|
*/
|
||||||
public static List<NonCurrentUserController> getNonCurrentUserControllers(
|
public static List<NonCurrentUserController> getNonCurrentUserControllers(
|
||||||
Context context, UserManager userManager) {
|
Context context, UserManager userManager) {
|
||||||
@@ -73,7 +73,7 @@ public class NonCurrentUserController extends AbstractPreferenceController imple
|
|||||||
List<NonCurrentUserController> controllers = new ArrayList<>();
|
List<NonCurrentUserController> controllers = new ArrayList<>();
|
||||||
List<UserInfo> infos = userManager.getUsers();
|
List<UserInfo> infos = userManager.getUsers();
|
||||||
for (UserInfo info : infos) {
|
for (UserInfo info : infos) {
|
||||||
if (info.id == currentUserId || info.isProfile()) {
|
if (info.id == currentUserId || !info.isFull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int[] profiles = userManager.getProfileIds(info.id, false /* enabledOnly */);
|
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.
|
* Constructor for a given non-current user.
|
||||||
*
|
*
|
||||||
* @param context Context to initialize the underlying {@link AbstractPreferenceController}.
|
* @param context Context to initialize the underlying {@link AbstractPreferenceController}.
|
||||||
* @param info {@link UserInfo} for the non-current user which these controllers cover.
|
* @param info {@link UserInfo} for the non-current user which these controllers cover.
|
||||||
* @param profiles list of IDs or user and its profiles
|
* @param profiles list of IDs or user and its profiles
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@@ -80,7 +80,7 @@ public class NonCurrentUserControllerTest {
|
|||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mPrimaryUser = new UserInfo();
|
mPrimaryUser = new UserInfo();
|
||||||
mPrimaryUser.flags = UserInfo.FLAG_PRIMARY;
|
mPrimaryUser.flags = UserInfo.FLAG_PRIMARY | UserInfo.FLAG_FULL;
|
||||||
mController = new NonCurrentUserController(mContext, mPrimaryUser);
|
mController = new NonCurrentUserController(mContext, mPrimaryUser);
|
||||||
ShadowActivityManager.setService(mActivityService);
|
ShadowActivityManager.setService(mActivityService);
|
||||||
|
|
||||||
@@ -267,6 +267,8 @@ public class NonCurrentUserControllerTest {
|
|||||||
secondaryUser.id = 10;
|
secondaryUser.id = 10;
|
||||||
final UserInfo secondaryUser1 = spy(new UserInfo());
|
final UserInfo secondaryUser1 = spy(new UserInfo());
|
||||||
secondaryUser1.id = 11;
|
secondaryUser1.id = 11;
|
||||||
|
secondaryUser.flags = UserInfo.FLAG_FULL;
|
||||||
|
secondaryUser1.flags = UserInfo.FLAG_FULL;
|
||||||
userInfo.add(mPrimaryUser);
|
userInfo.add(mPrimaryUser);
|
||||||
userInfo.add(secondaryUser);
|
userInfo.add(secondaryUser);
|
||||||
userInfo.add(secondaryUser1);
|
userInfo.add(secondaryUser1);
|
||||||
|
Reference in New Issue
Block a user