From 34a06d148ec0218a5e065b7b9c7cf338c3d20df6 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Fri, 3 Feb 2017 11:56:08 -0800 Subject: [PATCH] Revert "Fix window transformation related issue" This reverts commit 867210c1de62e533880da7ac64b8eaa837e6ed6a. This commit is being reverted because the logic it tries to fix does not make sense and caused a regression causing all animation positions to be offset incorrectly but applying the animation metrics before applying the window offset (mainly for bottom screen in multiwindow). The original case this tries to fix is for older apps like gallery2 which crashes (ramdump) when trying reproduce the steps. Fixes: 34769878 Test: ran original case that this tried to fix and played with recents related to the new bug it created --- .../java/com/android/server/wm/WindowStateAnimator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index b163abf9f20eb..d2ea64c89a98a 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -915,10 +915,15 @@ 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()); }