From 8e7be8e808b0e7f27e745985c4f3672437f3ee2f Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 31 Jan 2017 13:20:31 -0800 Subject: [PATCH] Fix PiP animation errors introduced in crop refactoring. Firstly, pinned stack now uses final crop only, so we need to scale to the width/height computed there, not as computed for the crop. Furthermore mTmpClipRect is no longer used directly to set the crop, so clearing it in the pinned animation code had no effect. This fixes the worst of the visual errors so people stop filing bugs while I rework this logic entirely. Bug: 34823229 Bug: 32881014 Bug: 33245930 Test: Manual with PiP activities on Fugu. Change-Id: I45d2def5138f3cc278408a9209b5e5c40cece80b --- .../java/com/android/server/wm/WindowStateAnimator.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 19ef44cace33c..7940ee0de0ab8 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1321,8 +1321,8 @@ class WindowStateAnimator { } // We want to calculate the scaling based on the content area, not based on // the entire surface, so that we scale in sync with windows that don't have insets. - mExtraHScale = (mTmpClipRect.width() - hInsets) / (float)(surfaceWidth - hInsets); - mExtraVScale = (mTmpClipRect.height() - vInsets) / (float)(surfaceHeight - vInsets); + mExtraHScale = (finalClipRect.width() - hInsets) / (float)(surfaceWidth - hInsets); + mExtraVScale = (finalClipRect.height() - vInsets) / (float)(surfaceHeight - vInsets); // In the case of ForceScaleToCrop we scale entire tasks together, // and so we need to scale our offsets relative to the task bounds @@ -1345,8 +1345,7 @@ class WindowStateAnimator { // Since we are scaled to fit in our previously desired crop, we can now // expose the whole window in buffer space, and not risk extending // past where the system would have cropped us - mTmpClipRect.set(0, 0, (int)surfaceWidth, (int)surfaceHeight); - mTmpFinalClipRect.setEmpty(); + clipRect = null; // Various surfaces in the scaled stack may resize at different times. // We need to ensure for each surface, that we disable transformation matrix