From 20fee4f657ba9ec1766db1d189c9bd10fd5c1b7e Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Tue, 7 Apr 2015 11:32:17 -0700 Subject: [PATCH] Fixed glitch in NuPlayer when surface size changes When VideoView calls setFixedSize(), the SurfaceControl.setSize() gets called from WindowStateAnimator.setSurfaceBoundariesLocked, but setSurfaceBoundariesLocked only updates the size, not the transform matrix/scaling factor. The after some time, SurfaceControl.setMatrix gets called by WindowStateAnimator.prepareSurfaceLocked. It updates both size and matrix (size update is skipped since it's already updated by setSurfaceBoundariesLocked earlier). This corrects the transform matrix, and restores video rendering. We now call setMatrix() in setSurfaceBoundariesLocked() to avoid the glitch. Bug: 18773834 Change-Id: I5e8de38495fabe54eefa8bd3003627d11392c0f1 --- .../core/java/com/android/server/wm/WindowStateAnimator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index ac1b0f1cbf233..1a30cbaea43dd 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -1403,6 +1403,9 @@ class WindowStateAnimator { if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(w, "SIZE " + width + "x" + height, null); mSurfaceControl.setSize(width, height); + mSurfaceControl.setMatrix( + mDsDx * w.mHScale, mDtDx * w.mVScale, + mDsDy * w.mHScale, mDtDy * w.mVScale); mAnimator.setPendingLayoutChanges(w.getDisplayId(), WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); if ((w.mAttrs.flags & LayoutParams.FLAG_DIM_BEHIND) != 0) {