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

Commit c38f564f authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge changes I56840bf9,I95e16a6b,I4268cfad into main

* changes:
  Fix hub lockscreen shortcut showing up before first unlock
  Enable lockscreen shortcuts when hub V2 flag is enabled
  Apply ktfmt
parents e3873301 114ea0ab
Loading
Loading
Loading
Loading
+37 −37
Original line number Diff line number Diff line
@@ -24,21 +24,19 @@ import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.data.repository.communalSceneRepository
import com.android.systemui.communal.domain.interactor.communalInteractor
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.communal.domain.interactor.setCommunalV2Available
import com.android.systemui.communal.domain.interactor.setCommunalV2Enabled
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.flags.andSceneContainer
import com.android.systemui.kosmos.testScope
import com.android.systemui.flags.parameterizeSceneContainerFlag
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runCurrent
import com.android.systemui.kosmos.runTest
import com.android.systemui.scene.data.repository.sceneContainerRepository
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -47,14 +45,11 @@ import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters

@SmallTest
@OptIn(ExperimentalCoroutinesApi::class)
@EnableFlags(Flags.FLAG_GLANCEABLE_HUB_SHORTCUT_BUTTON, Flags.FLAG_GLANCEABLE_HUB_V2)
@EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2)
@RunWith(ParameterizedAndroidJunit4::class)
class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : SysuiTestCase() {
    private val kosmos = testKosmos()
    private val testScope = kosmos.testScope

    private lateinit var underTest: GlanceableHubQuickAffordanceConfig
    private val Kosmos.underTest by Kosmos.Fixture { glanceableHubQuickAffordanceConfig }

    init {
        mSetFlagsRule.setFlagsParameterization(flags!!)
@@ -64,20 +59,16 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy
    fun setUp() {
        MockitoAnnotations.initMocks(this)

        underTest =
            GlanceableHubQuickAffordanceConfig(
                context = context,
                communalInteractor = kosmos.communalInteractor,
                communalSceneRepository = kosmos.communalSceneRepository,
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                sceneInteractor = kosmos.sceneInteractor,
            )
        // Access the class immediately so that flows are instantiated.
        // GlanceableHubQuickAffordanceConfig accesses StateFlow.value directly so we need the flows
        // to start flowing before runCurrent is called in the tests.
        kosmos.underTest
    }

    @Test
    fun lockscreenState_whenGlanceableHubEnabled_returnsVisible() =
        testScope.runTest {
            kosmos.setCommunalV2Enabled(true)
        kosmos.runTest {
            kosmos.setCommunalV2Available(true)
            runCurrent()

            val lockScreenState by collectLastValue(underTest.lockScreenState)
@@ -88,8 +79,21 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy

    @Test
    fun lockscreenState_whenGlanceableHubDisabled_returnsHidden() =
        testScope.runTest {
            kosmos.setCommunalV2Enabled(false)
        kosmos.runTest {
            setCommunalV2Enabled(false)
            val lockScreenState by collectLastValue(underTest.lockScreenState)
            runCurrent()

            assertThat(lockScreenState)
                .isEqualTo(KeyguardQuickAffordanceConfig.LockScreenState.Hidden)
        }

    @Test
    fun lockscreenState_whenGlanceableHubNotAvailable_returnsHidden() =
        kosmos.runTest {
            // Hub is enabled, but not available.
            setCommunalV2Enabled(true)
            fakeKeyguardRepository.setKeyguardShowing(false)
            val lockScreenState by collectLastValue(underTest.lockScreenState)
            runCurrent()

@@ -99,8 +103,8 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy

    @Test
    fun pickerScreenState_whenGlanceableHubEnabled_returnsDefault() =
        testScope.runTest {
            kosmos.setCommunalV2Enabled(true)
        kosmos.runTest {
            setCommunalV2Enabled(true)
            runCurrent()

            assertThat(underTest.getPickerScreenState())
@@ -109,8 +113,8 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy

    @Test
    fun pickerScreenState_whenGlanceableHubDisabled_returnsDisabled() =
        testScope.runTest {
            kosmos.setCommunalV2Enabled(false)
        kosmos.runTest {
            setCommunalV2Enabled(false)
            runCurrent()

            assertThat(
@@ -122,7 +126,7 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy
    @Test
    @DisableFlags(Flags.FLAG_SCENE_CONTAINER)
    fun onTriggered_changesSceneToCommunal() =
        testScope.runTest {
        kosmos.runTest {
            underTest.onTriggered(expandable = null)
            runCurrent()

@@ -133,7 +137,7 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy
    @Test
    @EnableFlags(Flags.FLAG_SCENE_CONTAINER)
    fun testTransitionToGlanceableHub_sceneContainer() =
        testScope.runTest {
        kosmos.runTest {
            underTest.onTriggered(expandable = null)
            runCurrent()

@@ -145,11 +149,7 @@ class GlanceableHubQuickAffordanceConfigTest(flags: FlagsParameterization?) : Sy
        @JvmStatic
        @Parameters(name = "{0}")
        fun getParams(): List<FlagsParameterization> {
            return FlagsParameterization.allCombinationsOf(
                    Flags.FLAG_GLANCEABLE_HUB_SHORTCUT_BUTTON,
                    Flags.FLAG_GLANCEABLE_HUB_V2,
                )
                .andSceneContainer()
            return parameterizeSceneContainerFlag()
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.provider.Settings
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
@@ -84,6 +85,7 @@ class KeyguardQuickAffordanceLegacySettingSyncerTest : SysuiTestCase() {
                            .thenReturn(FakeSharedPreferences())
                    },
                userTracker = FakeUserTracker(),
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                broadcastDispatcher = fakeBroadcastDispatcher,
            )
        settings.putInt(Settings.Secure.LOCKSCREEN_SHOW_CONTROLS, 0)
+52 −101
Original line number Diff line number Diff line
@@ -20,13 +20,17 @@ package com.android.systemui.keyguard.data.quickaffordance
import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.UserInfo
import android.platform.test.annotations.EnableFlags
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.backup.BackupHelper
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.res.R
import com.android.systemui.settings.FakeUserTracker
import com.android.systemui.settings.UserFileManager
import com.android.systemui.testKosmos
import com.android.systemui.util.FakeSharedPreferences
import com.android.systemui.util.mockito.whenever
import com.google.common.truth.Truth.assertThat
@@ -54,6 +58,7 @@ import org.mockito.MockitoAnnotations
@SmallTest
@RunWith(AndroidJUnit4::class)
class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
    private val kosmos = testKosmos()

    @Mock private lateinit var userFileManager: UserFileManager

@@ -80,6 +85,7 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
                context = context,
                userFileManager = userFileManager,
                userTracker = userTracker,
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                broadcastDispatcher = fakeBroadcastDispatcher,
            )
    }
@@ -110,27 +116,13 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
        val affordanceId2 = "affordance2"
        val affordanceId3 = "affordance3"

        underTest.setSelections(
            slotId = slotId1,
            affordanceIds = listOf(affordanceId1),
        )
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId1),
            ),
        )
        underTest.setSelections(slotId = slotId1, affordanceIds = listOf(affordanceId1))
        assertSelections(affordanceIdsBySlotId.last(), mapOf(slotId1 to listOf(affordanceId1)))

        underTest.setSelections(
            slotId = slotId2,
            affordanceIds = listOf(affordanceId2),
        )
        underTest.setSelections(slotId = slotId2, affordanceIds = listOf(affordanceId2))
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId1),
                slotId2 to listOf(affordanceId2),
            )
            mapOf(slotId1 to listOf(affordanceId1), slotId2 to listOf(affordanceId2)),
        )

        underTest.setSelections(
@@ -139,34 +131,19 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
        )
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId1, affordanceId3),
                slotId2 to listOf(affordanceId2),
            )
            mapOf(slotId1 to listOf(affordanceId1, affordanceId3), slotId2 to listOf(affordanceId2)),
        )

        underTest.setSelections(
            slotId = slotId1,
            affordanceIds = listOf(affordanceId3),
        )
        underTest.setSelections(slotId = slotId1, affordanceIds = listOf(affordanceId3))
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId3),
                slotId2 to listOf(affordanceId2),
            )
            mapOf(slotId1 to listOf(affordanceId3), slotId2 to listOf(affordanceId2)),
        )

        underTest.setSelections(
            slotId = slotId2,
            affordanceIds = listOf(),
        )
        underTest.setSelections(slotId = slotId2, affordanceIds = listOf())
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId3),
                slotId2 to listOf(),
            )
            mapOf(slotId1 to listOf(affordanceId3), slotId2 to listOf()),
        )

        job.cancel()
@@ -174,10 +151,7 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {

    @Test
    fun remembersSelectionsByUser() = runTest {
        overrideResource(
            R.array.config_keyguardQuickAffordanceDefaults,
            arrayOf<String>(),
        )
        overrideResource(R.array.config_keyguardQuickAffordanceDefaults, arrayOf<String>())
        val slot1 = "slot_1"
        val slot2 = "slot_2"
        val affordance1 = "affordance_1"
@@ -195,60 +169,28 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
                UserInfo(/* id= */ 0, "zero", /* flags= */ 0),
                UserInfo(/* id= */ 1, "one", /* flags= */ 0),
            )
        userTracker.set(
            userInfos = userInfos,
            selectedUserIndex = 0,
        )
        underTest.setSelections(
            slotId = slot1,
            affordanceIds = listOf(affordance1),
        )
        underTest.setSelections(
            slotId = slot2,
            affordanceIds = listOf(affordance2),
        )
        userTracker.set(userInfos = userInfos, selectedUserIndex = 0)
        underTest.setSelections(slotId = slot1, affordanceIds = listOf(affordance1))
        underTest.setSelections(slotId = slot2, affordanceIds = listOf(affordance2))

        // Switch to user 1
        userTracker.set(
            userInfos = userInfos,
            selectedUserIndex = 1,
        )
        userTracker.set(userInfos = userInfos, selectedUserIndex = 1)
        // We never set selections on user 1, so it should be empty.
        assertSelections(
            observed = affordanceIdsBySlotId.last(),
            expected = emptyMap(),
        )
        assertSelections(observed = affordanceIdsBySlotId.last(), expected = emptyMap())
        // Now, let's set selections on user 1.
        underTest.setSelections(
            slotId = slot1,
            affordanceIds = listOf(affordance2),
        )
        underTest.setSelections(
            slotId = slot2,
            affordanceIds = listOf(affordance3),
        )
        underTest.setSelections(slotId = slot1, affordanceIds = listOf(affordance2))
        underTest.setSelections(slotId = slot2, affordanceIds = listOf(affordance3))
        assertSelections(
            observed = affordanceIdsBySlotId.last(),
            expected =
                mapOf(
                    slot1 to listOf(affordance2),
                    slot2 to listOf(affordance3),
                ),
            expected = mapOf(slot1 to listOf(affordance2), slot2 to listOf(affordance3)),
        )

        // Switch back to user 0.
        userTracker.set(
            userInfos = userInfos,
            selectedUserIndex = 0,
        )
        userTracker.set(userInfos = userInfos, selectedUserIndex = 0)
        // Assert that we still remember the old selections for user 0.
        assertSelections(
            observed = affordanceIdsBySlotId.last(),
            expected =
                mapOf(
                    slot1 to listOf(affordance1),
                    slot2 to listOf(affordance2),
                ),
            expected = mapOf(slot1 to listOf(affordance1), slot2 to listOf(affordance2)),
        )

        job.cancel()
@@ -276,10 +218,7 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {

        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId1, affordanceId3),
                slotId2 to listOf(affordanceId2),
            ),
            mapOf(slotId1 to listOf(affordanceId1, affordanceId3), slotId2 to listOf(affordanceId2)),
        )

        job.cancel()
@@ -308,10 +247,7 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
        underTest.setSelections(slotId1, listOf(affordanceId2))
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(affordanceId2),
                slotId2 to listOf(affordanceId2),
            ),
            mapOf(slotId1 to listOf(affordanceId2), slotId2 to listOf(affordanceId2)),
        )

        job.cancel()
@@ -340,10 +276,7 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
        underTest.setSelections(slotId1, listOf())
        assertSelections(
            affordanceIdsBySlotId.last(),
            mapOf(
                slotId1 to listOf(),
                slotId2 to listOf(affordanceId2),
            ),
            mapOf(slotId1 to listOf(), slotId2 to listOf(affordanceId2)),
        )

        job.cancel()
@@ -373,18 +306,36 @@ class KeyguardQuickAffordanceLocalUserSelectionManagerTest : SysuiTestCase() {
        overrideResource(R.bool.custom_lockscreen_shortcuts_enabled, false)
        overrideResource(
            R.array.config_keyguardQuickAffordanceDefaults,
            arrayOf("leftTest:testShortcut1", "rightTest:testShortcut2")
            arrayOf("leftTest:testShortcut1", "rightTest:testShortcut2"),
        )

        assertThat(underTest.getSelections())
            .isEqualTo(
                mapOf(
                    "leftTest" to listOf("testShortcut1"),
                    "rightTest" to listOf("testShortcut2"),
                )
                mapOf("leftTest" to listOf("testShortcut1"), "rightTest" to listOf("testShortcut2"))
            )
    }

    @EnableFlags(Flags.FLAG_GLANCEABLE_HUB_V2)
    @Test
    fun getSelections_returnsSelectionsIfHubV2Enabled() = runTest {
        overrideResource(R.bool.custom_lockscreen_shortcuts_enabled, false)
        overrideResource(com.android.internal.R.bool.config_glanceableHubEnabled, true)

        overrideResource(R.array.config_keyguardQuickAffordanceDefaults, arrayOf<String>())
        val affordanceIdsBySlotId = mutableListOf<Map<String, List<String>>>()
        val job =
            launch(UnconfinedTestDispatcher()) {
                underTest.selections.toList(affordanceIdsBySlotId)
            }
        val slotId1 = "slot1"
        val affordanceId1 = "affordance1"

        underTest.setSelections(slotId = slotId1, affordanceIds = listOf(affordanceId1))
        assertSelections(affordanceIdsBySlotId.last(), mapOf(slotId1 to listOf(affordanceId1)))

        job.cancel()
    }

    private fun assertSelections(
        observed: Map<String, List<String>>?,
        expected: Map<String, List<String>>,
+21 −83
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.UserHandle
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceConfig
import com.android.systemui.keyguard.data.quickaffordance.FakeKeyguardQuickAffordanceProviderClientFactory
@@ -84,16 +85,11 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
                context = context,
                userFileManager =
                    mock<UserFileManager>().apply {
                        whenever(
                                getSharedPreferences(
                                    anyString(),
                                    anyInt(),
                                    anyInt(),
                                )
                            )
                        whenever(getSharedPreferences(anyString(), anyInt(), anyInt()))
                            .thenReturn(FakeSharedPreferences())
                    },
                userTracker = userTracker,
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                broadcastDispatcher = fakeBroadcastDispatcher,
            )
        client1 = FakeCustomizationProviderClient()
@@ -103,9 +99,8 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
                scope = testScope.backgroundScope,
                userTracker = userTracker,
                clientFactory =
                    FakeKeyguardQuickAffordanceProviderClientFactory(
                        userTracker,
                    ) { selectedUserId ->
                    FakeKeyguardQuickAffordanceProviderClientFactory(userTracker) { selectedUserId
                        ->
                        when (selectedUserId) {
                            SECONDARY_USER_1 -> client1
                            SECONDARY_USER_2 -> client2
@@ -115,10 +110,7 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
                userHandle = UserHandle.SYSTEM,
            )

        overrideResource(
            R.array.config_keyguardQuickAffordanceDefaults,
            arrayOf<String>(),
        )
        overrideResource(R.array.config_keyguardQuickAffordanceDefaults, arrayOf<String>())

        underTest =
            KeyguardQuickAffordanceRepository(
@@ -155,30 +147,19 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
            val slotId2 = "slot2"

            underTest.setSelections(slotId1, listOf(config1.key))
            assertSelections(
                configsBySlotId(),
                mapOf(
                    slotId1 to listOf(config1),
                ),
            )
            assertSelections(configsBySlotId(), mapOf(slotId1 to listOf(config1)))

            underTest.setSelections(slotId2, listOf(config2.key))
            assertSelections(
                configsBySlotId(),
                mapOf(
                    slotId1 to listOf(config1),
                    slotId2 to listOf(config2),
                ),
                mapOf(slotId1 to listOf(config1), slotId2 to listOf(config2)),
            )

            underTest.setSelections(slotId1, emptyList())
            underTest.setSelections(slotId2, listOf(config1.key))
            assertSelections(
                configsBySlotId(),
                mapOf(
                    slotId1 to emptyList(),
                    slotId2 to listOf(config1),
                ),
                mapOf(slotId1 to emptyList(), slotId2 to listOf(config1)),
            )
        }

@@ -209,28 +190,15 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
        val slot3 = "slot3"
        context.orCreateTestableResources.addOverride(
            R.array.config_keyguardQuickAffordanceSlots,
            arrayOf(
                "$slot1:2",
                "$slot2:4",
                "$slot3:5",
            ),
            arrayOf("$slot1:2", "$slot2:4", "$slot3:5"),
        )

        assertThat(underTest.getSlotPickerRepresentations())
            .isEqualTo(
                listOf(
                    KeyguardSlotPickerRepresentation(
                        id = slot1,
                        maxSelectedAffordances = 2,
                    ),
                    KeyguardSlotPickerRepresentation(
                        id = slot2,
                        maxSelectedAffordances = 4,
                    ),
                    KeyguardSlotPickerRepresentation(
                        id = slot3,
                        maxSelectedAffordances = 5,
                    ),
                    KeyguardSlotPickerRepresentation(id = slot1, maxSelectedAffordances = 2),
                    KeyguardSlotPickerRepresentation(id = slot2, maxSelectedAffordances = 4),
                    KeyguardSlotPickerRepresentation(id = slot3, maxSelectedAffordances = 5),
                )
            )
    }
@@ -243,28 +211,15 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
        val slot3 = "slot3"
        context.orCreateTestableResources.addOverride(
            R.array.config_keyguardQuickAffordanceSlots,
            arrayOf(
                "$slot1:2",
                "$slot2:4",
                "$slot3:5",
            ),
            arrayOf("$slot1:2", "$slot2:4", "$slot3:5"),
        )

        assertThat(underTest.getSlotPickerRepresentations())
            .isEqualTo(
                listOf(
                    KeyguardSlotPickerRepresentation(
                        id = slot3,
                        maxSelectedAffordances = 5,
                    ),
                    KeyguardSlotPickerRepresentation(
                        id = slot2,
                        maxSelectedAffordances = 4,
                    ),
                    KeyguardSlotPickerRepresentation(
                        id = slot1,
                        maxSelectedAffordances = 2,
                    ),
                    KeyguardSlotPickerRepresentation(id = slot3, maxSelectedAffordances = 5),
                    KeyguardSlotPickerRepresentation(id = slot2, maxSelectedAffordances = 4),
                    KeyguardSlotPickerRepresentation(id = slot1, maxSelectedAffordances = 2),
                )
            )
    }
@@ -275,21 +230,9 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
            userTracker.set(
                userInfos =
                    listOf(
                        UserInfo(
                            UserHandle.USER_SYSTEM,
                            "Primary",
                            /* flags= */ 0,
                        ),
                        UserInfo(
                            SECONDARY_USER_1,
                            "Secondary 1",
                            /* flags= */ 0,
                        ),
                        UserInfo(
                            SECONDARY_USER_2,
                            "Secondary 2",
                            /* flags= */ 0,
                        ),
                        UserInfo(UserHandle.USER_SYSTEM, "Primary", /* flags= */ 0),
                        UserInfo(SECONDARY_USER_1, "Secondary 1", /* flags= */ 0),
                        UserInfo(SECONDARY_USER_2, "Secondary 2", /* flags= */ 0),
                    ),
                selectedUserIndex = 2,
            )
@@ -302,12 +245,7 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
            assertSelections(
                observed = observed(),
                expected =
                    mapOf(
                        KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START to
                            listOf(
                                config2,
                            ),
                    )
                    mapOf(KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_START to listOf(config2)),
            )
        }

+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.DialogTransitionAnimator
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.communal.domain.interactor.communalSettingsInteractor
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.coroutines.collectValues
import com.android.systemui.dock.DockManager
@@ -147,6 +148,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
                            .thenReturn(FakeSharedPreferences())
                    },
                userTracker = userTracker,
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                broadcastDispatcher = fakeBroadcastDispatcher,
            )
        val remoteUserSelectionManager =
@@ -196,6 +198,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
                biometricSettingsRepository = biometricSettingsRepository,
                backgroundDispatcher = kosmos.testDispatcher,
                appContext = context,
                communalSettingsInteractor = kosmos.communalSettingsInteractor,
                sceneInteractor = { kosmos.sceneInteractor },
            )
        kosmos.keyguardQuickAffordanceInteractor = underTest
Loading