Allow two finger gesture from trackpad to pull down notification from home
Fixes: 255602235
Test: manual
Change-Id: I99742320b322a1e7b04bad0e374fcc48f8871ce1
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
index 1bc789b..af63a07 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
@@ -21,6 +21,7 @@
import static android.view.MotionEvent.ACTION_UP;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
+import static com.android.launcher3.Utilities.isTrackpadMotionEvent;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN;
import android.graphics.PointF;
@@ -104,7 +105,8 @@
// Currently input dispatcher will not do touch transfer if there are more than
// one touch pointer. Hence, even if slope passed, only set the slippery flag
// when there is single touch event. (context: InputDispatcher.cpp line 1445)
- if (dy > mTouchSlop && dy > Math.abs(dx) && ev.getPointerCount() == 1) {
+ if (dy > mTouchSlop && dy > Math.abs(dx) && (isTrackpadMotionEvent(ev)
+ || ev.getPointerCount() == 1)) {
ev.setAction(ACTION_DOWN);
dispatchTouchEvent(ev);
setWindowSlippery(true);
@@ -158,7 +160,8 @@
} else {
// For NORMAL state, only listen if the event originated above the navbar height
DeviceProfile dp = mLauncher.getDeviceProfile();
- if (ev.getY() > (mLauncher.getDragLayer().getHeight() - dp.getInsets().bottom)) {
+ if (!isTrackpadMotionEvent(ev) && ev.getY() > (mLauncher.getDragLayer().getHeight()
+ - dp.getInsets().bottom)) {
return false;
}
}
diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
index 65a1e56..a071b76 100644
--- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java
+++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java
@@ -16,10 +16,9 @@
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.Utilities.isTrackpadMotionEvent;
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;
@@ -252,13 +251,6 @@
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/Utilities.java b/src/com/android/launcher3/Utilities.java
index f70511a..c11de7f 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -16,6 +16,9 @@
package com.android.launcher3;
+import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
+
+import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE;
import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ICON_BADGED;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
@@ -917,6 +920,13 @@
return options;
}
+ public static 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;
+ }
+
public static boolean bothNull(@Nullable Object a, @Nullable Object b) {
return a == null && b == null;
}