Sync surface position for legacy app transition animation

With legacy app transition:
1. TaskFragment is resized when it is invisible -> update surface
   position on sync transaction.
2. Activity becomes visible in TaskFragment, which trigger app
   transition.
3. Animation target is promoted to TaskFragment and create animation
   leash -> reset position on pending transaction.
4. Apply pending transaction to start legacy app transition -> 1 is
   applied after 3, which cause the TaskFragment surface position offset
   in animation leash.

This is similar to I74e044f440e40c3c5f99bf0f8c7a601e953dbbc7

Fix: 256689498
Test: Launch Setting into split left with any app, click back to exit
the split right. No flicker when Settings shows in fullscreen.

Change-Id: Id3db698729a5c25df7e50a49caf504b6fa866aa6
This commit is contained in:
Chris Li
2022-11-03 22:06:47 +08:00
parent 96e8a788ef
commit 6d3f711632
2 changed files with 8 additions and 2 deletions

View File

@@ -2336,6 +2336,11 @@ class TaskFragment extends WindowContainer<WindowContainer> {
if (mTaskFragmentOrganizer != null
&& (mLastSurfaceSize.x != 0 || mLastSurfaceSize.y != 0)) {
t.setWindowCrop(mSurfaceControl, 0, 0);
final SurfaceControl.Transaction syncTransaction = getSyncTransaction();
if (t != syncTransaction) {
// Avoid restoring to old window crop if the sync transaction is applied later.
syncTransaction.setWindowCrop(mSurfaceControl, 0, 0);
}
mLastSurfaceSize.set(0, 0);
}
}

View File

@@ -3250,9 +3250,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
void resetSurfacePositionForAnimationLeash(Transaction t) {
t.setPosition(mSurfaceControl, 0, 0);
if (mSyncState != SYNC_STATE_NONE && t != mSyncTransaction) {
final SurfaceControl.Transaction syncTransaction = getSyncTransaction();
if (t != syncTransaction) {
// Avoid restoring to old position if the sync transaction is applied later.
mSyncTransaction.setPosition(mSurfaceControl, 0, 0);
syncTransaction.setPosition(mSurfaceControl, 0, 0);
}
mLastSurfacePosition.set(0, 0);
}