Add handling of admin enforced restrictions in Users Settings

Before, when the restrictions were applied, the preferences that were restricted were hidden.

After this change, if admin applies a restriction, the preference is displayed as disabled and Policy Transparency Dialog is displayed

Bug: 338226475
Test: atest UserSettingsTest && atest UserDetailsSettingsTest
Flag: android.multiuser.new_multiuser_settings_ux
Change-Id: I1b5aeeeec7accde278ff3e46ea3d64c91d8400db
This commit is contained in:
Tetiana Meronyk
2024-06-18 18:10:25 +00:00
parent caef61b5eb
commit 0f311e1195
6 changed files with 95 additions and 40 deletions

View File

@@ -57,11 +57,6 @@ 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.mIsMain);
}