Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +16 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,22 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return mRoundedContentBounds.forDisplay(change.getEndDisplayId()); } @Override public boolean startAnimation(@NonNull IBinder transition, @Nullable TransitionInfo info, @NonNull TransitionDispatchState dispatchState, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { if (info == null) { // In data collection mode: there can't be errors - nothing to do return false; } // In animation mode: always play everything return startAnimation( transition, info, startTransaction, finishTransaction, finishCallback); } @Override public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startTransaction, Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java +39 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import static android.window.TransitionInfo.FLAG_SYNC; import static android.window.TransitionInfo.FLAG_TRANSLUCENT; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; Loading @@ -39,6 +41,7 @@ import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.util.Log; import android.view.SurfaceControl; import android.view.animation.AlphaAnimation; import android.window.TransitionInfo; Loading Loading @@ -90,6 +93,8 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { private RootTaskDisplayAreaOrganizer mRootTaskDisplayAreaOrganizer; private DefaultTransitionHandler mTransitionHandler; static final String TAG = "DefaultHandlerTest"; @Before public void setUp() { mShellInit = new ShellInit(mMainExecutor); Loading Loading @@ -268,6 +273,40 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { verify(startT, never()).reparent(any(), any()); } @Test public void startAnimation_neverFindsErrors_animationMode() { final TransitionInfo info = mock(TransitionInfo.class); final IBinder token = mock(Binder.class); TransitionDispatchState dispatchState = new TransitionDispatchState(token, info); boolean hasPlayed = mTransitionHandler .startAnimation(token, info, dispatchState, MockTransactionPool.create(), MockTransactionPool.create(), mock(Transitions.TransitionFinishCallback.class)); Log.v(TAG, "dispatchState: \n" + dispatchState.getDebugInfo()); assertTrue(hasPlayed); assertFalse(dispatchState.hasErrors(mTransitionHandler)); } @Test public void startAnimation_neverFindsErrors_dataCollectionMode() { final TransitionInfo info = mock(TransitionInfo.class); final IBinder token = mock(Binder.class); TransitionDispatchState dispatchState = new TransitionDispatchState(token, info); boolean hasPlayed = mTransitionHandler .startAnimation(token, null, dispatchState, MockTransactionPool.create(), MockTransactionPool.create(), mock(Transitions.TransitionFinishCallback.class)); Log.v(TAG, "dispatchState: \n" + dispatchState.getDebugInfo()); assertFalse(hasPlayed); assertFalse(dispatchState.hasErrors(mTransitionHandler)); } @Test public void startAnimation_freeform_minimizeAnimation_reparentsTask() { final TransitionInfo.Change openChange = new ChangeBuilder(TRANSIT_OPEN) Loading Loading @@ -316,4 +355,3 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { return taskInfo; } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +16 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,22 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return mRoundedContentBounds.forDisplay(change.getEndDisplayId()); } @Override public boolean startAnimation(@NonNull IBinder transition, @Nullable TransitionInfo info, @NonNull TransitionDispatchState dispatchState, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { if (info == null) { // In data collection mode: there can't be errors - nothing to do return false; } // In animation mode: always play everything return startAnimation( transition, info, startTransaction, finishTransaction, finishCallback); } @Override public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startTransaction, Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java +39 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import static android.window.TransitionInfo.FLAG_SYNC; import static android.window.TransitionInfo.FLAG_TRANSLUCENT; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; Loading @@ -39,6 +41,7 @@ import android.os.Binder; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.util.Log; import android.view.SurfaceControl; import android.view.animation.AlphaAnimation; import android.window.TransitionInfo; Loading Loading @@ -90,6 +93,8 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { private RootTaskDisplayAreaOrganizer mRootTaskDisplayAreaOrganizer; private DefaultTransitionHandler mTransitionHandler; static final String TAG = "DefaultHandlerTest"; @Before public void setUp() { mShellInit = new ShellInit(mMainExecutor); Loading Loading @@ -268,6 +273,40 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { verify(startT, never()).reparent(any(), any()); } @Test public void startAnimation_neverFindsErrors_animationMode() { final TransitionInfo info = mock(TransitionInfo.class); final IBinder token = mock(Binder.class); TransitionDispatchState dispatchState = new TransitionDispatchState(token, info); boolean hasPlayed = mTransitionHandler .startAnimation(token, info, dispatchState, MockTransactionPool.create(), MockTransactionPool.create(), mock(Transitions.TransitionFinishCallback.class)); Log.v(TAG, "dispatchState: \n" + dispatchState.getDebugInfo()); assertTrue(hasPlayed); assertFalse(dispatchState.hasErrors(mTransitionHandler)); } @Test public void startAnimation_neverFindsErrors_dataCollectionMode() { final TransitionInfo info = mock(TransitionInfo.class); final IBinder token = mock(Binder.class); TransitionDispatchState dispatchState = new TransitionDispatchState(token, info); boolean hasPlayed = mTransitionHandler .startAnimation(token, null, dispatchState, MockTransactionPool.create(), MockTransactionPool.create(), mock(Transitions.TransitionFinishCallback.class)); Log.v(TAG, "dispatchState: \n" + dispatchState.getDebugInfo()); assertFalse(hasPlayed); assertFalse(dispatchState.hasErrors(mTransitionHandler)); } @Test public void startAnimation_freeform_minimizeAnimation_reparentsTask() { final TransitionInfo.Change openChange = new ChangeBuilder(TRANSIT_OPEN) Loading Loading @@ -316,4 +355,3 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { return taskInfo; } }