Loading services/core/java/com/android/server/wm/WindowContainer.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -393,6 +393,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< if (mParent != null) { if (mParent != null) { mParent.onChildAdded(this); mParent.onChildAdded(this); } else if (mSurfaceAnimator.hasLeash()) { mSurfaceAnimator.cancelAnimation(); } } if (!mReparenting) { if (!mReparenting) { onSyncReparent(oldParent, mParent); onSyncReparent(oldParent, mParent); Loading services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -117,8 +117,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_RECENTS, adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_RECENTS, mFinishedCallback); mFinishedCallback); // Remove the app window so that the animation target can not be created // The activity doesn't contain window so the animation target cannot be created. activity.removeImmediately(); mController.startAnimation(); mController.startAnimation(); // Verify that the finish callback to reparent the leash is called // Verify that the finish callback to reparent the leash is called Loading services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; Loading Loading @@ -77,6 +78,7 @@ import androidx.test.filters.SmallTest; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.mockito.Mockito; import java.util.ArrayList; import java.util.ArrayList; Loading Loading @@ -270,6 +272,22 @@ public class WindowContainerTests extends WindowTestsBase { } } } } @Test public void testRemoveImmediatelyClearsLeash() { final AnimationAdapter animAdapter = mock(AnimationAdapter.class); final WindowToken token = createTestWindowToken(TYPE_APPLICATION_OVERLAY, mDisplayContent); final SurfaceControl.Transaction t = token.getPendingTransaction(); token.startAnimation(t, animAdapter, false /* hidden */, SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION); final ArgumentCaptor<SurfaceControl> leashCaptor = ArgumentCaptor.forClass(SurfaceControl.class); verify(animAdapter).startAnimation(leashCaptor.capture(), eq(t), anyInt(), any()); assertTrue(token.mSurfaceAnimator.hasLeash()); token.removeImmediately(); assertFalse(token.mSurfaceAnimator.hasLeash()); verify(t).remove(eq(leashCaptor.getValue())); } @Test @Test public void testAddChildByIndex() { public void testAddChildByIndex() { final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); Loading Loading
services/core/java/com/android/server/wm/WindowContainer.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -393,6 +393,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< if (mParent != null) { if (mParent != null) { mParent.onChildAdded(this); mParent.onChildAdded(this); } else if (mSurfaceAnimator.hasLeash()) { mSurfaceAnimator.cancelAnimation(); } } if (!mReparenting) { if (!mReparenting) { onSyncReparent(oldParent, mParent); onSyncReparent(oldParent, mParent); Loading
services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +1 −2 Original line number Original line Diff line number Diff line Loading @@ -117,8 +117,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_RECENTS, adapter.startAnimation(mMockLeash, mMockTransaction, ANIMATION_TYPE_RECENTS, mFinishedCallback); mFinishedCallback); // Remove the app window so that the animation target can not be created // The activity doesn't contain window so the animation target cannot be created. activity.removeImmediately(); mController.startAnimation(); mController.startAnimation(); // Verify that the finish callback to reparent the leash is called // Verify that the finish callback to reparent the leash is called Loading
services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; Loading Loading @@ -77,6 +78,7 @@ import androidx.test.filters.SmallTest; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.mockito.Mockito; import java.util.ArrayList; import java.util.ArrayList; Loading Loading @@ -270,6 +272,22 @@ public class WindowContainerTests extends WindowTestsBase { } } } } @Test public void testRemoveImmediatelyClearsLeash() { final AnimationAdapter animAdapter = mock(AnimationAdapter.class); final WindowToken token = createTestWindowToken(TYPE_APPLICATION_OVERLAY, mDisplayContent); final SurfaceControl.Transaction t = token.getPendingTransaction(); token.startAnimation(t, animAdapter, false /* hidden */, SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION); final ArgumentCaptor<SurfaceControl> leashCaptor = ArgumentCaptor.forClass(SurfaceControl.class); verify(animAdapter).startAnimation(leashCaptor.capture(), eq(t), anyInt(), any()); assertTrue(token.mSurfaceAnimator.hasLeash()); token.removeImmediately(); assertFalse(token.mSurfaceAnimator.hasLeash()); verify(t).remove(eq(leashCaptor.getValue())); } @Test @Test public void testAddChildByIndex() { public void testAddChildByIndex() { final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); Loading