Loading quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java +16 −17 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.anim.Interpolators; 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; Loading Loading @@ -82,7 +81,6 @@ public class AssistantTouchConsumer implements InputConsumer { private final long mTimeThreshold; private final int mAngleThreshold; private final float mSlop; private final MotionPauseDetector mMotionPauseDetector; private final ISystemUiProxy mSysUiProxy; private final InputConsumer mConsumerDelegate; private final Context mContext; Loading @@ -96,11 +94,10 @@ public class AssistantTouchConsumer implements InputConsumer { mContext = context; mSysUiProxy = systemUiProxy; mConsumerDelegate = delegate; mMotionPauseDetector = new MotionPauseDetector(context); mDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold); mSlop = NavigationBarCompat.getQuickScrubTouchSlopPx(); mSlop = NavigationBarCompat.getQuickStepDragSlopPx(); mInputMonitorCompat = inputMonitorCompat; mState = STATE_INACTIVE; } Loading @@ -111,8 +108,18 @@ public class AssistantTouchConsumer implements InputConsumer { } @Override public boolean isActive() { return mState != STATE_INACTIVE; public boolean useSharedSwipeState() { if (mConsumerDelegate != null) { return mConsumerDelegate.useSharedSwipeState(); } return false; } @Override public void onConsumerAboutToBeSwitched() { if (mConsumerDelegate != null) { mConsumerDelegate.onConsumerAboutToBeSwitched(); } } @Override Loading @@ -125,14 +132,6 @@ public class AssistantTouchConsumer implements InputConsumer { mDownPos.set(ev.getX(), ev.getY()); mLastPos.set(mDownPos); mTimeFraction = 0; // Detect when the gesture decelerates to start the assistant mMotionPauseDetector.setOnMotionPauseListener(isPaused -> { if (isPaused && mState == STATE_ASSISTANT_ACTIVE) { mTimeFraction = 1; updateAssistantProgress(); } }); break; } case ACTION_POINTER_UP: { Loading Loading @@ -175,7 +174,7 @@ public class AssistantTouchConsumer implements InputConsumer { mDirection = angle > 90 ? UPLEFT : UPRIGHT; angle = angle > 90 ? 180 - angle : angle; if (angle > mAngleThreshold && angle < 90 - mAngleThreshold) { if (angle > mAngleThreshold && angle < 90) { mState = STATE_ASSISTANT_ACTIVE; if (mConsumerDelegate != null) { Loading @@ -193,7 +192,6 @@ public class AssistantTouchConsumer implements InputConsumer { // Movement mDistance = (float) Math.hypot(mLastPos.x - mStartDragPos.x, mLastPos.y - mStartDragPos.y); mMotionPauseDetector.addPosition(mDistance, 0, ev.getEventTime()); if (mDistance >= 0) { final long diff = SystemClock.uptimeMillis() - mDragTime; mTimeFraction = Math.min(diff * 1f / mTimeThreshold, 1); Loading Loading @@ -222,8 +220,8 @@ public class AssistantTouchConsumer implements InputConsumer { animator.setInterpolator(Interpolators.DEACCEL_2); animator.start(); } mPassedSlop = false; mState = STATE_INACTIVE; mMotionPauseDetector.clear(); break; } Loading @@ -243,6 +241,7 @@ public class AssistantTouchConsumer implements InputConsumer { SWIPE, mDirection, NAVBAR); Bundle args = new Bundle(); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE); mSysUiProxy.startAssistant(args); mLaunchedAssistant = true; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/InputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ public interface InputConsumer { int getType(); default boolean isActive() { default boolean useSharedSwipeState() { return false; } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } @Override public boolean isActive() { public boolean useSharedSwipeState() { return mInteractionHandler != null; } } quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +7 −3 Original line number Diff line number Diff line Loading @@ -422,7 +422,7 @@ public class TouchInteractionService extends Service implements if (event.getAction() == ACTION_DOWN) { if (isInValidSystemUiState() && mSwipeTouchRegion.contains(event.getX(), event.getY())) { boolean useSharedState = mConsumer.isActive(); boolean useSharedState = mConsumer.useSharedSwipeState(); mConsumer.onConsumerAboutToBeSwitched(); mConsumer = newConsumer(useSharedState, event); TOUCH_INTERACTION_LOG.addLog("setInputConsumer", mConsumer.getType()); Loading Loading @@ -460,8 +460,12 @@ public class TouchInteractionService extends Service implements } else if (mAssistantAvailable && SysUINavigationMode.INSTANCE.get(this).getMode() == Mode.NO_BUTTON && AssistantTouchConsumer.withinTouchRegion(this, event)) { return new AssistantTouchConsumer(this, mISystemUiProxy, !activityControl.isResumed() ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat); boolean addDelegate = !activityControl.isResumed(); return new AssistantTouchConsumer(this, mISystemUiProxy, addDelegate ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat); } else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) { return OverviewInputConsumer.newInstance(activityControl, false); } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && Loading quickstep/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -29,5 +29,5 @@ <!-- Assistant Gesture --> <integer name="assistant_gesture_min_time_threshold">200</integer> <integer name="assistant_gesture_corner_deg_threshold">10</integer> <integer name="assistant_gesture_corner_deg_threshold">20</integer> </resources> Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/AssistantTouchConsumer.java +16 −17 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import android.util.Log; import android.view.MotionEvent; import com.android.launcher3.anim.Interpolators; 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; Loading Loading @@ -82,7 +81,6 @@ public class AssistantTouchConsumer implements InputConsumer { private final long mTimeThreshold; private final int mAngleThreshold; private final float mSlop; private final MotionPauseDetector mMotionPauseDetector; private final ISystemUiProxy mSysUiProxy; private final InputConsumer mConsumerDelegate; private final Context mContext; Loading @@ -96,11 +94,10 @@ public class AssistantTouchConsumer implements InputConsumer { mContext = context; mSysUiProxy = systemUiProxy; mConsumerDelegate = delegate; mMotionPauseDetector = new MotionPauseDetector(context); mDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold); mSlop = NavigationBarCompat.getQuickScrubTouchSlopPx(); mSlop = NavigationBarCompat.getQuickStepDragSlopPx(); mInputMonitorCompat = inputMonitorCompat; mState = STATE_INACTIVE; } Loading @@ -111,8 +108,18 @@ public class AssistantTouchConsumer implements InputConsumer { } @Override public boolean isActive() { return mState != STATE_INACTIVE; public boolean useSharedSwipeState() { if (mConsumerDelegate != null) { return mConsumerDelegate.useSharedSwipeState(); } return false; } @Override public void onConsumerAboutToBeSwitched() { if (mConsumerDelegate != null) { mConsumerDelegate.onConsumerAboutToBeSwitched(); } } @Override Loading @@ -125,14 +132,6 @@ public class AssistantTouchConsumer implements InputConsumer { mDownPos.set(ev.getX(), ev.getY()); mLastPos.set(mDownPos); mTimeFraction = 0; // Detect when the gesture decelerates to start the assistant mMotionPauseDetector.setOnMotionPauseListener(isPaused -> { if (isPaused && mState == STATE_ASSISTANT_ACTIVE) { mTimeFraction = 1; updateAssistantProgress(); } }); break; } case ACTION_POINTER_UP: { Loading Loading @@ -175,7 +174,7 @@ public class AssistantTouchConsumer implements InputConsumer { mDirection = angle > 90 ? UPLEFT : UPRIGHT; angle = angle > 90 ? 180 - angle : angle; if (angle > mAngleThreshold && angle < 90 - mAngleThreshold) { if (angle > mAngleThreshold && angle < 90) { mState = STATE_ASSISTANT_ACTIVE; if (mConsumerDelegate != null) { Loading @@ -193,7 +192,6 @@ public class AssistantTouchConsumer implements InputConsumer { // Movement mDistance = (float) Math.hypot(mLastPos.x - mStartDragPos.x, mLastPos.y - mStartDragPos.y); mMotionPauseDetector.addPosition(mDistance, 0, ev.getEventTime()); if (mDistance >= 0) { final long diff = SystemClock.uptimeMillis() - mDragTime; mTimeFraction = Math.min(diff * 1f / mTimeThreshold, 1); Loading Loading @@ -222,8 +220,8 @@ public class AssistantTouchConsumer implements InputConsumer { animator.setInterpolator(Interpolators.DEACCEL_2); animator.start(); } mPassedSlop = false; mState = STATE_INACTIVE; mMotionPauseDetector.clear(); break; } Loading @@ -243,6 +241,7 @@ public class AssistantTouchConsumer implements InputConsumer { SWIPE, mDirection, NAVBAR); Bundle args = new Bundle(); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE); mSysUiProxy.startAssistant(args); mLaunchedAssistant = true; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/InputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ public interface InputConsumer { int getType(); default boolean isActive() { default boolean useSharedSwipeState() { return false; } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/OtherActivityInputConsumer.java +1 −1 Original line number Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } @Override public boolean isActive() { public boolean useSharedSwipeState() { return mInteractionHandler != null; } }
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +7 −3 Original line number Diff line number Diff line Loading @@ -422,7 +422,7 @@ public class TouchInteractionService extends Service implements if (event.getAction() == ACTION_DOWN) { if (isInValidSystemUiState() && mSwipeTouchRegion.contains(event.getX(), event.getY())) { boolean useSharedState = mConsumer.isActive(); boolean useSharedState = mConsumer.useSharedSwipeState(); mConsumer.onConsumerAboutToBeSwitched(); mConsumer = newConsumer(useSharedState, event); TOUCH_INTERACTION_LOG.addLog("setInputConsumer", mConsumer.getType()); Loading Loading @@ -460,8 +460,12 @@ public class TouchInteractionService extends Service implements } else if (mAssistantAvailable && SysUINavigationMode.INSTANCE.get(this).getMode() == Mode.NO_BUTTON && AssistantTouchConsumer.withinTouchRegion(this, event)) { return new AssistantTouchConsumer(this, mISystemUiProxy, !activityControl.isResumed() ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat); boolean addDelegate = !activityControl.isResumed(); return new AssistantTouchConsumer(this, mISystemUiProxy, addDelegate ? createOtherActivityInputConsumer(event, runningTaskInfo) : null, mInputMonitorCompat); } else if (mSwipeSharedState.goingToLauncher || activityControl.isResumed()) { return OverviewInputConsumer.newInstance(activityControl, false); } else if (ENABLE_QUICKSTEP_LIVE_TILE.get() && Loading
quickstep/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -29,5 +29,5 @@ <!-- Assistant Gesture --> <integer name="assistant_gesture_min_time_threshold">200</integer> <integer name="assistant_gesture_corner_deg_threshold">10</integer> <integer name="assistant_gesture_corner_deg_threshold">20</integer> </resources>