DisplayCutout.Builder


public static final class DisplayCutout.Builder
extends Object

java.lang.Object
   ↳ android.view.DisplayCutout.Builder


A Builder class to construct a DisplayCutout instance.

Note that this is only for tests purpose. For production code, developers should always use a DisplayCutout obtained from the system.

Summary

Public constructors

Builder()

Begin building a DisplayCutout.

Public methods

DisplayCutout build()

Construct a new DisplayCutout with the set parameters.

DisplayCutout.Builder setBoundingRectBottom(Rect boundingRectBottom)

Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen.

DisplayCutout.Builder setBoundingRectLeft(Rect boundingRectLeft)

Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen.

DisplayCutout.Builder setBoundingRectRight(Rect boundingRectRight)

Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen.

DisplayCutout.Builder setBoundingRectTop(Rect boundingRectTop)

Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen.

DisplayCutout.Builder setCutoutPath(Path cutoutPath)

Set the cutout Path.

DisplayCutout.Builder setSafeInsets(Insets safeInsets)

Set the safe insets.

DisplayCutout.Builder setWaterfallInsets(Insets waterfallInsets)

Set the waterfall insets of the DisplayCutout.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

Added in API level 33
public Builder ()

Begin building a DisplayCutout.

Public methods

build

Added in API level 33
public DisplayCutout build ()

Construct a new DisplayCutout with the set parameters.

Returns
DisplayCutout This value cannot be null.

setBoundingRectBottom

Added in API level 33
public DisplayCutout.Builder setBoundingRectBottom (Rect boundingRectBottom)

Set a bounding rectangle for a non-functional area on the display which is located on the bottom of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectBottom Rect: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectLeft

Added in API level 33
public DisplayCutout.Builder setBoundingRectLeft (Rect boundingRectLeft)

Set a bounding rectangle for a non-functional area on the display which is located on the left of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectLeft Rect: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectRight

Added in API level 33
public DisplayCutout.Builder setBoundingRectRight (Rect boundingRectRight)

Set a bounding rectangle for a non-functional area on the display which is located on the right of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectRight Rect: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setBoundingRectTop

Added in API level 33
public DisplayCutout.Builder setBoundingRectTop (Rect boundingRectTop)

Set a bounding rectangle for a non-functional area on the display which is located on the top of the screen. If not set, the default value is an empty rectangle.

Parameters
boundingRectTop Rect: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setCutoutPath

Added in API level 33
public DisplayCutout.Builder setCutoutPath (Path cutoutPath)

Set the cutout Path. Note that not support creating/testing multiple display cutouts with setCutoutPath() in parallel.

Parameters
cutoutPath Path: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setSafeInsets

Added in API level 33
public DisplayCutout.Builder setSafeInsets (Insets safeInsets)

Set the safe insets. If not set, the default value is Insets.NONE.

Parameters
safeInsets Insets: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.

setWaterfallInsets

Added in API level 33
public DisplayCutout.Builder setWaterfallInsets (Insets waterfallInsets)

Set the waterfall insets of the DisplayCutout. If not set, the default value is Insets.NONE

Parameters
waterfallInsets Insets: This value cannot be null.

Returns
DisplayCutout.Builder This value cannot be null.