From 57caeb5703de0c86be04f597d14e954987cd7955 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 7 Oct 2015 11:24:31 -0700 Subject: Ensure SurfaceView requests WM relayout when size changes. In the case of scaled SurfaceViews with a fixed size. It is possible for the surface layout size to change without a change to the surface size or position. In this case we need to inform the window manager so it can update frames and scaling. This has presented in Camera and required workarounds such as changing the fixed surface size to trigger an update (leading to visual artifacts). Bug:23974105 Change-Id: I195aa0832907c32874b294101b56e198e853dce5 (cherry picked from commit a8fe43f09c0ed2119e55139a482f7f12fbe7d725) --- core/java/android/view/SurfaceView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 7d48a9a11eda..db68c29d025f 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -447,10 +447,11 @@ public class SurfaceView extends View { final boolean formatChanged = mFormat != mRequestedFormat; final boolean sizeChanged = mWidth != myWidth || mHeight != myHeight; final boolean visibleChanged = mVisible != mRequestedVisible; + final boolean layoutSizeChanged = getWidth() != mLayout.width || getHeight() != mLayout.height; if (force || creating || formatChanged || sizeChanged || visibleChanged || mLeft != mLocation[0] || mTop != mLocation[1] - || mUpdateWindowNeeded || mReportDrawNeeded || redrawNeeded) { + || mUpdateWindowNeeded || mReportDrawNeeded || redrawNeeded || layoutSizeChanged) { if (DEBUG) Log.i(TAG, "Changes: creating=" + creating + " format=" + formatChanged + " size=" + sizeChanged -- cgit v1.2.3