Added in API level 31

LightState


class LightState : Parcelable
kotlin.Any
   ↳ android.hardware.lights.LightState

Represents the state of a device light.

Controlling the color and brightness of a light is done on a best-effort basis. Each of the R, G and B channels represent the intensities of the respective part of an RGB LED, if that is supported. For devices that only support on or off lights, everything that's not off will turn the light on. If the light is monochrome and only the brightness can be controlled, the RGB color will be converted to only a brightness value and that will be used for the light's single channel.

Summary

Nested classes

Builder for creating device light change requests.

Inherited constants
Public methods
Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Int

Returns the color and intensity associated with this LightState.

Int

Returns the player ID associated with this LightState for Light with type android.hardware.lights.Light#LIGHT_TYPE_PLAYER_ID, or 0 for other types.

String

Returns a string representation of the object.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<LightState!>

Public methods

describeContents

Added in API level 31
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getColor

Added in API level 31
fun getColor(): Int

Returns the color and intensity associated with this LightState.

Return
Int the color and intensity in ARGB format. The A channel is ignored. return 0 when calling LightsManager.getLightState with android.hardware.lights.Light#LIGHT_TYPE_PLAYER_ID.

getPlayerId

Added in API level 31
fun getPlayerId(): Int

Returns the player ID associated with this LightState for Light with type android.hardware.lights.Light#LIGHT_TYPE_PLAYER_ID, or 0 for other types.

Return
Int the player ID.

toString

Added in API level 31
fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 31
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:

Properties

CREATOR

Added in API level 31
static val CREATOR: Parcelable.Creator<LightState!>