summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2022-01-20 23:55:17 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-02-14 23:13:07 +0000
commitab5f39bdc08f4469f1c759b7dcd0fd7cf56654fb (patch)
tree72374e17a0bffee19ce7688ce11308e578a93a67
parentaf3034c3ce25f268fb8279dc3eb611418ee57f42 (diff)
Dispatch hover events through the input consumer proxy
- Touch explore uses hover events to focus views for accessibility, but we were dropping these events when handling them through the input consumer proxy. The reason this changed is that in sc-v2 we moved the recents input consumer to the top of the task display area to ensure that it was always above any of the tasks in splitscreen, but by doing so, it was always above launcher even after settling in overview. The existing path for handling motion events is heavily tied to touch handling (action down/move/up) so we just add a separate path for dispatching hover events through the normal mechanism to launcher via the consumer. Bug: 197043796 Change-Id: I5f8cfd357ff13971fe172ce1d0179535479cd26c (cherry picked from commit eff9a120c67bb85d66f6d2244da05f283f30f93d) Merged-In:I5f8cfd357ff13971fe172ce1d0179535479cd26c
-rw-r--r--quickstep/src/com/android/quickstep/InputConsumer.java2
-rw-r--r--quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java7
-rw-r--r--quickstep/src/com/android/quickstep/util/InputConsumerProxy.java20
3 files changed, 28 insertions, 1 deletions
diff --git a/quickstep/src/com/android/quickstep/InputConsumer.java b/quickstep/src/com/android/quickstep/InputConsumer.java
index 0b093234f3..c455dc7462 100644
--- a/quickstep/src/com/android/quickstep/InputConsumer.java
+++ b/quickstep/src/com/android/quickstep/InputConsumer.java
@@ -99,6 +99,8 @@ public interface InputConsumer {
default void onMotionEvent(MotionEvent ev) { }
+ default void onHoverEvent(MotionEvent ev) { }
+
default void onKeyEvent(KeyEvent ev) { }
default void onInputEvent(InputEvent ev) {
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index b0df2869c7..02ac48ebeb 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -101,6 +101,13 @@ public class OverviewInputConsumer<S extends BaseState<S>, T extends StatefulAct
}
@Override
+ public void onHoverEvent(MotionEvent ev) {
+ if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
+ mActivity.dispatchGenericMotionEvent(ev);
+ }
+ }
+
+ @Override
public void onKeyEvent(KeyEvent ev) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
switch (ev.getKeyCode()) {
diff --git a/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java b/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
index c2101a848e..91b53c7ff2 100644
--- a/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
+++ b/quickstep/src/com/android/quickstep/util/InputConsumerProxy.java
@@ -71,7 +71,16 @@ public class InputConsumerProxy {
private boolean onInputConsumerEvent(InputEvent ev) {
if (ev instanceof MotionEvent) {
- onInputConsumerMotionEvent((MotionEvent) ev);
+ MotionEvent event = (MotionEvent) ev;
+ int action = event.getActionMasked();
+ boolean isHoverEvent = action == MotionEvent.ACTION_HOVER_ENTER
+ || action == MotionEvent.ACTION_HOVER_MOVE
+ || action == MotionEvent.ACTION_HOVER_EXIT;
+ if (isHoverEvent) {
+ onInputConsumerHoverEvent(event);
+ } else {
+ onInputConsumerMotionEvent(event);
+ }
} else if (ev instanceof KeyEvent) {
initInputConsumerIfNeeded();
mInputConsumer.onKeyEvent((KeyEvent) ev);
@@ -113,6 +122,15 @@ public class InputConsumerProxy {
return true;
}
+ private void onInputConsumerHoverEvent(MotionEvent ev) {
+ initInputConsumerIfNeeded();
+ if (mInputConsumer != null) {
+ SimpleOrientationTouchTransformer.INSTANCE.get(mContext).transform(ev,
+ mRotationSupplier.get());
+ mInputConsumer.onHoverEvent(ev);
+ }
+ }
+
public void destroy() {
if (mTouchInProgress) {
mDestroyPending = true;