# DisplayCutoutCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/view/DisplayCutoutCompat.java+class:androidx.core.view.DisplayCutoutCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public final class DisplayCutoutCompat
```

<br />

*** ** * ** ***

Represents the area of the display that is not functional for displaying content.

`DisplayCutoutCompat` instances are immutable.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#DisplayCutoutCompat(android.graphics.Rect,java.util.List<android.graphics.Rect>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html safeInsets, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/graphics/Rect.html> boundingRects )` Creates a DisplayCutout instance. |
| `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#DisplayCutoutCompat(androidx.core.graphics.Insets,android.graphics.Rect,android.graphics.Rect,android.graphics.Rect,android.graphics.Rect,androidx.core.graphics.Insets)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets safeInsets, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundLeft, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundTop, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundRight, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundBottom, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets waterfallInsets )` Creates a DisplayCutout instance. |
| `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#DisplayCutoutCompat(androidx.core.graphics.Insets,android.graphics.Rect,android.graphics.Rect,android.graphics.Rect,android.graphics.Rect,androidx.core.graphics.Insets,android.graphics.Path)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets safeInsets, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundLeft, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundTop, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundRight, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundBottom, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets waterfallInsets, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Path.html cutoutPath )` Creates a DisplayCutout instance. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html o)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/graphics/Rect.html>` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getBoundingRects()()` Returns a list of `Rect`s, each of which is the bounding rectangle for a non-functional area on the display. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getCutoutPath()()` Returns a Path that contains the cutout paths of all sides on the display. |
| `int` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetBottom()()` Returns the inset from the bottom which avoids the display cutout in pixels. |
| `int` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetLeft()()` Returns the inset from the left which avoids the display cutout in pixels. |
| `int` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetRight()()` Returns the inset from the right which avoids the display cutout in pixels. |
| `int` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop()()` Returns the inset from the top which avoids the display cutout in pixels. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getWaterfallInsets()()` Returns the insets representing the curved areas of a waterfall display. |
| `int` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#hashCode()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#toString()()` |

## Public constructors

### DisplayCutoutCompat

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public DisplayCutoutCompat(
    @Nullable Rect safeInsets,
    @Nullable List<Rect> boundingRects
)
```

Creates a DisplayCutout instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html safeInsets` | the insets from each edge which avoid the display cutout as returned by `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop()` etc. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/graphics/Rect.html> boundingRects` | the bounding rects of the display cutouts as returned by `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getBoundingRects()` ()}. |

### DisplayCutoutCompat

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
public DisplayCutoutCompat(
    @NonNull Insets safeInsets,
    @Nullable Rect boundLeft,
    @Nullable Rect boundTop,
    @Nullable Rect boundRight,
    @Nullable Rect boundBottom,
    @NonNull Insets waterfallInsets
)
```

Creates a DisplayCutout instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets safeInsets` | the insets from each edge which avoid the display cutout as returned by `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop()` etc. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundLeft` | the left bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundTop` | the top bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundRight` | the right bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundBottom` | the bottom bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets waterfallInsets` | the insets for the curved areas in waterfall display. |

### DisplayCutoutCompat

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
public DisplayCutoutCompat(
    @NonNull Insets safeInsets,
    @Nullable Rect boundLeft,
    @Nullable Rect boundTop,
    @Nullable Rect boundRight,
    @Nullable Rect boundBottom,
    @NonNull Insets waterfallInsets,
    @Nullable Path cutoutPath
)
```

Creates a DisplayCutout instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets safeInsets` | the insets from each edge which avoid the display cutout as returned by `https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop()` etc. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundLeft` | the left bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundTop` | the top bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundRight` | the right bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Rect.html boundBottom` | the bottom bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0). |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets waterfallInsets` | the insets for the curved areas in waterfall display. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Path.html cutoutPath` | the path of the display cutout. Specifying a path with this constructor is only supported on API 33 and above, even though a real DisplayCutout can have a cutout path on API 31 and above. On API 32 and below, this path is ignored. |

## Public methods

### equals

```
public boolean equals(Object o)
```

### getBoundingRects

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public @NonNull List<Rect> getBoundingRects()
```

Returns a list of `Rect`s, each of which is the bounding rectangle for a non-functional area on the display. There will be at most one non-functional area per short edge of the device, and none on the long edges.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/graphics/Rect.html>` | a list of bounding `Rect`s, one for each display cutout area. |

### getCutoutPath

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
public @Nullable Path getCutoutPath()
```

Returns a Path that contains the cutout paths of all sides on the display. To get a cutout path for one specific side, apps can intersect the Path with the Rect obtained from getBoundingRectLeft(), getBoundingRectTop(), getBoundingRectRight() or getBoundingRectBottom().

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/Path.html` | the path corresponding to the cutout, or null if there is no cutout on the display. |

### getSafeInsetBottom

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public int getSafeInsetBottom()
```

Returns the inset from the bottom which avoids the display cutout in pixels.

### getSafeInsetLeft

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public int getSafeInsetLeft()
```

Returns the inset from the left which avoids the display cutout in pixels.

### getSafeInsetRight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public int getSafeInsetRight()
```

Returns the inset from the right which avoids the display cutout in pixels.

### getSafeInsetTop

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public int getSafeInsetTop()
```

Returns the inset from the top which avoids the display cutout in pixels.

### getWaterfallInsets

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
public @NonNull Insets getWaterfallInsets()
```

Returns the insets representing the curved areas of a waterfall display. A waterfall display has curved areas along the edges of the screen. Apps should be careful when showing UI and handling touch input in those insets because the curve may impair legibility and can frequently lead to unintended touch inputs.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/graphics/Insets` | the insets for the curved areas of a waterfall display in pixels or ` Insets.NONE` if there are no curved areas or they don't overlap with the window. |

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```