Added in API level 31

Builder


class Builder
kotlin.Any
   ↳ android.hardware.lights.LightsRequest.Builder

Builder for creating device light change requests.

Summary

Public constructors

Public methods
LightsRequest.Builder
addLight(light: Light, state: LightState)

Overrides the color and intensity of a given light.

LightsRequest

Create a LightsRequest object used to override lights on the device.

LightsRequest.Builder
clearLight(light: Light)

Removes the override for the color and intensity of a given light.

LightsRequest.Builder

Applies an effect to a set of lights configured in the effect object.

Public constructors

Builder

Builder()

Public methods

addLight

Added in API level 31
fun addLight(
    light: Light,
    state: LightState
): LightsRequest.Builder

Overrides the color and intensity of a given light.

Parameters
light Light: the light to modify.
This value cannot be null.
state LightState: the desired color and intensity of the light.
This value cannot be null.
Return
LightsRequest.Builder This value cannot be null.

build

Added in API level 31
fun build(): LightsRequest

Create a LightsRequest object used to override lights on the device.

The generated LightsRequest should be used in LightsManager.LightsSession.requestLights(LightsRequest).

Return
LightsRequest This value cannot be null.

clearLight

Added in API level 31
fun clearLight(light: Light): LightsRequest.Builder

Removes the override for the color and intensity of a given light.

Parameters
light Light: the light to modify.
This value cannot be null.
Return
LightsRequest.Builder This value cannot be null.

setEffect

Added in API level 31
fun setEffect(effect: MultiLightEffect): LightsRequest.Builder

Applies an effect to a set of lights configured in the effect object.

The system allows a maximum of one effect playing per session plus an additional slot for a non-preemptive effect waiting to be played, which means applications must combine all light effects in to a single MultiLightEffect to play animations with multiple lights.

If another session with higher priority is currently using a light needed by this effect, the effect will not play until the current session has control of all the lights it needs for playback. In a similar way, if the effect is playing and this or another session with higher priority requests a light needed by this effect, the effect will stop playing as if it was preempted.

Parameters
effect MultiLightEffect: the light effect ot add to the request.
This value cannot be null.
Return
LightsRequest.Builder This value cannot be null.