Fix window transformation related issue

In some cases, for example, a window containing a SurfaceView,
when pressing switch button, the window animation of SurfaceView
and it's attached window are not sync, which leads animation not
behaving correctly.

To avoid this, apply the translation that applies the position
of the window before the app transformation.

Google issue:
https://code.google.com/p/android/issues/detail?id=225134

Change-Id: Ie8ddb875e895942c7f28e6fc83c4f92568512efb
This commit is contained in:
Qiushi.Han
2016-10-14 11:11:14 +08:00
parent 6f3a05ae77
commit 867210c1de

View File

@@ -996,15 +996,10 @@ class WindowStateAnimator {
if (attachedTransformation != null) {
tmpMatrix.postConcat(attachedTransformation.getMatrix());
}
tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
if (appTransformation != null) {
tmpMatrix.postConcat(appTransformation.getMatrix());
}
// The translation that applies the position of the window needs to be applied at the
// end in case that other translations include scaling. Otherwise the scaling will
// affect this translation. But it needs to be set before the screen rotation animation
// so the pivot point is at the center of the screen for all windows.
tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);
if (screenAnimation) {
tmpMatrix.postConcat(screenRotationAnimation.getEnterTransformation().getMatrix());
}