diff options
author | 2022-11-12 22:50:29 +0000 | |
---|---|---|
committer | 2022-11-12 22:50:29 +0000 | |
commit | 14fed442be10fa2a1d26397edac060b935e52b79 (patch) | |
tree | fbd3b669d6dc658898f80b6fd8e80d5df77d78b2 | |
parent | a28c45c2b29926560b08d716f5bf2af397fcd7cc (diff) | |
parent | 367b09cc4a1efce090848e4813b00ee4dfca4aa4 (diff) |
Merge "Add the systemOverlays() method"
-rw-r--r-- | core/api/current.txt | 1 | ||||
-rw-r--r-- | core/java/android/view/InsetsState.java | 4 | ||||
-rw-r--r-- | core/java/android/view/WindowInsets.java | 32 |
3 files changed, 27 insertions, 10 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index ae31af6ff082..53dbef8adcc7 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -51925,6 +51925,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(); } diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index e91839baad61..a8cc9b62d30a 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -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: diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index 2a76c4e0a694..d77e499357b9 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -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 { } @@ -1593,11 +1593,27 @@ public final class WindowInsets { } /** + * 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; } /** |