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

Commit 29cad33d authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Abort the predictive back animation if another transition occurs." into main

parents 91487ea0 88b422e0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -379,8 +379,9 @@ interface IActivityTaskManager {
    /**
     * This setups the leashed for sysui to animate the current back gesture.
     * Only valid after startBackNavigation.
     * @return Returns whether system can prepare back animation.
     */
    void startPredictiveBackAnimation();
    boolean startPredictiveBackAnimation();

    /**
     * registers a callback to be invoked when a background activity launch is aborted.
+6 −1
Original line number Diff line number Diff line
@@ -482,10 +482,15 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            if (!shouldDispatchToAnimator()) {
                return;
            }
            boolean started;
            try {
                mActivityTaskManager.startPredictiveBackAnimation();
                started = mActivityTaskManager.startPredictiveBackAnimation();
            } catch (RemoteException r) {
                Log.e(TAG, "Failed to start predictive animation", r);
                started = false;
            }
            if (!started) {
                ProtoLog.d(WM_SHELL_BACK_PREVIEW, "Failed to start predictive back animation.");
                finishBackNavigation(mCurrentTracker.getTriggerBack());
                return;
            }
+1 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class BackAnimationControllerTest extends ShellTestCase {
        mController.mTouchableArea.set(mTouchableRegion);
        mBackTransitionHandler = mController.mBackTransitionHandler;
        spyOn(mBackTransitionHandler);
        doReturn(true).when(mActivityTaskManager).startPredictiveBackAnimation();
    }

    private void createNavigationInfo(int backType,
+2 −2
Original line number Diff line number Diff line
@@ -1897,12 +1897,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    }

    @Override
    public void startPredictiveBackAnimation() {
    public boolean startPredictiveBackAnimation() {
        mAmInternal.enforceCallingPermission(START_TASKS_FROM_RECENTS,
                "startPredictiveBackAnimation()");
        final long origId = Binder.clearCallingIdentity();
        try {
            mBackNavigationController.startPredictiveBackAnimation();
            return mBackNavigationController.startPredictiveBackAnimation();
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
+7 −2
Original line number Diff line number Diff line
@@ -128,15 +128,20 @@ class BackNavigationController {
     * Set up the necessary leashes for predictive back animation based on previous
     * startBackNavigation state.
     */
    void startPredictiveBackAnimation() {
    boolean startPredictiveBackAnimation() {
        synchronized (mWindowManagerService.mGlobalLock) {
            if (mCurrentAnimationBuilder == null) {
                return;
                return false;
            }
            if (mWindowManagerService.mAtmService.getTransitionController().inTransition()) {
                mCurrentAnimationBuilder = null;
                return false;
            }
            final AnimationHandler.ScheduleAnimationBuilder tmp = mCurrentAnimationBuilder;
            mCurrentAnimationBuilder = null;
            scheduleAnimationInner(tmp);
        }
        return true;
    }

    /**