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

Commit cc075c76 authored by Skuhne's avatar Skuhne
Browse files

Possible resize flickering on config change

It is possible that while a config change is going on, the
view hiererchy got created but not layouted. In that case
the reported size of the main window would be 0,0. In this
event we need to use the cached window sizes from the past
render.

Bug: 24595899
Change-Id: Ia41f7ae0999e4f2bda364506029bcbdfd7d3f4b4
parent 150c5ae2
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -519,20 +519,24 @@ public class NonClientDecorView extends LinearLayout
            // inaccessible. For that case we remember the previous metrics to avoid flashes.
            View caption = getChildAt(0);
            View content = getChildAt(1);
            if (content != null && caption != null) {
                mLastContentWidth = content.getWidth();
                mLastContentHeight = content.getHeight();
                mLastCaptionHeight = caption.getHeight();

                // Get the draw position within our surface.
            if (caption != null && content != null) {
                int captionHeight = caption.getHeight();
                int contentWidth = content.getWidth();
                int contentHeight = content.getHeight();
                // Get the draw position within our surface (shadow offsets).
                int[] surfaceOrigin = new int[2];
                surfaceOrigin[0] = 0;
                surfaceOrigin[1] = 0;

                // Get the shadow offsets.
                getLocationInSurface(surfaceOrigin);
                // Only update if a layout has already be performed (which might not be after a
                // relayout. Otherwise use the previous values for the content.
                if (captionHeight != 0 && contentWidth != 0 && contentHeight != 0) {
                    mLastCaptionHeight = captionHeight;
                    mLastXOffset = surfaceOrigin[0];
                    mLastYOffset = surfaceOrigin[1];
                    mLastContentWidth = contentWidth;
                    mLastContentHeight = contentHeight;
                }
            }

            // Since the surface is spanning the entire screen, we have to add the start offset of