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

Commit 38a84918 authored by Denis Kuznetsov's avatar Denis Kuznetsov
Browse files

Add configuration parameters to control user switcher behavior

Adds two new configuration parameters. One is used to control
automatic enabling of user switcher setting upon user creation,
and second one controls if users (e.g. owner/admin) are allowed
to manually change the user switcher setting though UI.

Bug: 375394047
Test: atest UserManagerServiceTest
Test: create user, check value of user_switcher_enabled via ADB
Flag: EXEMPT Desktop-only change
Change-Id: Iafcadcb5bed5dd924402cd54a6d468aaa78f8cfd
parent 08efab93
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5996,6 +5996,12 @@
    <!-- If true, show multiuser switcher by default unless the user specifically disables it. -->
    <bool name="config_showUserSwitcherByDefault">false</bool>

    <!-- If true, user can change state of multiuser switcher. -->
    <bool name="config_allowChangeUserSwitcherEnabled">true</bool>

    <!-- If true, multiuser switcher would be automatically enabled when second user is created on the device. -->
    <bool name="config_enableUserSwitcherUponUserCreation">true</bool>

    <!-- Set to true to make assistant show in front of the dream/screensaver. -->
    <bool name="config_assistantOnTopOfDream">false</bool>

+2 −0
Original line number Diff line number Diff line
@@ -4690,6 +4690,8 @@

  <!-- If true, show multiuser switcher by default unless the user specifically disables it. -->
  <java-symbol type="bool" name="config_showUserSwitcherByDefault" />
  <java-symbol type="bool" name="config_allowChangeUserSwitcherEnabled" />
  <java-symbol type="bool" name="config_enableUserSwitcherUponUserCreation" />

  <!-- Set to true to make assistant show in front of the dream/screensaver. -->
  <java-symbol type="bool" name="config_assistantOnTopOfDream"/>
+5 −2
Original line number Diff line number Diff line
@@ -6122,11 +6122,14 @@ public class UserManagerService extends IUserManager.Stub {
            // If the user switch hasn't been explicitly toggled on or off by the user, turn it on.
            if (android.provider.Settings.Global.getString(mContext.getContentResolver(),
                    android.provider.Settings.Global.USER_SWITCHER_ENABLED) == null) {
                if (Resources.getSystem().getBoolean(
                        com.android.internal.R.bool.config_enableUserSwitcherUponUserCreation)) {
                    android.provider.Settings.Global.putInt(mContext.getContentResolver(),
                            android.provider.Settings.Global.USER_SWITCHER_ENABLED, 1);
                }
            }
        }
    }

    /**
     * Gets a pre-created user for the given user type.