Disable multiuser toggle when more than 1 user is created
It makes more sense to have the toggle as on permanently as long as there are other users on the device. Otherwise if we toggle off "Allow multiple users", other users get hidden. Also with current behaviour the any admin can switch the toggle and this can block any other user, including main, from being able to use the device. Bug: 295183792 Test: atest MultiUserSwitchBarControllerTest && UserSettingsTest Change-Id: I8cb0671d780f45c17a9bb7c9a9d3b108128ead9d
This commit is contained in:
@@ -290,8 +290,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
} else {
|
||||
switchBar.hide();
|
||||
}
|
||||
boolean isToggleEnabled = mUserManager.getFullUserCount() == 1;
|
||||
mSwitchBarController = new MultiUserSwitchBarController(activity,
|
||||
new MainSwitchBarController(switchBar), this /* listener */);
|
||||
new MainSwitchBarController(switchBar), isToggleEnabled, this /* listener */);
|
||||
getSettingsLifecycle().addObserver(mSwitchBarController);
|
||||
boolean openUserEditDialog = getIntent().getBooleanExtra(
|
||||
EXTRA_OPEN_DIALOG_USER_PROFILE_EDITOR, false);
|
||||
@@ -422,6 +423,9 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
mRemoveGuestOnExitPreferenceController.getPreferenceKey()));
|
||||
if (mShouldUpdateUserList) {
|
||||
updateUI();
|
||||
// Update state of "Allow multiple users" toggle when list of users updates
|
||||
boolean isToggleEnabled = mUserManager.getFullUserCount() == 1;
|
||||
mSwitchBarController.setToggleEnabled(isToggleEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user