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

Commit dcad68d5 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Enforce falsing for long press and double tap.

These checks already exists without the flag at the call sites, but
with flag they are composables so having the checks here makes it
easier to inject the falsing manager.

In the specific instance of the linked bug, by checking for false
long press we create a history of prior results rather than
defaulting to false for the menu button tap.

Fix: 432657748
Flag: com.android.systemui.scene_container
Test: atest KeyguardTouchHandlingViewModelTest + manual (see video in the bug)
Change-Id: Ibba6f91afc4c5995c0c14c0fec3d858ee4ed84dd
parent bd5349dc
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryUdfpsIntera
import com.android.systemui.keyguard.domain.interactor.KeyguardTouchHandlingInteractor
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.lifecycle.Hydrator
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.google.android.msdl.data.model.MSDLToken
import com.google.android.msdl.domain.MSDLPlayer
import dagger.assisted.AssistedFactory
@@ -39,6 +41,7 @@ class KeyguardTouchHandlingViewModel
constructor(
    private val interactor: KeyguardTouchHandlingInteractor,
    private val msdlPlayer: MSDLPlayer,
    private val falsingManager: FalsingManager,
    deviceEntryUdfpsInteractor: DeviceEntryUdfpsInteractor,
) : ExclusiveActivatable() {
    private val hydrator = Hydrator("KeyguardTouchHandlingViewModel.hydrator")
@@ -86,6 +89,14 @@ constructor(
     * @param isA11yAction: Whether the action was performed as an a11y action
     */
    fun onLongPress(isA11yAction: Boolean) {
        if (
            SceneContainerFlag.isEnabled &&
                !isA11yAction &&
                falsingManager.isFalseLongTap(FalsingManager.LOW_PENALTY)
        ) {
            return
        }

        if (Flags.msdlFeedback()) {
            msdlPlayer.playToken(MSDLToken.LONG_PRESS)
        }
@@ -107,6 +118,7 @@ constructor(

    /** Notifies that the lockscreen has been double clicked. */
    fun onDoubleClick() {
        if (SceneContainerFlag.isEnabled && falsingManager.isFalseDoubleTap()) return
        interactor.onDoubleClick()
    }

+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.keyguard.ui.viewmodel

import com.android.systemui.classifier.falsingManager
import com.android.systemui.deviceentry.domain.interactor.deviceEntryUdfpsInteractor
import com.android.systemui.haptics.msdl.msdlPlayer
import com.android.systemui.keyguard.domain.interactor.keyguardTouchHandlingInteractor
@@ -26,6 +27,7 @@ val Kosmos.keyguardTouchHandlingViewModel by
        KeyguardTouchHandlingViewModel(
            interactor = keyguardTouchHandlingInteractor,
            msdlPlayer = msdlPlayer,
            falsingManager = falsingManager,
            deviceEntryUdfpsInteractor = deviceEntryUdfpsInteractor,
        )
    }
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.keyguard.ui.viewmodel

import com.android.systemui.classifier.falsingManager
import com.android.systemui.deviceentry.domain.interactor.deviceEntryUdfpsInteractor
import com.android.systemui.haptics.msdl.msdlPlayer
import com.android.systemui.keyguard.domain.interactor.keyguardTouchHandlingInteractor
@@ -28,6 +29,7 @@ val Kosmos.keyguardTouchHandlingViewModelFactory by
                return KeyguardTouchHandlingViewModel(
                    keyguardTouchHandlingInteractor,
                    msdlPlayer,
                    falsingManager,
                    deviceEntryUdfpsInteractor,
                )
            }