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

Commit 720924b6 authored by Adam Powell's avatar Adam Powell
Browse files

Fix incorrect dispatch of empty WindowInsets from ActionBarOverlayLayout

Fix a bug where ActionBarOverlayLayout was using a private constructor
of WindowInsets to return empty insets that should have been marked
fully consumed. This caused dispatch to further child views not to
stop appropriately, corrupting application layout in some cases.

Bug 15588587

Change-Id: I97fcefa4755addf2385a7e7b0ffbf6d3e91adc5c
parent 0c377a90
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,13 @@ public final class WindowInsets {
     * since it would allow them to inadvertently consume unknown insets by returning it.
     * since it would allow them to inadvertently consume unknown insets by returning it.
     * @hide
     * @hide
     */
     */
    public static final WindowInsets EMPTY = new WindowInsets(EMPTY_RECT, EMPTY_RECT);
    public static final WindowInsets CONSUMED;

    static {
        CONSUMED = new WindowInsets(EMPTY_RECT, EMPTY_RECT);
        CONSUMED.mSystemWindowInsetsConsumed = true;
        CONSUMED.mWindowDecorInsetsConsumed = true;
    }


    /** @hide */
    /** @hide */
    public WindowInsets(Rect systemWindowInsets, Rect windowDecorInsets) {
    public WindowInsets(Rect systemWindowInsets, Rect windowDecorInsets) {
+9 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.Rect;
@@ -245,6 +246,13 @@ public class ActionBarOverlayLayout extends ViewGroup implements DecorContentPar
        }
        }
    }
    }


    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        init(getContext());
        requestApplyInsets();
    }

    @Override
    @Override
    public void onWindowSystemUiVisibilityChanged(int visible) {
    public void onWindowSystemUiVisibilityChanged(int visible) {
        super.onWindowSystemUiVisibilityChanged(visible);
        super.onWindowSystemUiVisibilityChanged(visible);
@@ -329,7 +337,7 @@ public class ActionBarOverlayLayout extends ViewGroup implements DecorContentPar
        // insets in all cases, we need to know the measured size of the various action
        // insets in all cases, we need to know the measured size of the various action
        // bar elements.  onApplyWindowInsets() happens before the measure pass, so we can't
        // bar elements.  onApplyWindowInsets() happens before the measure pass, so we can't
        // do that here.  Instead we will take this up in onMeasure().
        // do that here.  Instead we will take this up in onMeasure().
        return WindowInsets.EMPTY;
        return WindowInsets.CONSUMED;
    }
    }


    @Override
    @Override