From fb5ba04c6a4acbe711161a1f2f1d25ac6fa6d892 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Thu, 15 Jul 2021 11:13:06 +0100 Subject: [PATCH] launcher: enable swipe down to open focused app Fixes 192437421 Test: manual testing Change-Id: Ife8e53cf4d7542525736e7b93ac92f9a2ddcd068 --- .../TaskViewTouchController.java | 36 ++++++++----------- .../android/quickstep/views/RecentsView.java | 10 ++++++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index 180af0bd9f..051485acc6 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -34,7 +34,6 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.touch.SingleAxisSwipeDetector; @@ -158,26 +157,21 @@ public abstract class TaskViewTouchController mTaskBeingDragged = view; int upDirection = mRecentsView.getPagedOrientationHandler() .getUpDirection(mIsRtl); - if (!SysUINavigationMode.getMode(mActivity).hasGestures || ( - mActivity.getDeviceProfile().isTablet - && FeatureFlags.ENABLE_OVERVIEW_GRID.get())) { - // Don't allow swipe down to open if we don't support swipe up - // to enter overview, or when grid layout is enabled. - directionsToDetectScroll = upDirection; - mAllowGoingUp = true; - mAllowGoingDown = false; - } else { - // The task can be dragged up to dismiss it, - // and down to open if it's the current page. - mAllowGoingUp = true; - if (i == mRecentsView.getCurrentPage()) { - mAllowGoingDown = true; - directionsToDetectScroll = DIRECTION_BOTH; - } else { - mAllowGoingDown = false; - directionsToDetectScroll = upDirection; - } - } + + // The task can be dragged up to dismiss it + mAllowGoingUp = true; + + // The task can be dragged down to open it if: + // - It's the current page + // - We support gestures to enter overview + // - It's the focused task if in grid view + // - The task is snapped + mAllowGoingDown = i == mRecentsView.getCurrentPage() + && SysUINavigationMode.getMode(mActivity).hasGestures + && (!mRecentsView.showAsGrid() || mTaskBeingDragged.isFocusedTask()) + && mRecentsView.isTaskSnapped(i); + + directionsToDetectScroll = mAllowGoingDown ? DIRECTION_BOTH : upDirection; break; } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index efac7750d0..411d0d8f77 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -949,6 +949,16 @@ public abstract class RecentsView