Merge "Remove failsafe runnable once the animation finishes." into pi-dev

This commit is contained in:
Winson Chung
2018-05-10 21:33:53 +00:00
committed by Android (Google) Code Review
2 changed files with 26 additions and 0 deletions

View File

@@ -426,9 +426,13 @@ public class RecentsAnimationController implements DeathRecipient {
removeAnimation(taskAdapter); removeAnimation(taskAdapter);
} }
// Clear any pending failsafe runnables
mService.mH.removeCallbacks(mFailsafeRunnable);
// Clear references to the runner // Clear references to the runner
unlinkToDeathOfRunner(); unlinkToDeathOfRunner();
mRunner = null; mRunner = null;
mCanceled = true;
// Clear associated input consumers // Clear associated input consumers
mService.mInputMonitor.updateInputWindowsLw(true /*force*/); mService.mInputMonitor.updateInputWindowsLw(true /*force*/);

View File

@@ -19,6 +19,9 @@ package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;
import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@@ -82,6 +85,25 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
verifyNoMoreInteractionsExceptAsBinder(mMockRunner); verifyNoMoreInteractionsExceptAsBinder(mMockRunner);
} }
@Test
public void testCancelAfterRemove_expectIgnored() throws Exception {
final AppWindowToken appWindow = createAppWindowToken(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
AnimationAdapter adapter = mController.addAnimation(appWindow.getTask(),
false /* isRecentTaskInvisible */);
adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback);
// Remove the app window so that the animation target can not be created
appWindow.removeImmediately();
mController.startAnimation();
mController.cleanupAnimation(REORDER_KEEP_IN_PLACE);
try {
mController.cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "test");
} catch (Exception e) {
fail("Unexpected failure when canceling animation after finishing it");
}
}
private static void verifyNoMoreInteractionsExceptAsBinder(IInterface binder) { private static void verifyNoMoreInteractionsExceptAsBinder(IInterface binder) {
verify(binder, atLeast(0)).asBinder(); verify(binder, atLeast(0)).asBinder();
verifyNoMoreInteractions(binder); verifyNoMoreInteractions(binder);