Merge "Support 3-finger swipe to pull down notifications from app" into udc-dev

This commit is contained in:
Tracy Zhou
2023-04-20 22:19:03 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 8 deletions
@@ -21,7 +21,6 @@ import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN;
import android.graphics.PointF;
@@ -106,8 +105,7 @@ public class StatusBarTouchController implements TouchController {
// 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) && (isTrackpadMotionEvent(ev)
|| ev.getPointerCount() == 1)) {
if (dy > mTouchSlop && dy > Math.abs(dx) && ev.getPointerCount() == 1) {
ev.setAction(ACTION_DOWN);
dispatchTouchEvent(ev);
setWindowSlippery(true);
@@ -161,8 +159,7 @@ public class StatusBarTouchController implements TouchController {
} else {
// For NORMAL state, only listen if the event originated above the navbar height
DeviceProfile dp = mLauncher.getDeviceProfile();
if (!isTrackpadMotionEvent(ev) && ev.getY() > (mLauncher.getDragLayer().getHeight()
- dp.getInsets().bottom)) {
if (ev.getY() > (mLauncher.getDragLayer().getHeight() - dp.getInsets().bottom)) {
return false;
}
}
@@ -871,7 +871,6 @@ public class TouchInteractionService extends Service
}
if (ENABLE_TRACKPAD_GESTURE.get() && mGestureState.isTrackpadGesture()
&& mGestureState.getActivityInterface().isResumed()
&& !previousGestureState.isRecentsAnimationRunning()) {
reasonString = newCompoundString(reasonPrefix)
.append(SUBSTRING_PREFIX)
@@ -294,8 +294,14 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
boolean haveNotPassedSlopOnContinuedGesture =
!mPassedSlopOnThisGesture && mPassedPilferInputSlop;
double degrees = Math.toDegrees(Math.atan(upDist / horizontalDist));
boolean isLikelyToStartNewTask = haveNotPassedSlopOnContinuedGesture
|| degrees <= OVERVIEW_MIN_DEGREES;
// Regarding degrees >= -OVERVIEW_MIN_DEGREES - Trackpad gestures can start anywhere
// on the screen, allowing downward swipes. We want to impose the same angle in that
// scenario.
boolean swipeWithinQuickSwitchRange = degrees <= OVERVIEW_MIN_DEGREES
&& (!mGestureState.isTrackpadGesture() || degrees >= -OVERVIEW_MIN_DEGREES);
boolean isLikelyToStartNewTask =
haveNotPassedSlopOnContinuedGesture || swipeWithinQuickSwitchRange;
if (!mPassedPilferInputSlop) {
if (passedSlop) {