Use pending transaction for setting transform hint

This uses the proper transaction for [1].
Because the "t" could be sync transaction or start transaction
of transition, which will be applied by shell side that is too late.
Such as the app relayout before the transition starts, it will
still get old transform.

[1]: I6650eef0b12d84f7014e5afc280c1cb5e907d7b2

Bug: 270282500
Test: atest SurfaceControlTests#testSurfaceChangedOnRotation
Change-Id: Ib4a019bef270e33f76eec51220e758925dbb4c97
This commit is contained in:
Riddle Hsu
2023-05-04 15:53:25 +08:00
parent 35f2750e30
commit 1bc6b35487
2 changed files with 4 additions and 3 deletions

View File

@@ -3592,11 +3592,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
&& !mTransitionController.useShellTransitionsRotation()) {
if (deltaRotation != Surface.ROTATION_0) {
updateSurfaceRotation(t, deltaRotation, null /* positionLeash */);
t.setFixedTransformHint(mSurfaceControl,
getPendingTransaction().setFixedTransformHint(mSurfaceControl,
getWindowConfiguration().getDisplayRotation());
} else if (deltaRotation != mLastDeltaRotation) {
t.setMatrix(mSurfaceControl, 1, 0, 0, 1);
t.unsetFixedTransformHint(mSurfaceControl);
getPendingTransaction().unsetFixedTransformHint(mSurfaceControl);
}
}
mLastDeltaRotation = deltaRotation;

View File

@@ -596,7 +596,8 @@ class WindowToken extends WindowContainer<WindowState> {
.build();
t.setPosition(leash, mLastSurfacePosition.x, mLastSurfacePosition.y);
t.reparent(getSurfaceControl(), leash);
t.setFixedTransformHint(leash, getWindowConfiguration().getDisplayRotation());
getPendingTransaction().setFixedTransformHint(leash,
getWindowConfiguration().getDisplayRotation());
mFixedRotationTransformLeash = leash;
updateSurfaceRotation(t, rotation, mFixedRotationTransformLeash);
return mFixedRotationTransformLeash;