diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 9e7964a4f6..22aca2571d 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -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( diff --git a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java index a05b4997a9..9a7710a0a7 100644 --- a/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java +++ b/tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java @@ -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);