Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 851bf187 authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Android (Google) Code Review
Browse files

Merge "Control user switching UI visibility according to config" into main

parents 51c3cb49 472e4156
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ public class UserCapabilities {
    boolean mIsAdmin;
    boolean mIsGuest;
    boolean mIsEphemeral;
    boolean mUserSwitchingUiEnabled;
    boolean mUserSwitcherEnabled;
    boolean mCanAddGuest;
    boolean mDisallowAddUser;
@@ -68,7 +69,8 @@ public class UserCapabilities {
        caps.mCanAddRestrictedProfile =
                offerRestricted && !dpm.isDeviceManaged() && userManager.isUserTypeEnabled(
                        UserManager.USER_TYPE_FULL_RESTRICTED);

        caps.mUserSwitchingUiEnabled = context.getResources().getBoolean(
                com.android.internal.R.bool.config_allowChangeUserSwitcherEnabled);
        caps.updateAddUserCapabilities(context);
        return caps;
    }
@@ -134,6 +136,7 @@ public class UserCapabilities {
                ", mEnforcedAdmin=" + mEnforcedAdmin +
                ", mDisallowSwitchUser=" + mDisallowSwitchUser +
                ", mDisallowAddUserSetByAdmin=" + mDisallowAddUserSetByAdmin +
                ", mUserSwitchingUiEnabled=" + mUserSwitchingUiEnabled +
                ", mUserSwitcherEnabled=" + mUserSwitcherEnabled +
                '}';
    }
+2 −0
Original line number Diff line number Diff line
@@ -354,6 +354,8 @@ public class UserDetailsSettings extends SettingsPreferenceFragment

        mGrantAdminPref.setChecked(mUserInfo.isAdmin());

        mSwitchUserPref.setVisible(mUserCaps.mUserSwitchingUiEnabled);

        mSwitchUserPref.setTitle(
                context.getString(com.android.settingslib.R.string.user_switch_to_user,
                        mUserInfo.name));
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ public class UserSettings extends SettingsPreferenceFragment
        final SettingsActivity activity = (SettingsActivity) getActivity();
        final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
        switchBar.setTitle(getContext().getString(R.string.multiple_users_main_switch_title));
        if (!mUserCaps.mIsGuest) {
        if (!mUserCaps.mIsGuest && mUserCaps.mUserSwitchingUiEnabled) {
            switchBar.show();
        } else {
            switchBar.hide();