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

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

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
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

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
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 android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

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