From cbeb33249d5beec7903f18269c991a5515c5d981 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Sat, 12 May 2012 19:57:07 -0700 Subject: fix SurfaceView visibility state changes SurfaceView didn't recompute the transparent region when the INVISIBLE state (as opposed to GONE) was involved. Bug: 6467123 Change-Id: I05930bd568a345331840c1ad8d9123ef4904c04f --- core/java/android/view/SurfaceView.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core/java') diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index ee322f8..5e7a12b 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -231,7 +231,17 @@ public class SurfaceView extends View { public void setVisibility(int visibility) { super.setVisibility(visibility); mViewVisibility = visibility == VISIBLE; - mRequestedVisible = mWindowVisibility && mViewVisibility; + boolean newRequestedVisible = mWindowVisibility && mViewVisibility; + if (newRequestedVisible != mRequestedVisible) { + // our base class (View) invalidates the layout only when + // we go from/to the GONE state. However, SurfaceView needs + // to request a re-layout when the visibility changes at all. + // This is needed because the transparent region is computed + // as part of the layout phase, and it changes (obviously) when + // the visibility changes. + requestLayout(); + } + mRequestedVisible = newRequestedVisible; updateWindow(false, false); } -- cgit v1.1