Sync surface position for animation in core

With shell transition:
1. Transition is collecting
2. Window updates position -> set to sync transaction
3. Window plays animation -> use pending transaction
4. The transition is ready and apply sync transaction
 -> The position set by 3 is replaced by 2

Though it can also be fixed by startAnimation(getSyncTransaction(),
that will lose the ability to run window animation independently
of token level transition.

Bug: 236947311
Test: Launch an activity with a short transition or no
      transition animation. And it pops a dialog immediately.
      The dialog should not show in wrong place.
Change-Id: I74e044f440e40c3c5f99bf0f8c7a601e953dbbc7
This commit is contained in:
Riddle Hsu
2022-06-23 21:34:42 +08:00
parent d9fa425f92
commit e453728b69

View File

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