Disable toggle on managed device with "Disallow add user" or "Disallow switch user"
Bug: 244279615 Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.MultiUserSwitchBarControllerTest" Change-Id: I3e89c8fac1828b4c9bb1c7df08687684981bda11
This commit is contained in:
@@ -57,6 +57,11 @@ public class MultiUserSwitchBarController implements SwitchWidgetController.OnSw
|
||||
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
|
||||
.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_USER_SWITCH,
|
||||
UserHandle.myUserId()));
|
||||
|
||||
} else if (mUserCapabilities.mDisallowAddUser) {
|
||||
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
|
||||
.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER,
|
||||
UserHandle.myUserId()));
|
||||
} else {
|
||||
mSwitchBar.setEnabled(!mUserCapabilities.mDisallowSwitchUser
|
||||
&& !mUserCapabilities.mIsGuest && mUserCapabilities.isAdmin());
|
||||
|
Reference in New Issue
Block a user