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

Commit 5e77e6a4 authored by Chandru S's avatar Chandru S
Browse files

Tapping on the lockscreen should trigger face auth

Fixes: 361672944
Flag: com.android.systemui.scene_container
Test: atest KeyguardTouchHandlingInteractorTest
Test: manually
1. Lock the device
2. Tap some open space on the lockscreen
3. it should trigger face auth

Change-Id: I72b746bad86bd4eeb3c3e20e8842944382efe68d
parent 67ceebc0
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -25,8 +25,11 @@ import com.android.internal.logging.testing.UiEventLoggerFake
import com.android.internal.logging.uiEventLogger
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.deviceentry.shared.FaceAuthUiEvent
import com.android.systemui.flags.Flags
import com.android.systemui.flags.fakeFeatureFlagsClassic
import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFaceAuthRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
@@ -259,6 +262,23 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
                .log(KeyguardTouchHandlingInteractor.LogEvents.LOCK_SCREEN_LONG_PRESS_POPUP_CLICKED)
        }

    @Test
    fun triggersFaceAuthWhenLockscreenIsClicked() =
        testScope.runTest {
            collectLastValue(underTest.isMenuVisible)
            runCurrent()
            kosmos.fakeDeviceEntryFaceAuthRepository.canRunFaceAuth.value = true

            underTest.onClick(100.0f, 100.0f)
            runCurrent()

            val runningAuthRequest =
                kosmos.fakeDeviceEntryFaceAuthRepository.runningAuthRequest.value
            assertThat(runningAuthRequest?.first)
                .isEqualTo(FaceAuthUiEvent.FACE_AUTH_TRIGGERED_NOTIFICATION_PANEL_CLICKED)
            assertThat(runningAuthRequest?.second).isEqualTo(true)
        }

    @Test
    fun showMenu_leaveLockscreen_returnToLockscreen_menuNotVisible() =
        testScope.runTest {
@@ -302,6 +322,7 @@ class KeyguardTouchHandlingInteractorTest : SysuiTestCase() {
                broadcastDispatcher = fakeBroadcastDispatcher,
                accessibilityManager = kosmos.accessibilityManagerWrapper,
                pulsingGestureListener = kosmos.pulsingGestureListener,
                faceAuthInteractor = kosmos.deviceEntryFaceAuthInteractor,
            )
        setUpState()
    }
+5 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.internal.logging.UiEventLogger
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.data.repository.KeyguardRepository
@@ -67,6 +68,7 @@ constructor(
    broadcastDispatcher: BroadcastDispatcher,
    private val accessibilityManager: AccessibilityManagerWrapper,
    private val pulsingGestureListener: PulsingGestureListener,
    private val faceAuthInteractor: DeviceEntryFaceAuthInteractor,
) {
    /** Whether the long-press handling feature should be enabled. */
    val isLongPressHandlingEnabled: StateFlow<Boolean> =
@@ -129,7 +131,8 @@ constructor(
        }
    }

    /** Notifies that the user has long-pressed on the lock screen.
    /**
     * Notifies that the user has long-pressed on the lock screen.
     *
     * @param isA11yAction: Whether the action was performed as an a11y action
     */
@@ -174,6 +177,7 @@ constructor(
    /** Notifies that the lockscreen has been clicked at position [x], [y]. */
    fun onClick(x: Float, y: Float) {
        pulsingGestureListener.onSingleTapUp(x, y)
        faceAuthInteractor.onNotificationPanelClicked()
    }

    /** Notifies that the lockscreen has been double clicked. */
+3 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.systemui.animation.Expandable
import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.dock.DockManagerFake
import com.android.systemui.doze.util.BurnInHelperWrapper
import com.android.systemui.flags.FakeFeatureFlags
@@ -152,9 +153,7 @@ class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestC
        dockManager = DockManagerFake()
        biometricSettingsRepository = FakeBiometricSettingsRepository()
        val featureFlags =
            FakeFeatureFlags().apply {
                set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, false)
            }
            FakeFeatureFlags().apply { set(Flags.LOCK_SCREEN_LONG_PRESS_ENABLED, false) }

        val withDeps = KeyguardInteractorFactory.create(featureFlags = featureFlags)
        val keyguardInteractor = withDeps.keyguardInteractor
@@ -223,6 +222,7 @@ class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestC
                broadcastDispatcher = broadcastDispatcher,
                accessibilityManager = accessibilityManager,
                pulsingGestureListener = kosmos.pulsingGestureListener,
                faceAuthInteractor = kosmos.deviceEntryFaceAuthInteractor,
            )
        underTest =
            KeyguardBottomAreaViewModel(
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.applicationContext
import android.view.accessibility.accessibilityManagerWrapper
import com.android.internal.logging.uiEventLogger
import com.android.systemui.broadcast.broadcastDispatcher
import com.android.systemui.deviceentry.domain.interactor.deviceEntryFaceAuthInteractor
import com.android.systemui.flags.featureFlagsClassic
import com.android.systemui.keyguard.data.repository.keyguardRepository
import com.android.systemui.kosmos.Kosmos
@@ -38,5 +39,6 @@ val Kosmos.keyguardTouchHandlingInteractor by
            broadcastDispatcher = broadcastDispatcher,
            accessibilityManager = accessibilityManagerWrapper,
            pulsingGestureListener = pulsingGestureListener,
            faceAuthInteractor = deviceEntryFaceAuthInteractor,
        )
    }