Merge cherrypicks of ['googleplex-android-review.googlesource.com/25642236'] into 24Q1-release.
Change-Id: I37c1ed6d566efe3104b342f22a5ff52c9e459efc
diff --git a/src/com/android/settings/users/MultiUserSwitchBarController.java b/src/com/android/settings/users/MultiUserSwitchBarController.java
index 238e86e..33651c3 100644
--- a/src/com/android/settings/users/MultiUserSwitchBarController.java
+++ b/src/com/android/settings/users/MultiUserSwitchBarController.java
@@ -57,10 +57,11 @@
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
.checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_USER_SWITCH,
UserHandle.myUserId()));
+
} else if (mUserCapabilities.mDisallowAddUser) {
- onSwitchToggled(false);
mSwitchBar.setDisabledByAdmin(RestrictedLockUtilsInternal
- .checkIfAddUserDisallowed(mContext, UserHandle.myUserId()));
+ .checkIfRestrictionEnforced(mContext, UserManager.DISALLOW_ADD_USER,
+ UserHandle.myUserId()));
} else {
mSwitchBar.setEnabled(!mUserCapabilities.mDisallowSwitchUser
&& !mUserCapabilities.mIsGuest && mUserCapabilities.isAdmin());