Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f243ca41 authored by Adam Cohen's avatar Adam Cohen Committed by Android (Google) Code Review
Browse files

Merge "Tune Assistant Gesture" into ub-launcher3-qt-dev

parents ba0ff366 b117707d
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -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;
        }
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC

        mDragSlop = NavigationBarCompat.getQuickStepDragSlopPx();
        mTouchSlop = NavigationBarCompat.getQuickStepTouchSlopPx();

        mPassedTouchSlop = mPassedDragSlop = continuingPreviousGesture;
    }

+1 −1
Original line number Diff line number Diff line
@@ -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() &&
+1 −1
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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 -->