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

Commit 58afb907 authored by Brad Hinegardner's avatar Brad Hinegardner
Browse files

Allow non-interactive click on lockscreen to show bouncer

Clicking anywhere non-interactive on lockscreen will now show the
bouncer. This works with trackpad, mouse, or any pointing device that
can perform a PRIMARY_BUTTON action, that is not a SOURCE_TOUCHSCREEN.

This may include gamepads, trackballs, and many other devices besides
just mice and trackpads.

This retains the existing functionality of finger-tapping a
non-interactive location not pulling up the bouncer.

Fixes: 319809270
Test: manual - tested on tablet with trackpad attached
Test: manual - tested on tablet with mouse attached
Flag: com.android.systemui.non_touchscreen_devices_bypass_falsing
Change-Id: I1f9ad3217a40077a95f0a1fb5e474dce137ac35c
parent ccd1feda
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.KeyguardIndicationController
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.statusbar.phone.ScreenOffAnimationController
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
import com.google.android.msdl.domain.MSDLPlayer
import dagger.Lazy
@@ -112,6 +113,7 @@ constructor(
    private val clockInteractor: KeyguardClockInteractor,
    private val keyguardViewMediator: KeyguardViewMediator,
    private val deviceEntryUnlockTrackerViewBinder: Optional<DeviceEntryUnlockTrackerViewBinder>,
    private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager,
    @Main private val mainDispatcher: CoroutineDispatcher,
    private val msdlPlayer: MSDLPlayer,
) : CoreStartable {
@@ -220,6 +222,7 @@ constructor(
                vibratorHelper,
                falsingManager,
                keyguardViewMediator,
                statusBarKeyguardViewManager,
                mainDispatcher,
                msdlPlayer,
            )
+28 −1
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.graphics.Point
import android.graphics.Rect
import android.util.Log
import android.view.HapticFeedbackConstants
import android.view.InputDevice
import android.view.MotionEvent
import android.view.View
import android.view.View.OnLayoutChangeListener
import android.view.View.VISIBLE
@@ -41,6 +43,7 @@ import com.android.app.tracing.coroutines.launch
import com.android.internal.jank.InteractionJankMonitor
import com.android.internal.jank.InteractionJankMonitor.CUJ_SCREEN_OFF_SHOW_AOD
import com.android.keyguard.AuthInteractionProperties
import com.android.systemui.Flags
import com.android.systemui.Flags.msdlFeedback
import com.android.systemui.Flags.newAodTransition
import com.android.systemui.common.shared.model.Icon
@@ -73,6 +76,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.statusbar.CrossFadeHelper
import com.android.systemui.statusbar.VibratorHelper
import com.android.systemui.statusbar.phone.ScreenOffAnimationController
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.temporarydisplay.ViewPriority
import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator
import com.android.systemui.temporarydisplay.chipbar.ChipbarInfo
@@ -115,6 +119,7 @@ object KeyguardRootViewBinder {
        vibratorHelper: VibratorHelper?,
        falsingManager: FalsingManager?,
        keyguardViewMediator: KeyguardViewMediator?,
        statusBarKeyguardViewManager: StatusBarKeyguardViewManager?,
        mainImmediateDispatcher: CoroutineDispatcher,
        msdlPlayer: MSDLPlayer?,
    ): DisposableHandle {
@@ -124,12 +129,30 @@ object KeyguardRootViewBinder {
        if (KeyguardBottomAreaRefactor.isEnabled) {
            disposables +=
                view.onTouchListener { _, event ->
                    var consumed = false
                    if (falsingManager?.isFalseTap(FalsingManager.LOW_PENALTY) == false) {
                        // signifies a primary button click down has reached keyguardrootview
                        // we need to return true here otherwise an ACTION_UP will never arrive
                        if (Flags.nonTouchscreenDevicesBypassFalsing()) {
                            if (
                                event.action == MotionEvent.ACTION_DOWN &&
                                    event.buttonState == MotionEvent.BUTTON_PRIMARY &&
                                    !event.isTouchscreenSource()
                            ) {
                                consumed = true
                            } else if (
                                event.action == MotionEvent.ACTION_UP &&
                                    !event.isTouchscreenSource()
                            ) {
                                statusBarKeyguardViewManager?.showBouncer(true)
                                consumed = true
                            }
                        }
                        viewModel.setRootViewLastTapPosition(
                            Point(event.x.toInt(), event.y.toInt())
                        )
                    }
                    false
                    consumed
                }
        }

@@ -637,6 +660,10 @@ object KeyguardRootViewBinder {
        }
    }

    private fun MotionEvent.isTouchscreenSource(): Boolean {
        return device?.supportsSource(InputDevice.SOURCE_TOUCHSCREEN) == true
    }

    private fun ViewPropertyAnimator.animateInIconTranslation(): ViewPropertyAnimator =
        setInterpolator(Interpolators.DECELERATE_QUINT).translationY(0f)

+1 −0
Original line number Diff line number Diff line
@@ -417,6 +417,7 @@ constructor(
                    null, // device entry haptics not required for preview mode
                    null, // falsing manager not required for preview mode
                    null, // keyguard view mediator is not required for preview mode
                    null, // primary bouncer interactor is not required for preview mode
                    mainDispatcher,
                    null,
                )