Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationRunner.java +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ class BackAnimationRunner { }; mWaitingAnimation = false; try { mRunner.onAnimationStart(TRANSIT_OLD_UNSET, apps, wallpapers, getRunner().onAnimationStart(TRANSIT_OLD_UNSET, apps, wallpapers, nonApps, callback); } catch (RemoteException e) { Log.w(TAG, "Failed call onAnimationStart", e); Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/TEST_MAPPING 0 → 100644 +32 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "WMShellUnitTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "include-filter": "com.android.wm.shell.back" } ] }, { "name": "CtsWindowManagerDeviceTestCases", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "include-filter": "android.server.wm.BackGestureInvokedTest" }, { "include-filter": "android.server.wm.BackNavigationTests" }, { "include-filter": "android.server.wm.OnBackInvokedCallbackGestureTest" } ] } ] } libs/WindowManager/Shell/tests/unittest/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ android_test { enabled: false, }, test_suites: ["device-tests"], platform_apis: true, certificate: "platform", Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +47 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,53 @@ public class BackAnimationControllerTest extends ShellTestCase { verify(mAnimatorCallback, never()).onBackInvoked(); } @Test public void testBackToActivity() throws RemoteException { final CrossActivityAnimation animation = new CrossActivityAnimation(mContext, mAnimationBackground); verifySystemBackBehavior( BackNavigationInfo.TYPE_CROSS_ACTIVITY, animation.mBackAnimationRunner); } @Test public void testBackToTask() throws RemoteException { final CrossTaskBackAnimation animation = new CrossTaskBackAnimation(mContext, mAnimationBackground); verifySystemBackBehavior( BackNavigationInfo.TYPE_CROSS_TASK, animation.mBackAnimationRunner); } private void verifySystemBackBehavior(int type, BackAnimationRunner animation) throws RemoteException { final BackAnimationRunner animationRunner = spy(animation); final IRemoteAnimationRunner runner = spy(animationRunner.getRunner()); final IOnBackInvokedCallback callback = spy(animationRunner.getCallback()); // Set up the monitoring objects. doNothing().when(runner).onAnimationStart(anyInt(), any(), any(), any(), any()); doReturn(runner).when(animationRunner).getRunner(); doReturn(callback).when(animationRunner).getCallback(); mController.registerAnimation(type, animationRunner); createNavigationInfo(type, true); doMotionEvent(MotionEvent.ACTION_DOWN, 0); // Check that back start and progress is dispatched when first move. doMotionEvent(MotionEvent.ACTION_MOVE, 100); simulateRemoteAnimationStart(type); verify(callback).onBackStarted(any(BackMotionEvent.class)); verify(animationRunner).startAnimation(any(), any(), any(), any()); // Check that back invocation is dispatched. mController.setTriggerBack(true); // Fake trigger back doMotionEvent(MotionEvent.ACTION_UP, 0); verify(callback).onBackInvoked(); } private void doMotionEvent(int actionDown, int coordinate) { mController.onMotionEvent( coordinate, coordinate, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationRunner.java +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ class BackAnimationRunner { }; mWaitingAnimation = false; try { mRunner.onAnimationStart(TRANSIT_OLD_UNSET, apps, wallpapers, getRunner().onAnimationStart(TRANSIT_OLD_UNSET, apps, wallpapers, nonApps, callback); } catch (RemoteException e) { Log.w(TAG, "Failed call onAnimationStart", e); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/TEST_MAPPING 0 → 100644 +32 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "WMShellUnitTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "include-filter": "com.android.wm.shell.back" } ] }, { "name": "CtsWindowManagerDeviceTestCases", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "include-filter": "android.server.wm.BackGestureInvokedTest" }, { "include-filter": "android.server.wm.BackNavigationTests" }, { "include-filter": "android.server.wm.OnBackInvokedCallbackGestureTest" } ] } ] }
libs/WindowManager/Shell/tests/unittest/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ android_test { enabled: false, }, test_suites: ["device-tests"], platform_apis: true, certificate: "platform", Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/back/BackAnimationControllerTest.java +47 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,53 @@ public class BackAnimationControllerTest extends ShellTestCase { verify(mAnimatorCallback, never()).onBackInvoked(); } @Test public void testBackToActivity() throws RemoteException { final CrossActivityAnimation animation = new CrossActivityAnimation(mContext, mAnimationBackground); verifySystemBackBehavior( BackNavigationInfo.TYPE_CROSS_ACTIVITY, animation.mBackAnimationRunner); } @Test public void testBackToTask() throws RemoteException { final CrossTaskBackAnimation animation = new CrossTaskBackAnimation(mContext, mAnimationBackground); verifySystemBackBehavior( BackNavigationInfo.TYPE_CROSS_TASK, animation.mBackAnimationRunner); } private void verifySystemBackBehavior(int type, BackAnimationRunner animation) throws RemoteException { final BackAnimationRunner animationRunner = spy(animation); final IRemoteAnimationRunner runner = spy(animationRunner.getRunner()); final IOnBackInvokedCallback callback = spy(animationRunner.getCallback()); // Set up the monitoring objects. doNothing().when(runner).onAnimationStart(anyInt(), any(), any(), any(), any()); doReturn(runner).when(animationRunner).getRunner(); doReturn(callback).when(animationRunner).getCallback(); mController.registerAnimation(type, animationRunner); createNavigationInfo(type, true); doMotionEvent(MotionEvent.ACTION_DOWN, 0); // Check that back start and progress is dispatched when first move. doMotionEvent(MotionEvent.ACTION_MOVE, 100); simulateRemoteAnimationStart(type); verify(callback).onBackStarted(any(BackMotionEvent.class)); verify(animationRunner).startAnimation(any(), any(), any(), any()); // Check that back invocation is dispatched. mController.setTriggerBack(true); // Fake trigger back doMotionEvent(MotionEvent.ACTION_UP, 0); verify(callback).onBackInvoked(); } private void doMotionEvent(int actionDown, int coordinate) { mController.onMotionEvent( coordinate, coordinate, Loading