Loading services/core/java/com/android/server/wm/Transition.java +11 −3 Original line number Diff line number Diff line Loading @@ -503,6 +503,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } mConfigAtEndActivities.add(ar); ar.pauseConfigurationDispatch(); snapshotStartState(ar); mChanges.get(ar).mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; }); snapshotStartState(wc); mChanges.get(wc).mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; Loading Loading @@ -2394,9 +2396,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } else { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_YES_ANIMATION; } final ActivityRecord ar = targetChange.mContainer.asActivityRecord(); if ((ar != null && ar.isConfigurationDispatchPaused()) || ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0)) { if ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0) { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; } } Loading Loading @@ -2483,6 +2483,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } else { intermediates.add(parentChange); } // for config-at-end, we want to promote the flag based on the end-state even // if the activity was reparented because it operates after the animation. So, // check that here since the promote code skips reparents. if ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0 && targetChange.mContainer.asActivityRecord() != null && targetChange.mContainer.getParent() == p) { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; } foundParentInTargets = true; break; } else if (reportIfNotTop(p) && !skipIntermediateReports) { Loading services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +33 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static java.lang.Integer.MAX_VALUE; import android.app.ActivityManager; import android.content.res.Configuration; import android.graphics.Color; Loading Loading @@ -2569,6 +2571,37 @@ public class TransitionTests extends WindowTestsBase { assertFalse(activity.isConfigurationDispatchPaused()); } @Test public void testConfigAtEndReparent() { final TransitionController controller = mDisplayContent.mTransitionController; Transition transit = createTestTransition(TRANSIT_CHANGE, controller); final TestTransitionPlayer player = registerTestTransitionPlayer(); final Task taskOrig = createTask(mDisplayContent); taskOrig.getConfiguration().windowConfiguration.setBounds(new Rect(0, 0, 200, 300)); final Task task = createTask(mDisplayContent); task.getConfiguration().windowConfiguration.setBounds(new Rect(10, 10, 200, 300)); final ActivityRecord activity = createActivityRecord(taskOrig); activity.setVisibleRequested(true); activity.setVisible(true); controller.moveToCollecting(transit); transit.collect(taskOrig); transit.collect(task); transit.collect(activity); transit.setConfigAtEnd(taskOrig); activity.reparent(task, MAX_VALUE); task.moveToFront("test"); controller.requestStartTransition(transit, task, null, null); player.start(); // config-at-end flag must propagate up to task even when reparented (since config-at-end // only cares about after-end state). assertTrue(player.mLastReady.getChange( task.mRemoteToken.toWindowContainerToken()).hasFlags(FLAG_CONFIG_AT_END)); player.finish(); } @Test public void testReadyTrackerBasics() { final TransitionController controller = new TestTransitionController( Loading Loading
services/core/java/com/android/server/wm/Transition.java +11 −3 Original line number Diff line number Diff line Loading @@ -503,6 +503,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } mConfigAtEndActivities.add(ar); ar.pauseConfigurationDispatch(); snapshotStartState(ar); mChanges.get(ar).mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; }); snapshotStartState(wc); mChanges.get(wc).mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; Loading Loading @@ -2394,9 +2396,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } else { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_YES_ANIMATION; } final ActivityRecord ar = targetChange.mContainer.asActivityRecord(); if ((ar != null && ar.isConfigurationDispatchPaused()) || ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0)) { if ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0) { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; } } Loading Loading @@ -2483,6 +2483,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } else { intermediates.add(parentChange); } // for config-at-end, we want to promote the flag based on the end-state even // if the activity was reparented because it operates after the animation. So, // check that here since the promote code skips reparents. if ((targetChange.mFlags & ChangeInfo.FLAG_CHANGE_CONFIG_AT_END) != 0 && targetChange.mContainer.asActivityRecord() != null && targetChange.mContainer.getParent() == p) { parentChange.mFlags |= ChangeInfo.FLAG_CHANGE_CONFIG_AT_END; } foundParentInTargets = true; break; } else if (reportIfNotTop(p) && !skipIntermediateReports) { Loading
services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +33 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static java.lang.Integer.MAX_VALUE; import android.app.ActivityManager; import android.content.res.Configuration; import android.graphics.Color; Loading Loading @@ -2569,6 +2571,37 @@ public class TransitionTests extends WindowTestsBase { assertFalse(activity.isConfigurationDispatchPaused()); } @Test public void testConfigAtEndReparent() { final TransitionController controller = mDisplayContent.mTransitionController; Transition transit = createTestTransition(TRANSIT_CHANGE, controller); final TestTransitionPlayer player = registerTestTransitionPlayer(); final Task taskOrig = createTask(mDisplayContent); taskOrig.getConfiguration().windowConfiguration.setBounds(new Rect(0, 0, 200, 300)); final Task task = createTask(mDisplayContent); task.getConfiguration().windowConfiguration.setBounds(new Rect(10, 10, 200, 300)); final ActivityRecord activity = createActivityRecord(taskOrig); activity.setVisibleRequested(true); activity.setVisible(true); controller.moveToCollecting(transit); transit.collect(taskOrig); transit.collect(task); transit.collect(activity); transit.setConfigAtEnd(taskOrig); activity.reparent(task, MAX_VALUE); task.moveToFront("test"); controller.requestStartTransition(transit, task, null, null); player.start(); // config-at-end flag must propagate up to task even when reparented (since config-at-end // only cares about after-end state). assertTrue(player.mLastReady.getChange( task.mRemoteToken.toWindowContainerToken()).hasFlags(FLAG_CONFIG_AT_END)); player.finish(); } @Test public void testReadyTrackerBasics() { final TransitionController controller = new TestTransitionController( Loading