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

Commit 48aab91f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix several bugs in back animation handoff." into main

parents d4337b34 f0a5c56d
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -731,6 +731,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            callback.onBackStarted(backEvent);
            if (mBackTransitionHandler.canHandOffAnimation()) {
                callback.setHandoffHandler(mHandoffHandler);
            } else {
                callback.setHandoffHandler(null);
            }
            mOnBackStartDispatched = true;
        } catch (RemoteException e) {
@@ -1273,14 +1275,6 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                @NonNull SurfaceControl.Transaction st,
                @NonNull SurfaceControl.Transaction ft,
                @NonNull Transitions.TransitionFinishCallback finishCallback) {
            final boolean isPrepareTransition =
                    info.getType() == WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION;
            if (isPrepareTransition) {
                if (checkTakeoverFlags()) {
                    mTakeoverHandler = mTransitions.getHandlerForTakeover(transition, info);
                }
                kickStartAnimation();
            }
            // Both mShellExecutor and Transitions#mMainExecutor are ShellMainThread, so we don't
            // need to post to ShellExecutor when called.
            if (info.getType() == WindowManager.TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION) {
@@ -1308,7 +1302,8 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                    // animation never start, consume directly
                    applyAndFinish(st, ft, finishCallback);
                    return true;
                } else if (mClosePrepareTransition == null && isPrepareTransition) {
                } else if (mClosePrepareTransition == null
                        && info.getType() == WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION) {
                    // Gesture animation was cancelled before prepare transition ready, create
                    // the close prepare transition
                    createClosePrepareTransition();
@@ -1316,6 +1311,10 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
            }

            if (handlePrepareTransition(info, st, ft, finishCallback)) {
                if (checkTakeoverFlags()) {
                    mTakeoverHandler = mTransitions.getHandlerForTakeover(transition, info);
                }
                kickStartAnimation();
                return true;
            }
            return handleCloseTransition(info, st, ft, finishCallback);
+4 −2
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -634,7 +636,7 @@ public class BackAnimationControllerTest extends ShellTestCase {
        releaseBackGesture();
        mShellExecutor.flushAll();

        verify(mAppCallback).setHandoffHandler(any());
        verify(mAppCallback).setHandoffHandler(notNull());
    }

    @Test
@@ -654,7 +656,7 @@ public class BackAnimationControllerTest extends ShellTestCase {
        releaseBackGesture();
        mShellExecutor.flushAll();

        verify(mAppCallback, never()).setHandoffHandler(any());
        verify(mAppCallback).setHandoffHandler(isNull());
    }

    @Test