LightsRequest.Builder


public static final class LightsRequest.Builder
extends Object

java.lang.Object
   ↳ android.hardware.lights.LightsRequest.Builder


Builder for creating device light change requests.

Summary

Public constructors

Builder()

Public methods

LightsRequest.Builder addLight(Light light, LightState state)

Overrides the color and intensity of a given light.

LightsRequest build()

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 setEffect(MultiLightEffect effect)

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

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

addLight

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

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.

Returns
LightsRequest.Builder This value cannot be null.

build

Added in API level 31
public LightsRequest build ()

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

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

Returns
LightsRequest This value cannot be null.

clearLight

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

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

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

Returns
LightsRequest.Builder This value cannot be null.

setEffect

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

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.

Returns
LightsRequest.Builder This value cannot be null.