Skip to content

Commit 7ed1d66

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "fix SurfaceView visibility state changes" into jb-dev
2 parents a545db3 + cbeb332 commit 7ed1d66

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

core/java/android/view/SurfaceView.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,17 @@ protected void onWindowVisibilityChanged(int visibility) {
230230
public void setVisibility(int visibility) {
231231
super.setVisibility(visibility);
232232
mViewVisibility = visibility == VISIBLE;
233-
mRequestedVisible = mWindowVisibility && mViewVisibility;
233+
boolean newRequestedVisible = mWindowVisibility && mViewVisibility;
234+
if (newRequestedVisible != mRequestedVisible) {
235+
// our base class (View) invalidates the layout only when
236+
// we go from/to the GONE state. However, SurfaceView needs
237+
// to request a re-layout when the visibility changes at all.
238+
// This is needed because the transparent region is computed
239+
// as part of the layout phase, and it changes (obviously) when
240+
// the visibility changes.
241+
requestLayout();
242+
}
243+
mRequestedVisible = newRequestedVisible;
234244
updateWindow(false, false);
235245
}
236246

0 commit comments

Comments
 (0)