Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbeb3324 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

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
parent dca5fb9e
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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);
    }