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
This commit is contained in:
parent
607969bb06
commit
b117707d31
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -149,6 +149,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
|
|||
|
||||
mDragSlop = NavigationBarCompat.getQuickStepDragSlopPx();
|
||||
mTouchSlop = NavigationBarCompat.getQuickStepTouchSlopPx();
|
||||
|
||||
mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
|
||||
}
|
||||
|
||||
|
|
|
@ -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() &&
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 -->
|
||||
|
|
Loading…
Reference in New Issue