mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Do not consume hover events not coming from cursor for a11y.
Fix: 283041221 Test: TaplTestsTransientTaskbar Flag: ENABLE_CURSOR_HOVER_STATES Change-Id: I95e9ded6873173ea001c82d6319716a2d48b3bad
This commit is contained in:
@@ -70,6 +70,7 @@ import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.Choreographer;
|
||||
import android.view.InputDevice;
|
||||
import android.view.InputEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceControl;
|
||||
@@ -752,7 +753,7 @@ public class TouchInteractionService extends Service {
|
||||
if (mGestureState.isTrackpadGesture() && (action == ACTION_POINTER_DOWN
|
||||
|| action == ACTION_POINTER_UP)) {
|
||||
// Skip ACTION_POINTER_DOWN and ACTION_POINTER_UP events from trackpad.
|
||||
} else if (event.isHoverEvent()) {
|
||||
} else if (isCursorHoverEvent(event)) {
|
||||
mUncheckedConsumer.onHoverEvent(event);
|
||||
} else {
|
||||
mUncheckedConsumer.onMotionEvent(event);
|
||||
@@ -764,6 +765,11 @@ public class TouchInteractionService extends Service {
|
||||
traceToken.close();
|
||||
}
|
||||
|
||||
// Talkback generates hover events on touch, which we do not want to consume.
|
||||
private boolean isCursorHoverEvent(MotionEvent event) {
|
||||
return event.isHoverEvent() && event.getSource() == InputDevice.SOURCE_MOUSE;
|
||||
}
|
||||
|
||||
private InputConsumer tryCreateAssistantInputConsumer(
|
||||
GestureState gestureState, MotionEvent motionEvent) {
|
||||
return tryCreateAssistantInputConsumer(
|
||||
|
||||
@@ -224,12 +224,14 @@ public final class LaunchedAppState extends Background {
|
||||
int leftEdge = 10;
|
||||
Point taskbarUnstashArea = new Point(leftEdge, mLauncher.getRealDisplaySize().y - 1);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
|
||||
InputDevice.SOURCE_MOUSE);
|
||||
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
|
||||
InputDevice.SOURCE_MOUSE);
|
||||
|
||||
return new Taskbar(mLauncher);
|
||||
}
|
||||
@@ -246,7 +248,8 @@ public final class LaunchedAppState extends Background {
|
||||
Point stashedTaskbarHintArea = new Point(mLauncher.getRealDisplaySize().x / 2,
|
||||
mLauncher.getRealDisplaySize().y - 1);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
|
||||
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null);
|
||||
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null,
|
||||
InputDevice.SOURCE_MOUSE);
|
||||
|
||||
mLauncher.getDevice().wait(mStashedTaskbarHintScaleCondition,
|
||||
LauncherInstrumentation.WAIT_TIME_MS);
|
||||
@@ -257,7 +260,8 @@ public final class LaunchedAppState extends Background {
|
||||
Point taskbarUnstashArea = new Point(mLauncher.getRealDisplaySize().x / 2,
|
||||
mLauncher.getRealDisplaySize().y - 1);
|
||||
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null);
|
||||
new Point(taskbarUnstashArea.x, taskbarUnstashArea.y), null,
|
||||
InputDevice.SOURCE_MOUSE);
|
||||
|
||||
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
|
||||
return new Taskbar(mLauncher);
|
||||
|
||||
Reference in New Issue
Block a user