Loading services/core/java/com/android/server/wm/AppWindowToken.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -1698,7 +1698,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree stack.getBounds(mTmpRect); stack.getBounds(mTmpRect); mTmpRect.offsetTo(0, 0); mTmpRect.offsetTo(0, 0); } } if (mService.mAppTransition.getRemoteAnimationController() != null) { // Delaying animation start isn't compatible with remote animations at all. if (mService.mAppTransition.getRemoteAnimationController() != null && !mSurfaceAnimator.isAnimationStartDelayed()) { adapter = mService.mAppTransition.getRemoteAnimationController() adapter = mService.mAppTransition.getRemoteAnimationController() .createAnimationAdapter(this, mTmpPoint, mTmpRect); .createAnimationAdapter(this, mTmpPoint, mTmpRect); } else { } else { Loading services/core/java/com/android/server/wm/RemoteAnimationController.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,10 @@ class RemoteAnimationController { mFinishedCallback = new FinishedCallback(this); mFinishedCallback = new FinishedCallback(this); final RemoteAnimationTarget[] animations = createAnimations(); final RemoteAnimationTarget[] animations = createAnimations(); if (animations.length == 0) { onAnimationFinished(); return; } mService.mAnimator.addAfterPrepareSurfacesRunnable(() -> { mService.mAnimator.addAfterPrepareSurfacesRunnable(() -> { try { try { mRemoteAnimationAdapter.getRunner().onAnimationStart(animations, mRemoteAnimationAdapter.getRunner().onAnimationStart(animations, Loading Loading @@ -132,6 +136,8 @@ class RemoteAnimationController { mPendingAnimations.get(i).createRemoteAppAnimation(); mPendingAnimations.get(i).createRemoteAppAnimation(); if (target != null) { if (target != null) { targets.add(target); targets.add(target); } else { mPendingAnimations.remove(i); } } } } return targets.toArray(new RemoteAnimationTarget[targets.size()]); return targets.toArray(new RemoteAnimationTarget[targets.size()]); Loading Loading @@ -225,10 +231,8 @@ class RemoteAnimationController { RemoteAnimationTarget createRemoteAppAnimation() { RemoteAnimationTarget createRemoteAppAnimation() { final Task task = mAppWindowToken.getTask(); final Task task = mAppWindowToken.getTask(); final WindowState mainWindow = mAppWindowToken.findMainWindow(); final WindowState mainWindow = mAppWindowToken.findMainWindow(); if (task == null) { if (task == null || mainWindow == null || mCapturedFinishCallback == null return null; || mCapturedLeash == null) { } if (mainWindow == null) { return null; return null; } } mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(), mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(), Loading services/core/java/com/android/server/wm/SurfaceAnimator.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -234,6 +234,10 @@ class SurfaceAnimator { mService.mAnimationTransferMap.put(mAnimation, this); mService.mAnimationTransferMap.put(mAnimation, this); } } boolean isAnimationStartDelayed() { return mAnimationStartDelayed; } /** /** * Cancels the animation, and resets the leash. * Cancels the animation, and resets the leash. * * Loading services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java +31 −1 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { super.setUp(); super.setUp(); MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); mAdapter = new RemoteAnimationAdapter(mMockRunner, 100, 50); mAdapter = new RemoteAnimationAdapter(mMockRunner, 100, 50); mAdapter.setCallingPid(123); sWm.mH.runWithScissors(() -> { sWm.mH.runWithScissors(() -> { mHandler = new TestHandler(null, mClock); mHandler = new TestHandler(null, mClock); }, 0); }, 0); Loading @@ -83,7 +84,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { new Point(50, 100), new Rect(50, 100, 150, 150)); new Point(50, 100), new Rect(50, 100, 150, 150)); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); mController.goodToGo(); mController.goodToGo(); sWm.mAnimator.executeAfterPrepareSurfacesRunnables(); final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = ArgumentCaptor.forClass(RemoteAnimationTarget[].class); ArgumentCaptor.forClass(RemoteAnimationTarget[].class); final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = Loading Loading @@ -167,4 +168,33 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { mController.goodToGo(); mController.goodToGo(); verifyZeroInteractions(mMockRunner); verifyZeroInteractions(mMockRunner); } } @Test public void testNotReallyStarted() throws Exception { final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin"); mController.createAnimationAdapter(win.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); mController.goodToGo(); verifyZeroInteractions(mMockRunner); } @Test public void testOneNotStarted() throws Exception { final WindowState win1 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin1"); final WindowState win2 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin2"); mController.createAnimationAdapter(win1.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); final AnimationAdapter adapter = mController.createAnimationAdapter(win2.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); mController.goodToGo(); sWm.mAnimator.executeAfterPrepareSurfacesRunnables(); final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = ArgumentCaptor.forClass(RemoteAnimationTarget[].class); final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = ArgumentCaptor.forClass(IRemoteAnimationFinishedCallback.class); verify(mMockRunner).onAnimationStart(appsCaptor.capture(), finishedCaptor.capture()); assertEquals(1, appsCaptor.getValue().length); assertEquals(mMockLeash, appsCaptor.getValue()[0].leash); } } } services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,7 @@ public class SurfaceAnimatorTest extends WindowTestsBase { mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */); verifyZeroInteractions(mSpec); verifyZeroInteractions(mSpec); assertAnimating(mAnimatable); assertAnimating(mAnimatable); assertTrue(mAnimatable.mSurfaceAnimator.isAnimationStartDelayed()); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); verify(mSpec).startAnimation(any(), any(), any()); verify(mSpec).startAnimation(any(), any(), any()); } } Loading Loading
services/core/java/com/android/server/wm/AppWindowToken.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -1698,7 +1698,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree stack.getBounds(mTmpRect); stack.getBounds(mTmpRect); mTmpRect.offsetTo(0, 0); mTmpRect.offsetTo(0, 0); } } if (mService.mAppTransition.getRemoteAnimationController() != null) { // Delaying animation start isn't compatible with remote animations at all. if (mService.mAppTransition.getRemoteAnimationController() != null && !mSurfaceAnimator.isAnimationStartDelayed()) { adapter = mService.mAppTransition.getRemoteAnimationController() adapter = mService.mAppTransition.getRemoteAnimationController() .createAnimationAdapter(this, mTmpPoint, mTmpRect); .createAnimationAdapter(this, mTmpPoint, mTmpRect); } else { } else { Loading
services/core/java/com/android/server/wm/RemoteAnimationController.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -99,6 +99,10 @@ class RemoteAnimationController { mFinishedCallback = new FinishedCallback(this); mFinishedCallback = new FinishedCallback(this); final RemoteAnimationTarget[] animations = createAnimations(); final RemoteAnimationTarget[] animations = createAnimations(); if (animations.length == 0) { onAnimationFinished(); return; } mService.mAnimator.addAfterPrepareSurfacesRunnable(() -> { mService.mAnimator.addAfterPrepareSurfacesRunnable(() -> { try { try { mRemoteAnimationAdapter.getRunner().onAnimationStart(animations, mRemoteAnimationAdapter.getRunner().onAnimationStart(animations, Loading Loading @@ -132,6 +136,8 @@ class RemoteAnimationController { mPendingAnimations.get(i).createRemoteAppAnimation(); mPendingAnimations.get(i).createRemoteAppAnimation(); if (target != null) { if (target != null) { targets.add(target); targets.add(target); } else { mPendingAnimations.remove(i); } } } } return targets.toArray(new RemoteAnimationTarget[targets.size()]); return targets.toArray(new RemoteAnimationTarget[targets.size()]); Loading Loading @@ -225,10 +231,8 @@ class RemoteAnimationController { RemoteAnimationTarget createRemoteAppAnimation() { RemoteAnimationTarget createRemoteAppAnimation() { final Task task = mAppWindowToken.getTask(); final Task task = mAppWindowToken.getTask(); final WindowState mainWindow = mAppWindowToken.findMainWindow(); final WindowState mainWindow = mAppWindowToken.findMainWindow(); if (task == null) { if (task == null || mainWindow == null || mCapturedFinishCallback == null return null; || mCapturedLeash == null) { } if (mainWindow == null) { return null; return null; } } mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(), mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(), Loading
services/core/java/com/android/server/wm/SurfaceAnimator.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -234,6 +234,10 @@ class SurfaceAnimator { mService.mAnimationTransferMap.put(mAnimation, this); mService.mAnimationTransferMap.put(mAnimation, this); } } boolean isAnimationStartDelayed() { return mAnimationStartDelayed; } /** /** * Cancels the animation, and resets the leash. * Cancels the animation, and resets the leash. * * Loading
services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java +31 −1 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { super.setUp(); super.setUp(); MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this); mAdapter = new RemoteAnimationAdapter(mMockRunner, 100, 50); mAdapter = new RemoteAnimationAdapter(mMockRunner, 100, 50); mAdapter.setCallingPid(123); sWm.mH.runWithScissors(() -> { sWm.mH.runWithScissors(() -> { mHandler = new TestHandler(null, mClock); mHandler = new TestHandler(null, mClock); }, 0); }, 0); Loading @@ -83,7 +84,7 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { new Point(50, 100), new Rect(50, 100, 150, 150)); new Point(50, 100), new Rect(50, 100, 150, 150)); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); mController.goodToGo(); mController.goodToGo(); sWm.mAnimator.executeAfterPrepareSurfacesRunnables(); final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = ArgumentCaptor.forClass(RemoteAnimationTarget[].class); ArgumentCaptor.forClass(RemoteAnimationTarget[].class); final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = Loading Loading @@ -167,4 +168,33 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { mController.goodToGo(); mController.goodToGo(); verifyZeroInteractions(mMockRunner); verifyZeroInteractions(mMockRunner); } } @Test public void testNotReallyStarted() throws Exception { final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin"); mController.createAnimationAdapter(win.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); mController.goodToGo(); verifyZeroInteractions(mMockRunner); } @Test public void testOneNotStarted() throws Exception { final WindowState win1 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin1"); final WindowState win2 = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin2"); mController.createAnimationAdapter(win1.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); final AnimationAdapter adapter = mController.createAnimationAdapter(win2.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); mController.goodToGo(); sWm.mAnimator.executeAfterPrepareSurfacesRunnables(); final ArgumentCaptor<RemoteAnimationTarget[]> appsCaptor = ArgumentCaptor.forClass(RemoteAnimationTarget[].class); final ArgumentCaptor<IRemoteAnimationFinishedCallback> finishedCaptor = ArgumentCaptor.forClass(IRemoteAnimationFinishedCallback.class); verify(mMockRunner).onAnimationStart(appsCaptor.capture(), finishedCaptor.capture()); assertEquals(1, appsCaptor.getValue().length); assertEquals(mMockLeash, appsCaptor.getValue()[0].leash); } } }
services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -134,6 +134,7 @@ public class SurfaceAnimatorTest extends WindowTestsBase { mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */); mAnimatable.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */); verifyZeroInteractions(mSpec); verifyZeroInteractions(mSpec); assertAnimating(mAnimatable); assertAnimating(mAnimatable); assertTrue(mAnimatable.mSurfaceAnimator.isAnimationStartDelayed()); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); mAnimatable.mSurfaceAnimator.endDelayingAnimationStart(); verify(mSpec).startAnimation(any(), any(), any()); verify(mSpec).startAnimation(any(), any(), any()); } } Loading