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

Commit ceb9b96d authored by Aaron Liu's avatar Aaron Liu
Browse files

[User Switcher] Remove manage user in phone dialog

Removes the manage user icon in the user switcher dialog on the phone.
This is because the user settings button serves this function.

Bug: 254257455
Test: Turn off fullscreen user switcher flag with `$adb shell cmd statusbar flag 506 off` and then observe the manage user icon. Observe that it is gone after changes. Manage user remains in the bouncer and is not a visible item in full screen user switcher.
Change-Id: Id86f21dd0f182cfb81ec08e32a6a9240563272c4
parent 668aee06
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.logging.MetricsLogger;
@@ -43,6 +44,9 @@ import com.android.systemui.statusbar.policy.BaseUserSwitcherAdapter;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.user.data.source.UserRecord;

import java.util.List;
import java.util.stream.Collectors;

import javax.inject.Inject;

/**
@@ -83,6 +87,13 @@ public class UserDetailView extends PseudoGridView {
        private final FalsingManager mFalsingManager;
        private @Nullable UserSwitchDialogController.DialogShower mDialogShower;

        @NonNull
        @Override
        protected List<UserRecord> getUsers() {
            return super.getUsers().stream().filter(
                    userRecord -> !userRecord.isManageUsers).collect(Collectors.toList());
        }

        @Inject
        public Adapter(Context context, UserSwitcherController controller,
                UiEventLogger uiEventLogger, FalsingManager falsingManager) {
+1 −5
Original line number Diff line number Diff line
@@ -43,11 +43,7 @@ protected constructor(
    }

    override fun getCount(): Int {
        return if (controller.isKeyguardShowing) {
            users.count { !it.isRestricted }
        } else {
            users.size
        }
        return users.size
    }

    override fun getItem(position: Int): UserRecord {
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.systemui.qs.QSUserSwitcherEvent
import com.android.systemui.statusbar.policy.UserSwitcherController
import com.android.systemui.user.data.source.UserRecord
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -139,6 +140,11 @@ class UserDetailViewAdapterTest : SysuiTestCase() {
        clickableTest(false, false, mUserDetailItemView, true)
    }

    @Test
    fun testManageUsersIsNotAvailable() {
        assertNull(adapter.users.find { it.isManageUsers })
    }

    private fun createUserRecord(current: Boolean, guest: Boolean) =
        UserRecord(
            UserInfo(0 /* id */, "name", 0 /* flags */),