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

Commit 24f8a758 authored by Jason Monk's avatar Jason Monk
Browse files

Don't show multi-user in QS unless it has been activated before

Like adding another user or activating a guest at some point.

Test: manual
Bug: 37152893
Change-Id: Ifeadeb8e7f021c4854aa74b71ffb6bed116c9c0f
parent cb5296a6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ public final class Prefs {
        Key.QS_INVERT_COLORS_ADDED,
        Key.QS_WORK_ADDED,
        Key.QS_NIGHTDISPLAY_ADDED,
        Key.SEEN_MULTI_USER,
    })
    public @interface Key {
        @Deprecated
@@ -73,6 +74,7 @@ public final class Prefs {
        String QS_WORK_ADDED = "QsWorkAdded";
        @Deprecated
        String QS_NIGHTDISPLAY_ADDED = "QsNightDisplayAdded";
        String SEEN_MULTI_USER = "HasSeenMultiUser";
    }

    public static boolean getBoolean(Context context, @Key String key, boolean defaultValue) {
+4 −1
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import android.widget.Button;
import android.widget.FrameLayout;

import com.android.systemui.Dependency;
import com.android.systemui.Prefs;
import com.android.systemui.Prefs.Key;
import com.android.systemui.R;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.DetailAdapter;
@@ -74,7 +76,8 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
        if (mUserListener == null) {
            return false;
        }
        return mUserListener.getUserCount() != 0;
        return mUserListener.getUserCount() != 0
                && Prefs.getBoolean(getContext(), Key.SEEN_MULTI_USER, false);
    }

    public void setUserSwitcherController(UserSwitcherController userSwitcherController) {
+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
import com.android.systemui.GuestResumeSessionReceiver;
import com.android.systemui.Prefs;
import com.android.systemui.Prefs.Key;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.SystemUISecondaryUserService;
@@ -235,6 +237,9 @@ public class UserSwitcherController {
                        }
                    }
                }
                if (records.size() > 1 || guestRecord != null) {
                    Prefs.putBoolean(mContext, Key.SEEN_MULTI_USER, true);
                }

                boolean systemCanCreateUsers = !mUserManager.hasBaseUserRestriction(
                                UserManager.DISALLOW_ADD_USER, UserHandle.SYSTEM);