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

Commit 61564444 authored by Brad Hinegardner's avatar Brad Hinegardner
Browse files

Allow any non-touchscreen device click to bypass long-press need for shortcuts

Previously only mouse and stylus were able to avoid having to long-press
to activate a shortcut.

Inversely, we only want the touchscreen to require a long-press, which
this adjusts to.

This allows for trackpads, game pads, trackballs, and many other
accurate devices to activate the shortcuts without having to long-press.

Fixes: 355692248
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: I175cbf79834b48d21b20ff42320d8889bd9e26a4
parent 58afb907
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -18,13 +18,12 @@ package com.android.systemui.keyguard.ui.binder

import android.annotation.SuppressLint
import android.graphics.PointF
import android.view.InputDevice
import android.view.MotionEvent
import android.view.View
import android.view.ViewConfiguration
import android.view.ViewPropertyAnimator
import androidx.core.animation.CycleInterpolator
import androidx.core.animation.ObjectAnimator
import com.android.systemui.res.R
import com.android.systemui.Flags
import com.android.systemui.animation.Expandable
import com.android.systemui.common.ui.view.rawDistanceFrom
import com.android.systemui.keyguard.ui.viewmodel.KeyguardQuickAffordanceViewModel
@@ -71,8 +70,7 @@ class KeyguardQuickAffordanceOnTouchListener(
                    // Moving too far while performing a long-press gesture cancels that
                    // gesture.
                    if (
                        event
                            .rawDistanceFrom(
                        event.rawDistanceFrom(
                            downDisplayCoords.x,
                            downDisplayCoords.y,
                        ) > ViewConfiguration.getTouchSlop()
@@ -151,7 +149,10 @@ class KeyguardQuickAffordanceOnTouchListener(
            event: MotionEvent,
            pointerIndex: Int = 0,
        ): Boolean {
            return when (event.getToolType(pointerIndex)) {
            return if (Flags.nonTouchscreenDevicesBypassFalsing()) {
                event.device?.supportsSource(InputDevice.SOURCE_TOUCHSCREEN) == false
            } else {
                when (event.getToolType(pointerIndex)) {
                    MotionEvent.TOOL_TYPE_STYLUS -> true
                    MotionEvent.TOOL_TYPE_MOUSE -> true
                    else -> false
@@ -159,3 +160,4 @@ class KeyguardQuickAffordanceOnTouchListener(
            }
        }
    }
}