Merge "Ensure transition is ready after applying display change"

This commit is contained in:
Riddle Hsu
2023-02-09 05:49:27 +00:00
committed by Android (Google) Code Review
3 changed files with 7 additions and 9 deletions

View File

@@ -2010,17 +2010,15 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
return mainWin.getAttrs().rotationAnimation;
}
/** Applies the new configuration and returns {@code true} if there is a display change. */
boolean applyDisplayChangeIfNeeded() {
boolean changed = false;
/** Applies the new configuration for the changed displays. */
void applyDisplayChangeIfNeeded() {
for (int i = mParticipants.size() - 1; i >= 0; --i) {
final WindowContainer<?> wc = mParticipants.valueAt(i);
final DisplayContent dc = wc.asDisplayContent();
if (dc == null || !mChanges.get(dc).hasChanged()) continue;
dc.sendNewConfiguration();
changed = true;
setReady(dc, true);
}
return changed;
}
boolean getLegacyIsReady() {

View File

@@ -494,8 +494,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
mService.deferWindowLayout();
mService.mTaskSupervisor.setDeferRootVisibilityUpdate(true /* deferUpdate */);
try {
if (transition != null && transition.applyDisplayChangeIfNeeded()) {
effects |= TRANSACT_EFFECTS_LIFECYCLE;
if (transition != null) {
transition.applyDisplayChangeIfNeeded();
}
final List<WindowContainerTransaction.HierarchyOp> hops = t.getHierarchyOps();
final int hopSize = hops.size();

View File

@@ -2020,13 +2020,13 @@ public class DisplayContentTests extends WindowTestsBase {
assertEquals(origRot, dc.getConfiguration().windowConfiguration.getRotation());
// Once transition starts, rotation is applied and transition shows DC rotating.
testPlayer.start();
testPlayer.startTransition();
assertNotEquals(origRot, dc.getConfiguration().windowConfiguration.getRotation());
assertNotNull(testPlayer.mLastReady);
assertTrue(testPlayer.mController.isPlaying());
WindowContainerToken dcToken = dc.mRemoteToken.toWindowContainerToken();
assertNotEquals(testPlayer.mLastReady.getChange(dcToken).getEndRotation(),
testPlayer.mLastReady.getChange(dcToken).getStartRotation());
assertTrue(testPlayer.mLastTransit.applyDisplayChangeIfNeeded());
testPlayer.finish();
}