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

Commit 7d6692e5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DeviceEntryIconViewModel uses isUnlocked flow with a slight delay" into main

parents 18e70bc1 bbdb9bc9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ constructor(
        }

    private val isUnlocked: Flow<Boolean> =
        deviceEntryInteractor.isUnlocked.flatMapLatest { isUnlocked ->
        keyguardInteractor.isKeyguardDismissible.flatMapLatest { isUnlocked ->
            if (!isUnlocked) {
                flowOf(false)
            } else {
@@ -197,7 +197,7 @@ constructor(
    val iconType: Flow<DeviceEntryIconView.IconType> =
        combine(
            deviceEntryUdfpsInteractor.isListeningForUdfps,
            keyguardInteractor.isKeyguardDismissible,
            isUnlocked,
        ) { isListeningForUdfps, isUnlocked ->
            if (isListeningForUdfps) {
                DeviceEntryIconView.IconType.FINGERPRINT
+6 −0
Original line number Diff line number Diff line
@@ -27,11 +27,14 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.keyguardRepository
import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel.Companion.UNLOCKED_DELAY_MS
import com.android.systemui.kosmos.testScope
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlin.test.Test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.advanceTimeBy
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.runner.RunWith
@@ -71,7 +74,10 @@ class DeviceEntryIconViewModelTest : SysuiTestCase() {
    fun isLongPressEnabled_unlocked() =
        testScope.runTest {
            val isLongPressEnabled by collectLastValue(underTest.isLongPressEnabled)
            fingerprintPropertyRepository.supportsUdfps()
            keyguardRepository.setKeyguardDismissible(true)
            advanceTimeBy(UNLOCKED_DELAY_MS * 2) // wait for unlocked delay
            runCurrent()
            assertThat(isLongPressEnabled).isTrue()
        }