Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -55520,6 +55520,7 @@ package android.view { public static final class WindowInsets.Type { method public static int captionBar(); method public static int displayCutout(); method public static int ime(); method public static int mandatorySystemGestures(); method public static int navigationBars(); core/java/android/view/DisplayCutout.java +20 −4 Original line number Diff line number Diff line Loading @@ -393,22 +393,38 @@ public final class DisplayCutout { return mSafeInsets.equals(ZERO_RECT); } /** Returns the inset from the top which avoids the display cutout in pixels. */ /** * Returns the inset from the top which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetTop() { return mSafeInsets.top; } /** Returns the inset from the bottom which avoids the display cutout in pixels. */ /** * Returns the inset from the bottom which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetBottom() { return mSafeInsets.bottom; } /** Returns the inset from the left which avoids the display cutout in pixels. */ /** * Returns the inset from the left which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetLeft() { return mSafeInsets.left; } /** Returns the inset from the right which avoids the display cutout in pixels. */ /** * Returns the inset from the right which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetRight() { return mSafeInsets.right; } Loading core/java/android/view/InsetsSource.java +4 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ public class InsetsSource implements Parcelable { : null; } public void setFrame(int left, int top, int right, int bottom) { mFrame.set(left, top, right, bottom); } public void setFrame(Rect frame) { mFrame.set(frame); } Loading core/java/android/view/InsetsState.java +32 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.ViewRootImpl.sNewInsetsMode; import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES; import static android.view.WindowInsets.Type.SIZE; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.displayCutout; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.isVisibleInsetsType; Loading Loading @@ -71,6 +72,10 @@ public class InsetsState implements Parcelable { ITYPE_RIGHT_GESTURES, ITYPE_TOP_TAPPABLE_ELEMENT, ITYPE_BOTTOM_TAPPABLE_ELEMENT, ITYPE_LEFT_DISPLAY_CUTOUT, ITYPE_TOP_DISPLAY_CUTOUT, ITYPE_RIGHT_DISPLAY_CUTOUT, ITYPE_BOTTOM_DISPLAY_CUTOUT, ITYPE_IME }) public @interface InternalInsetsType {} Loading @@ -88,8 +93,13 @@ public class InsetsState implements Parcelable { public static final int ITYPE_TOP_TAPPABLE_ELEMENT = 7; public static final int ITYPE_BOTTOM_TAPPABLE_ELEMENT = 8; public static final int ITYPE_LEFT_DISPLAY_CUTOUT = 9; public static final int ITYPE_TOP_DISPLAY_CUTOUT = 10; public static final int ITYPE_RIGHT_DISPLAY_CUTOUT = 11; public static final int ITYPE_BOTTOM_DISPLAY_CUTOUT = 12; /** Input method window. */ public static final int ITYPE_IME = 9; public static final int ITYPE_IME = 13; static final int LAST_TYPE = ITYPE_IME; Loading Loading @@ -185,8 +195,8 @@ public class InsetsState implements Parcelable { final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST; return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE ? systemBars() | ime() : systemBars(), ? systemBars() | displayCutout() | ime() : systemBars() | displayCutout(), sNewInsetsMode == NEW_INSETS_MODE_FULL && (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0); } Loading Loading @@ -358,6 +368,12 @@ public class InsetsState implements Parcelable { if ((types & Type.CAPTION_BAR) != 0) { result.add(ITYPE_CAPTION_BAR); } if ((types & Type.DISPLAY_CUTOUT) != 0) { result.add(ITYPE_LEFT_DISPLAY_CUTOUT); result.add(ITYPE_TOP_DISPLAY_CUTOUT); result.add(ITYPE_RIGHT_DISPLAY_CUTOUT); result.add(ITYPE_BOTTOM_DISPLAY_CUTOUT); } if ((types & Type.IME) != 0) { result.add(ITYPE_IME); } Loading Loading @@ -388,6 +404,11 @@ public class InsetsState implements Parcelable { case ITYPE_TOP_TAPPABLE_ELEMENT: case ITYPE_BOTTOM_TAPPABLE_ELEMENT: return Type.TAPPABLE_ELEMENT; case ITYPE_LEFT_DISPLAY_CUTOUT: case ITYPE_TOP_DISPLAY_CUTOUT: case ITYPE_RIGHT_DISPLAY_CUTOUT: case ITYPE_BOTTOM_DISPLAY_CUTOUT: return Type.DISPLAY_CUTOUT; default: throw new IllegalArgumentException("Unknown type: " + type); } Loading Loading @@ -437,6 +458,14 @@ public class InsetsState implements Parcelable { return "ITYPE_TOP_TAPPABLE_ELEMENT"; case ITYPE_BOTTOM_TAPPABLE_ELEMENT: return "ITYPE_BOTTOM_TAPPABLE_ELEMENT"; case ITYPE_LEFT_DISPLAY_CUTOUT: return "ITYPE_LEFT_DISPLAY_CUTOUT"; case ITYPE_TOP_DISPLAY_CUTOUT: return "ITYPE_TOP_DISPLAY_CUTOUT"; case ITYPE_RIGHT_DISPLAY_CUTOUT: return "ITYPE_RIGHT_DISPLAY_CUTOUT"; case ITYPE_BOTTOM_DISPLAY_CUTOUT: return "ITYPE_BOTTOM_DISPLAY_CUTOUT"; case ITYPE_IME: return "ITYPE_IME"; default: Loading core/java/android/view/WindowInsets.java +30 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import static android.view.WindowInsets.Type.DISPLAY_CUTOUT; import static android.view.WindowInsets.Type.FIRST; import static android.view.WindowInsets.Type.IME; import static android.view.WindowInsets.Type.LAST; Loading Loading @@ -1209,6 +1210,13 @@ public final class WindowInsets { @NonNull public Builder setDisplayCutout(@Nullable DisplayCutout displayCutout) { mDisplayCutout = displayCutout != null ? displayCutout : DisplayCutout.NO_CUTOUT; if (!mDisplayCutout.isEmpty()) { final Insets safeInsets = Insets.of(mDisplayCutout.getSafeInsets()); final int index = indexOf(DISPLAY_CUTOUT); mTypeInsetsMap[index] = safeInsets; mTypeMaxInsetsMap[index] = safeInsets; mTypeVisibilityMap[index] = true; } return this; } Loading Loading @@ -1256,8 +1264,10 @@ public final class WindowInsets { static final int MANDATORY_SYSTEM_GESTURES = 1 << 5; static final int TAPPABLE_ELEMENT = 1 << 6; static final int LAST = 1 << 7; static final int SIZE = 8; static final int DISPLAY_CUTOUT = 1 << 7; static final int LAST = 1 << 8; static final int SIZE = 9; static final int WINDOW_DECOR = LAST; static int indexOf(@InsetsType int type) { Loading @@ -1276,8 +1286,10 @@ public final class WindowInsets { return 5; case TAPPABLE_ELEMENT: return 6; case WINDOW_DECOR: case DISPLAY_CUTOUT: return 7; case WINDOW_DECOR: return 8; default: throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST," + " type=" + type); Loading @@ -1290,7 +1302,7 @@ public final class WindowInsets { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = {STATUS_BARS, NAVIGATION_BARS, CAPTION_BAR, IME, WINDOW_DECOR, SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT}) SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT, DISPLAY_CUTOUT}) public @interface InsetsType { } Loading Loading @@ -1357,6 +1369,20 @@ public final class WindowInsets { return TAPPABLE_ELEMENT; } /** * Returns an insets type representing the area that used by {@link DisplayCutout}. * * <p>This is equivalent to the safe insets on {@link #getDisplayCutout()}.</p> * * @see DisplayCutout#getSafeInsetLeft() * @see DisplayCutout#getSafeInsetTop() * @see DisplayCutout#getSafeInsetRight() * @see DisplayCutout#getSafeInsetBottom() */ public static @InsetsType int displayCutout() { return DISPLAY_CUTOUT; } /** * @return All system bars. Includes {@link #statusBars()}, {@link #captionBar()} as well as * {@link #navigationBars()}, but not {@link #ime()}. Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -55520,6 +55520,7 @@ package android.view { public static final class WindowInsets.Type { method public static int captionBar(); method public static int displayCutout(); method public static int ime(); method public static int mandatorySystemGestures(); method public static int navigationBars();
core/java/android/view/DisplayCutout.java +20 −4 Original line number Diff line number Diff line Loading @@ -393,22 +393,38 @@ public final class DisplayCutout { return mSafeInsets.equals(ZERO_RECT); } /** Returns the inset from the top which avoids the display cutout in pixels. */ /** * Returns the inset from the top which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetTop() { return mSafeInsets.top; } /** Returns the inset from the bottom which avoids the display cutout in pixels. */ /** * Returns the inset from the bottom which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetBottom() { return mSafeInsets.bottom; } /** Returns the inset from the left which avoids the display cutout in pixels. */ /** * Returns the inset from the left which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetLeft() { return mSafeInsets.left; } /** Returns the inset from the right which avoids the display cutout in pixels. */ /** * Returns the inset from the right which avoids the display cutout in pixels. * * @see WindowInsets.Type#displayCutout() */ public int getSafeInsetRight() { return mSafeInsets.right; } Loading
core/java/android/view/InsetsSource.java +4 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,10 @@ public class InsetsSource implements Parcelable { : null; } public void setFrame(int left, int top, int right, int bottom) { mFrame.set(left, top, right, bottom); } public void setFrame(Rect frame) { mFrame.set(frame); } Loading
core/java/android/view/InsetsState.java +32 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.ViewRootImpl.sNewInsetsMode; import static android.view.WindowInsets.Type.MANDATORY_SYSTEM_GESTURES; import static android.view.WindowInsets.Type.SIZE; import static android.view.WindowInsets.Type.SYSTEM_GESTURES; import static android.view.WindowInsets.Type.displayCutout; import static android.view.WindowInsets.Type.ime; import static android.view.WindowInsets.Type.indexOf; import static android.view.WindowInsets.Type.isVisibleInsetsType; Loading Loading @@ -71,6 +72,10 @@ public class InsetsState implements Parcelable { ITYPE_RIGHT_GESTURES, ITYPE_TOP_TAPPABLE_ELEMENT, ITYPE_BOTTOM_TAPPABLE_ELEMENT, ITYPE_LEFT_DISPLAY_CUTOUT, ITYPE_TOP_DISPLAY_CUTOUT, ITYPE_RIGHT_DISPLAY_CUTOUT, ITYPE_BOTTOM_DISPLAY_CUTOUT, ITYPE_IME }) public @interface InternalInsetsType {} Loading @@ -88,8 +93,13 @@ public class InsetsState implements Parcelable { public static final int ITYPE_TOP_TAPPABLE_ELEMENT = 7; public static final int ITYPE_BOTTOM_TAPPABLE_ELEMENT = 8; public static final int ITYPE_LEFT_DISPLAY_CUTOUT = 9; public static final int ITYPE_TOP_DISPLAY_CUTOUT = 10; public static final int ITYPE_RIGHT_DISPLAY_CUTOUT = 11; public static final int ITYPE_BOTTOM_DISPLAY_CUTOUT = 12; /** Input method window. */ public static final int ITYPE_IME = 9; public static final int ITYPE_IME = 13; static final int LAST_TYPE = ITYPE_IME; Loading Loading @@ -185,8 +195,8 @@ public class InsetsState implements Parcelable { final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST; return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound, alwaysConsumeSystemBars, cutout, softInputAdjustMode == SOFT_INPUT_ADJUST_RESIZE ? systemBars() | ime() : systemBars(), ? systemBars() | displayCutout() | ime() : systemBars() | displayCutout(), sNewInsetsMode == NEW_INSETS_MODE_FULL && (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0); } Loading Loading @@ -358,6 +368,12 @@ public class InsetsState implements Parcelable { if ((types & Type.CAPTION_BAR) != 0) { result.add(ITYPE_CAPTION_BAR); } if ((types & Type.DISPLAY_CUTOUT) != 0) { result.add(ITYPE_LEFT_DISPLAY_CUTOUT); result.add(ITYPE_TOP_DISPLAY_CUTOUT); result.add(ITYPE_RIGHT_DISPLAY_CUTOUT); result.add(ITYPE_BOTTOM_DISPLAY_CUTOUT); } if ((types & Type.IME) != 0) { result.add(ITYPE_IME); } Loading Loading @@ -388,6 +404,11 @@ public class InsetsState implements Parcelable { case ITYPE_TOP_TAPPABLE_ELEMENT: case ITYPE_BOTTOM_TAPPABLE_ELEMENT: return Type.TAPPABLE_ELEMENT; case ITYPE_LEFT_DISPLAY_CUTOUT: case ITYPE_TOP_DISPLAY_CUTOUT: case ITYPE_RIGHT_DISPLAY_CUTOUT: case ITYPE_BOTTOM_DISPLAY_CUTOUT: return Type.DISPLAY_CUTOUT; default: throw new IllegalArgumentException("Unknown type: " + type); } Loading Loading @@ -437,6 +458,14 @@ public class InsetsState implements Parcelable { return "ITYPE_TOP_TAPPABLE_ELEMENT"; case ITYPE_BOTTOM_TAPPABLE_ELEMENT: return "ITYPE_BOTTOM_TAPPABLE_ELEMENT"; case ITYPE_LEFT_DISPLAY_CUTOUT: return "ITYPE_LEFT_DISPLAY_CUTOUT"; case ITYPE_TOP_DISPLAY_CUTOUT: return "ITYPE_TOP_DISPLAY_CUTOUT"; case ITYPE_RIGHT_DISPLAY_CUTOUT: return "ITYPE_RIGHT_DISPLAY_CUTOUT"; case ITYPE_BOTTOM_DISPLAY_CUTOUT: return "ITYPE_BOTTOM_DISPLAY_CUTOUT"; case ITYPE_IME: return "ITYPE_IME"; default: Loading
core/java/android/view/WindowInsets.java +30 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import static android.view.WindowInsets.Type.DISPLAY_CUTOUT; import static android.view.WindowInsets.Type.FIRST; import static android.view.WindowInsets.Type.IME; import static android.view.WindowInsets.Type.LAST; Loading Loading @@ -1209,6 +1210,13 @@ public final class WindowInsets { @NonNull public Builder setDisplayCutout(@Nullable DisplayCutout displayCutout) { mDisplayCutout = displayCutout != null ? displayCutout : DisplayCutout.NO_CUTOUT; if (!mDisplayCutout.isEmpty()) { final Insets safeInsets = Insets.of(mDisplayCutout.getSafeInsets()); final int index = indexOf(DISPLAY_CUTOUT); mTypeInsetsMap[index] = safeInsets; mTypeMaxInsetsMap[index] = safeInsets; mTypeVisibilityMap[index] = true; } return this; } Loading Loading @@ -1256,8 +1264,10 @@ public final class WindowInsets { static final int MANDATORY_SYSTEM_GESTURES = 1 << 5; static final int TAPPABLE_ELEMENT = 1 << 6; static final int LAST = 1 << 7; static final int SIZE = 8; static final int DISPLAY_CUTOUT = 1 << 7; static final int LAST = 1 << 8; static final int SIZE = 9; static final int WINDOW_DECOR = LAST; static int indexOf(@InsetsType int type) { Loading @@ -1276,8 +1286,10 @@ public final class WindowInsets { return 5; case TAPPABLE_ELEMENT: return 6; case WINDOW_DECOR: case DISPLAY_CUTOUT: return 7; case WINDOW_DECOR: return 8; default: throw new IllegalArgumentException("type needs to be >= FIRST and <= LAST," + " type=" + type); Loading @@ -1290,7 +1302,7 @@ public final class WindowInsets { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = {STATUS_BARS, NAVIGATION_BARS, CAPTION_BAR, IME, WINDOW_DECOR, SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT}) SYSTEM_GESTURES, MANDATORY_SYSTEM_GESTURES, TAPPABLE_ELEMENT, DISPLAY_CUTOUT}) public @interface InsetsType { } Loading Loading @@ -1357,6 +1369,20 @@ public final class WindowInsets { return TAPPABLE_ELEMENT; } /** * Returns an insets type representing the area that used by {@link DisplayCutout}. * * <p>This is equivalent to the safe insets on {@link #getDisplayCutout()}.</p> * * @see DisplayCutout#getSafeInsetLeft() * @see DisplayCutout#getSafeInsetTop() * @see DisplayCutout#getSafeInsetRight() * @see DisplayCutout#getSafeInsetBottom() */ public static @InsetsType int displayCutout() { return DISPLAY_CUTOUT; } /** * @return All system bars. Includes {@link #statusBars()}, {@link #captionBar()} as well as * {@link #navigationBars()}, but not {@link #ime()}. Loading