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

Commit 9a9c0197 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Handle right back swipe differently for cross task back

Bug: 259429314
Test: Manual, i.e. verifying cross task back animation on device
Change-Id: Ic2913bd5988e98f7fedd8314bbb4a09c654307ed
parent d6afd39e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.back;

import static android.view.RemoteAnimationTarget.MODE_CLOSING;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
import static android.window.BackEvent.EDGE_RIGHT;

import static com.android.internal.jank.InteractionJankMonitor.CUJ_PREDICTIVE_BACK_CROSS_TASK;
import static com.android.wm.shell.back.BackAnimationConstants.UPDATE_SYSUI_FLAGS_THRESHOLD;
@@ -101,6 +102,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation {
    private RemoteAnimationTarget mClosingTarget;
    private final SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction();
    private boolean mBackInProgress = false;
    private boolean mIsRightEdge;
    private final PointF mTouchPos = new PointF();
    private IRemoteAnimationFinishedCallback mFinishCallback;
    private final BackProgressAnimator mProgressAnimator = new BackProgressAnimator();
@@ -172,7 +174,12 @@ public class CrossTaskBackAnimation extends ShellBackAnimation {
        // Move the window along the Y axis.
        float scaledTop = (height - scaledHeight) * 0.5f + deltaY;
        // Move the window along the X axis.
        float right = width - (progress * mVerticalMargin);
        float right;
        if (mIsRightEdge) {
            right = (width - scaledWidth) * 0.5f + scaledWidth;
        } else {
            right = width - (progress * mVerticalMargin);
        }
        float left = right - scaledWidth;

        mClosingCurrentRect.set(left, scaledTop, right, scaledTop + scaledHeight);
@@ -262,6 +269,7 @@ public class CrossTaskBackAnimation extends ShellBackAnimation {

    private void onGestureProgress(@NonNull BackEvent backEvent) {
        if (!mBackInProgress) {
            mIsRightEdge = backEvent.getSwipeEdge() == EDGE_RIGHT;
            mInitialTouchPos.set(backEvent.getTouchX(), backEvent.getTouchY());
            mBackInProgress = true;
        }