Support swipe gesture on trackpad to swipe up from app
Bug: 254783214
Test: https://recall.googleplex.com/projects/3388b17c-d22f-46f8-b140-a102690377b4/sessions/92d385dd-bad5-49ea-a0b4-b4bf4010aabb
Change-Id: I74ba4a9e5c5096aaf6475f9cb8f1dc30de48024d
diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
index f8b6966..65a1e56 100644
--- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java
+++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
@@ -16,8 +16,10 @@
package com.android.quickstep;
import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
import static android.view.Surface.ROTATION_0;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
@@ -232,6 +234,9 @@
* @return whether the coordinates of the {@param event} is in the swipe up gesture region.
*/
public boolean isInSwipeUpTouchRegion(MotionEvent event) {
+ if (isTrackpadMotionEvent(event)) {
+ return true;
+ }
return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(), event.getY());
}
@@ -240,10 +245,20 @@
* is in the swipe up gesture region.
*/
public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex) {
+ if (isTrackpadMotionEvent(event)) {
+ return true;
+ }
return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(pointerIndex),
event.getY(pointerIndex));
}
+ private boolean isTrackpadMotionEvent(MotionEvent event) {
+ // TODO: ideally should use event.getClassification(), but currently only the move
+ // events get assigned the correct classification.
+ return ENABLE_TRACKPAD_GESTURE.get()
+ && (event.getSource() & SOURCE_TOUCHSCREEN) != SOURCE_TOUCHSCREEN;
+ }
+
@Override
public void onDisplayInfoChanged(Context context, Info info, int flags) {
onDisplayInfoChangedInternal(info, flags, false);
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 05ba32a..4170e97 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -308,6 +308,9 @@
public static final BooleanFlag ENABLE_TRANSIENT_TASKBAR = getDebugFlag(
"ENABLE_TRANSIENT_TASKBAR", false, "Enables transient taskbar.");
+ public static final BooleanFlag ENABLE_TRACKPAD_GESTURE = getDebugFlag(
+ "ENABLE_TRACKPAD_GESTURE", false, "Enables trackpad gesture.");
+
public static void initialize(Context context) {
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {