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

Commit 367b09cc authored by Gaurav Bhola's avatar Gaurav Bhola
Browse files

Add the systemOverlays() method

- Also rename GENERIC_OVERLAYS to SYSTEM_OVERLAYS

Bug: 232017511
Fix: 244238266
Test: atest WindowInsetsTests
Change-Id: Ib8455f6ae576c7b3f40789de30649d8fc137e3dd
parent d659f6a8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -51898,6 +51898,7 @@ package android.view {
    method public static int statusBars();
    method public static int systemBars();
    method public static int systemGestures();
    method public static int systemOverlays();
    method public static int tappableElement();
  }
+2 −2
Original line number Diff line number Diff line
@@ -702,7 +702,7 @@ public class InsetsState implements Parcelable {
            result.add(ITYPE_NAVIGATION_BAR);
            result.add(ITYPE_EXTRA_NAVIGATION_BAR);
        }
        if ((types & Type.GENERIC_OVERLAYS) != 0) {
        if ((types & Type.SYSTEM_OVERLAYS) != 0) {
            result.add(ITYPE_LEFT_GENERIC_OVERLAY);
            result.add(ITYPE_TOP_GENERIC_OVERLAY);
            result.add(ITYPE_RIGHT_GENERIC_OVERLAY);
@@ -752,7 +752,7 @@ public class InsetsState implements Parcelable {
            case ITYPE_TOP_GENERIC_OVERLAY:
            case ITYPE_RIGHT_GENERIC_OVERLAY:
            case ITYPE_BOTTOM_GENERIC_OVERLAY:
                return Type.GENERIC_OVERLAYS;
                return Type.SYSTEM_OVERLAYS;
            case ITYPE_CAPTION_BAR:
                return Type.CAPTION_BAR;
            case ITYPE_IME:
+24 −8
Original line number Diff line number Diff line
@@ -1425,8 +1425,8 @@ public final class WindowInsets {

        static final int WINDOW_DECOR = 1 << 8;

        static final int GENERIC_OVERLAYS = 1 << 9;
        static final int LAST = GENERIC_OVERLAYS;
        static final int SYSTEM_OVERLAYS = 1 << 9;
        static final int LAST = SYSTEM_OVERLAYS;
        static final int SIZE = 10;

        static final int DEFAULT_VISIBLE = ~IME;
@@ -1451,7 +1451,7 @@ public final class WindowInsets {
                    return 7;
                case WINDOW_DECOR:
                    return 8;
                case GENERIC_OVERLAYS:
                case SYSTEM_OVERLAYS:
                    return 9;
                default:
                    throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST,"
@@ -1489,8 +1489,8 @@ public final class WindowInsets {
            if ((types & WINDOW_DECOR) != 0) {
                result.append("windowDecor |");
            }
            if ((types & GENERIC_OVERLAYS) != 0) {
                result.append("genericOverlays |");
            if ((types & SYSTEM_OVERLAYS) != 0) {
                result.append("systemOverlays |");
            }
            if (result.length() > 0) {
                result.delete(result.length() - 2, result.length());
@@ -1505,7 +1505,7 @@ public final class WindowInsets {
        @Retention(RetentionPolicy.SOURCE)
        @IntDef(flag = true, value = {STATUS_BARS, NAVIGATION_BARS, CAPTION_BAR, IME, WINDOW_DECOR,
                SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT, DISPLAY_CUTOUT,
                GENERIC_OVERLAYS})
                SYSTEM_OVERLAYS})
        public @interface InsetsType {
        }

@@ -1592,12 +1592,28 @@ public final class WindowInsets {
            return DISPLAY_CUTOUT;
        }

        /**
         * System overlays represent the insets caused by the system visible elements. Unlike
         * {@link #navigationBars()} or {@link #statusBars()}, system overlays might not be
         * hidden by the client.
         *
         * For compatibility reasons, this type is included in {@link #systemBars()}. In this
         * way, views which fit {@link #systemBars()} fit {@link #systemOverlays()}.
         *
         * Examples include climate controls, multi-tasking affordances, etc.
         *
         * @return An insets type representing the system overlays.
         */
        public static @InsetsType int systemOverlays() {
            return SYSTEM_OVERLAYS;
        }

        /**
         * @return All system bars. Includes {@link #statusBars()}, {@link #captionBar()} as well as
         *         {@link #navigationBars()}, but not {@link #ime()}.
         *         {@link #navigationBars()}, {@link #systemOverlays()}, but not {@link #ime()}.
         */
        public static @InsetsType int systemBars() {
            return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR | GENERIC_OVERLAYS;
            return STATUS_BARS | NAVIGATION_BARS | CAPTION_BAR | SYSTEM_OVERLAYS;
        }

        /**