diff options
author | Adam Cohen <adamcohen@google.com> | 2019-04-18 09:32:49 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2019-04-18 12:54:28 -0700 |
commit | b117707d3159e41419357287c2bcb13eebc5977a (patch) | |
tree | 5d2f1ada3a1479f2f5be4db403ef42faf2fc01f7 | |
parent | 607969bb06a46c475091ce1123e3a7dfd662600f (diff) | |
download | packages_apps_Trebuchet-b117707d3159e41419357287c2bcb13eebc5977a.tar.gz packages_apps_Trebuchet-b117707d3159e41419357287c2bcb13eebc5977a.tar.bz2 packages_apps_Trebuchet-b117707d3159e41419357287c2bcb13eebc5977a.zip |
Tune Assistant Gesture
=> bumping detectable region to 48 dp horizontal + vertical within corner
=> centering detectable angle; total 70 degrees (ie. btw 10 off the vertical and 10 off the horizontal)
=> pilfering touch events when slop is passed and assistant gesture is engaged
=> Fixing issue where we were incorrectly using “sharedState” causing incorrect handling of gestures subsequent to AssistantTouchConsumer being invoked (it was forgetting to clear it’s input state and hence reporting “active” when it wasn’t). The symptom was that gestures after the AssistantTouchConsumer would never actually move the active window even though state was being updated; you’d feel the Overview haptic.
=> Devices with large corner radii are still somewhat problematic as the initial touch down often lands high on the display (ie. above the 48 dp region).
Change-Id: I3d5761112f4cb8b7b1eee987de5afe9aee260304
5 files changed, 17 insertions, 5 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java index 7c0791e80..e8651377f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java @@ -41,6 +41,7 @@ import com.android.launcher3.logging.UserEventDispatcher; import com.android.quickstep.util.MotionPauseDetector; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.launcher3.R; +import com.android.systemui.shared.system.InputMonitorCompat; import com.android.systemui.shared.system.NavigationBarCompat; /** @@ -83,8 +84,11 @@ public class AssistantTouchConsumer implements InputConsumer { private final InputConsumer mConsumerDelegate; private final Context mContext; + private final InputMonitorCompat mInputMonitorCompat; + + public AssistantTouchConsumer(Context context, ISystemUiProxy systemUiProxy, - InputConsumer delegate) { + InputConsumer delegate, InputMonitorCompat inputMonitorCompat) { final Resources res = context.getResources(); mContext = context; mSysUiProxy = systemUiProxy; @@ -94,6 +98,7 @@ public class AssistantTouchConsumer implements InputConsumer { mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold); mSlop = NavigationBarCompat.getQuickScrubTouchSlopPx(); + mInputMonitorCompat = inputMonitorCompat; mState = STATE_INACTIVE; } @@ -153,6 +158,10 @@ public class AssistantTouchConsumer implements InputConsumer { if (!mPassedSlop) { // Normal gesture, ensure we pass the slop before we start tracking the gesture if (Math.hypot(mLastPos.x - mDownPos.x, mLastPos.y - mDownPos.y) > mSlop) { + + // Cancel touches to other windows (intercept) + mInputMonitorCompat.pilferPointers(); + mPassedSlop = true; mStartDragPos.set(mLastPos.x, mLastPos.y); mDragTime = SystemClock.uptimeMillis(); @@ -162,7 +171,8 @@ public class AssistantTouchConsumer implements InputConsumer { Math.atan2(mDownPos.y - mLastPos.y, mDownPos.x - mLastPos.x)); mDirection = angle > 90 ? UPLEFT : UPRIGHT; angle = angle > 90 ? 180 - angle : angle; - if (angle > mAngleThreshold) { + + if (angle > mAngleThreshold && angle < 90 - mAngleThreshold) { mState = STATE_ASSISTANT_ACTIVE; if (mConsumerDelegate != null) { @@ -209,6 +219,7 @@ public class AssistantTouchConsumer implements InputConsumer { animator.setInterpolator(Interpolators.DEACCEL_2); animator.start(); } + mState = STATE_INACTIVE; mMotionPauseDetector.clear(); break; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java index 990bcff51..9c8e80e5c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java @@ -149,6 +149,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mDragSlop = NavigationBarCompat.getQuickStepDragSlopPx(); mTouchSlop = NavigationBarCompat.getQuickStepTouchSlopPx(); + mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 6044b61e1..95dea5044 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -461,7 +461,7 @@ public class TouchInteractionService extends Service implements && SysUINavigationMode.INSTANCE.get(this).getMode() == Mode.NO_BUTTON && AssistantTouchConsumer.withinTouchRegion(this, event)) { return new AssistantTouchConsumer(this, mISystemUiProxy, !activityControl.isResumed() - ? createOtherActivityInputConsumer(event, runningTaskInfo) : null); + ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat); } else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) { return OverviewInputConsumer.newInstance(activityControl, false); } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index a96669832..e29d3df27 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -29,5 +29,5 @@ <!-- Assistant Gesture --> <integer name="assistant_gesture_min_time_threshold">200</integer> - <integer name="assistant_gesture_corner_deg_threshold">30</integer> + <integer name="assistant_gesture_corner_deg_threshold">10</integer> </resources> diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index c5a1aca5f..75959d106 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -65,7 +65,7 @@ <dimen name="shelf_surface_offset">24dp</dimen> <!-- Assistant Gestures --> - <dimen name="gestures_assistant_size">28dp</dimen> + <dimen name="gestures_assistant_size">48dp</dimen> <dimen name="gestures_assistant_drag_threshold">70dp</dimen> <!-- Distance to move elements when swiping up to go home from launcher --> |