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

Commit d647897f authored by shawnlin's avatar shawnlin
Browse files

Allow passing cutout to the hierarchy in shortEdge mode

Bug: 149806697
Test: make
Change-Id: I7fea5d0c05155a850fc7536bd0548c844ce6783d
parent a9ec170c
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_APPEARANCE_CONTROLLED;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_BEHAVIOR_CONTROLLED;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FIT_INSETS_CONTROLLED;
@@ -2209,9 +2210,7 @@ public final class ViewRootImpl implements ViewParent,
    void dispatchApplyInsets(View host) {
        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets");
        WindowInsets insets = getWindowInsets(true /* forceConstruct */);
        final boolean dispatchCutout = (mWindowAttributes.layoutInDisplayCutoutMode
                == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS);
        if (!dispatchCutout) {
        if (!shouldDispatchCutout()) {
            // Window is either not laid out in cutout or the status bar inset takes care of
            // clearing the cutout, so we don't need to dispatch the cutout to the hierarchy.
            insets = insets.consumeDisplayCutout();
@@ -2220,6 +2219,13 @@ public final class ViewRootImpl implements ViewParent,
        Trace.traceEnd(Trace.TRACE_TAG_VIEW);
    }

    private boolean shouldDispatchCutout() {
        return mWindowAttributes.layoutInDisplayCutoutMode
                        == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
                || mWindowAttributes.layoutInDisplayCutoutMode
                        == LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
    }

    private void updateVisibleInsets() {
        Rect visibleInsets = mInsetsController.calculateVisibleInsets(mPendingVisibleInsets,
                mWindowAttributes.softInputMode);