Merge "Skip deferring draw for non seamless rotation window" into tm-qpr-dev

This commit is contained in:
Riddle Hsu
2022-10-05 05:46:05 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 3 deletions

View File

@@ -202,8 +202,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
// target windows. But the windows still need to use sync transaction to keep the appearance // target windows. But the windows still need to use sync transaction to keep the appearance
// in previous rotation, so request a no-op sync to keep the state. // in previous rotation, so request a no-op sync to keep the state.
for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) { for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) {
if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST if (mTargetWindowTokens.valueAt(i).canDrawBeforeStartTransaction()) {
&& mTargetWindowTokens.valueAt(i).mAction != Operation.ACTION_SEAMLESS) {
// Expect a screenshot layer will cover the non seamless windows. // Expect a screenshot layer will cover the non seamless windows.
continue; continue;
} }
@@ -489,7 +488,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
return false; return false;
} }
final Operation op = mTargetWindowTokens.get(w.mToken); final Operation op = mTargetWindowTokens.get(w.mToken);
if (op == null) return false; if (op == null || op.canDrawBeforeStartTransaction()) return false;
if (DEBUG) Slog.d(TAG, "handleFinishDrawing " + w); if (DEBUG) Slog.d(TAG, "handleFinishDrawing " + w);
if (op.mDrawTransaction == null) { if (op.mDrawTransaction == null) {
if (w.isClientLocal()) { if (w.isClientLocal()) {
@@ -554,5 +553,14 @@ class AsyncRotationController extends FadeAnimationController implements Consume
Operation(@Action int action) { Operation(@Action int action) {
mAction = action; mAction = action;
} }
/**
* Returns {@code true} if the corresponding window can draw its latest content before the
* start transaction of rotation transition is applied.
*/
boolean canDrawBeforeStartTransaction() {
return TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST
&& mAction != ACTION_SEAMLESS;
}
} }
} }

View File

@@ -732,6 +732,11 @@ public class TransitionTests extends WindowTestsBase {
assertTrue(asyncRotationController.isTargetToken(decorToken)); assertTrue(asyncRotationController.isTargetToken(decorToken));
assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true); assertShouldFreezeInsetsPosition(asyncRotationController, statusBar, true);
if (TransitionController.SYNC_METHOD != BLASTSyncEngine.METHOD_BLAST) {
// Only seamless window syncs its draw transaction with transition.
assertFalse(asyncRotationController.handleFinishDrawing(statusBar, mMockT));
assertTrue(asyncRotationController.handleFinishDrawing(screenDecor, mMockT));
}
screenDecor.setOrientationChanging(false); screenDecor.setOrientationChanging(false);
// Status bar finishes drawing before the start transaction. Its fade-in animation will be // Status bar finishes drawing before the start transaction. Its fade-in animation will be
// executed until the transaction is committed, so it is still in target tokens. // executed until the transaction is committed, so it is still in target tokens.