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

Commit 74304dfa authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Update swipe edge of BackTouchTracker in onMove

When performing a back gesture with the trackpad, it's not clear from
the beginning, which edge the gesture is performed on. Therefore, this
CL updates the swipe edge in BackTouchTracker in onMove, such that
clients of BackAnimation can update the swipe edge after the gesture
tracking has already started.

Bug: 301195601
Test: Manual, i.e. verified that predictive back animations animate as
      expected when using the trackpad back gesture
Flag: com.android.systemui.predictive_back_delay_wm_transition
Change-Id: I2e1fbddef8280c91b7d996b26726bd41a7d13a5b
parent e13a95bb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -135,6 +135,16 @@ public class BackTouchTracker {
        mShouldUpdateStartLocation = false;
    }

    /**
     * Updates the swipe edge. This is useful when it's not clear yet which swipe edge the gesture
     * is performed on from the start of the gesture (for example trackpad back gestures).
     *
     * @param swipeEdge the updated swipeEdge value
     */
    public void updateSwipeEdge(@BackEvent.SwipeEdge int swipeEdge) {
        mSwipeEdge = swipeEdge;
    }

    /** Resets the tracker. */
    public void reset() {
        mInitTouchX = 0;
+5 −2
Original line number Diff line number Diff line
@@ -524,7 +524,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                onGestureStarted(touchX, touchY, swipeEdge);
                mShouldStartOnNextMoveEvent = false;
            }
            onMove();
            onMove(swipeEdge);
        } else if (keyAction == MotionEvent.ACTION_UP || keyAction == MotionEvent.ACTION_CANCEL) {
            ProtoLog.d(WM_SHELL_BACK_PREVIEW,
                    "Finishing gesture with event action: %d", keyAction);
@@ -620,7 +620,10 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        }
    }

    private void onMove() {
    private void onMove(@BackEvent.SwipeEdge int swipeEdge) {
        if (predictiveBackDelayWmTransition() && mCurrentTracker.isActive()) {
            mCurrentTracker.updateSwipeEdge(swipeEdge);
        }
        if (!mBackGestureStarted
                || mBackNavigationInfo == null
                || mActiveCallback == null