# DisplayCutoutCompat

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/DisplayCutoutCompat "View this page in Java")

<br />

```
class DisplayCutoutCompat
```

<br />

*** ** * ** ***

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

`DisplayCutoutCompat`instances are immutable.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ### Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DisplayCutoutCompat](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#DisplayCutoutCompat(android.graphics.Rect,java.util.List<android.graphics.Rect>))`(safeInsets: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?, boundingRects: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`!>?)` Creates a DisplayCutout instance.                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [DisplayCutoutCompat](https://developer.android.com/reference/kotlin/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))`(` ` safeInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)`,` ` boundLeft: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundTop: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundRight: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundBottom: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` waterfallInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets) `)` Creates a DisplayCutout instance.                                                                                                                       |
| [DisplayCutoutCompat](https://developer.android.com/reference/kotlin/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))`(` ` safeInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)`,` ` boundLeft: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundTop: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundRight: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` boundBottom: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?,` ` waterfallInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)`,` ` cutoutPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`?` `)` Creates a DisplayCutout instance. |

|                                                                                                                                 ### Public functions                                                                                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                  | [equals](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#equals(java.lang.Object))`(o: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)`                                |
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`!>` | [getBoundingRects](https://developer.android.com/reference/kotlin/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. |
| [Path](https://developer.android.com/reference/android/graphics/Path.html)`?`                                                                                                                                                                                                        | [getCutoutPath](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getCutoutPath())`()` Returns a Path that contains the cutout paths of all sides on the display.                                        |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                          | [getSafeInsetBottom](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetBottom())`()` Returns the inset from the bottom which avoids the display cutout in pixels.                            |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                          | [getSafeInsetLeft](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetLeft())`()` Returns the inset from the left which avoids the display cutout in pixels.                                  |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                          | [getSafeInsetRight](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetRight())`()` Returns the inset from the right which avoids the display cutout in pixels.                               |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                          | [getSafeInsetTop](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop())`()` Returns the inset from the top which avoids the display cutout in pixels.                                     |
| [Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)                                                                                                                                                                                               | [getWaterfallInsets](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getWaterfallInsets())`()` Returns the insets representing the curved areas of a waterfall display.                                |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                          | [hashCode](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#hashCode())`()`                                                                                                                             |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                    | [toString](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#toString())`()`                                                                                                                             |

## Public constructors

### DisplayCutoutCompat

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

```
DisplayCutoutCompat(safeInsets: Rect?, boundingRects: (Mutable)List<Rect!>?)
```

Creates a DisplayCutout instance.  

|                                                                                                                                              Parameters                                                                                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `safeInsets: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`                                                                                                                                                                                                          | the insets from each edge which avoid the display cutout as returned by[getSafeInsetTop](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop())etc. |
| `boundingRects: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`!>?` | the bounding rects of the display cutouts as returned by[getBoundingRects](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getBoundingRects())()}.              |

### DisplayCutoutCompat

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

```
DisplayCutoutCompat(
    safeInsets: Insets,
    boundLeft: Rect?,
    boundTop: Rect?,
    boundRight: Rect?,
    boundBottom: Rect?,
    waterfallInsets: Insets
)
```

Creates a DisplayCutout instance.  

|                                                Parameters                                                 |
|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `safeInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)      | the insets from each edge which avoid the display cutout as returned by[getSafeInsetTop](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop())etc. |
| `boundLeft: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`                | 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).                                                                            |
| `boundTop: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`                 | 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).                                                                             |
| `boundRight: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`               | 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).                                                                           |
| `boundBottom: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`              | 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).                                                                          |
| `waterfallInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets) | 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)  

```
DisplayCutoutCompat(
    safeInsets: Insets,
    boundLeft: Rect?,
    boundTop: Rect?,
    boundRight: Rect?,
    boundBottom: Rect?,
    waterfallInsets: Insets,
    cutoutPath: Path?
)
```

Creates a DisplayCutout instance.  

|                                                Parameters                                                 |
|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `safeInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets)      | the insets from each edge which avoid the display cutout as returned by[getSafeInsetTop](https://developer.android.com/reference/kotlin/androidx/core/view/DisplayCutoutCompat#getSafeInsetTop())etc.                                  |
| `boundLeft: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`                | 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).                                                                                                             |
| `boundTop: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`                 | 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).                                                                                                              |
| `boundRight: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`               | 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).                                                                                                            |
| `boundBottom: `[Rect](https://developer.android.com/reference/android/graphics/Rect.html)`?`              | 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).                                                                                                           |
| `waterfallInsets: `[Insets](https://developer.android.com/reference/kotlin/androidx/core/graphics/Insets) | the insets for the curved areas in waterfall display.                                                                                                                                                                                  |
| `cutoutPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`?`               | 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 functions

### equals

```
fun equals(o: Any!): Boolean
```  

### getBoundingRects

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

```
fun getBoundingRects(): (Mutable)List<Rect!>
```

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                                                                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Rect](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)  

```
fun getCutoutPath(): Path?
```

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                                    |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| [Path](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)  

```
fun getSafeInsetBottom(): Int
```

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)  

```
fun getSafeInsetLeft(): Int
```

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)  

```
fun getSafeInsetRight(): Int
```

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)  

```
fun getSafeInsetTop(): Int
```

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)  

```
fun getWaterfallInsets(): Insets
```

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                                         |
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Insets](https://developer.android.com/reference/kotlin/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

```
fun hashCode(): Int
```  

### toString

```
fun toString(): String
```