Added in API level 31

Light

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

Represents a logical light on the device.

Summary

Constants
static Int

Capability for lights that could adjust its LED brightness.

static Int

Capability for lights that have red, green and blue LEDs to control the light's color.

static Int

Capability for lights that have red, green and blue LEDs to control the light's color.

static Int

Type for lights that indicate a monochrome color LED light.

static Int

Type for lights that illuminate keyboard keys.

static Int

Type for lights that indicate microphone usage

static Int

Type for lights that indicate a group of LED lights representing player id.

Inherited constants
Public methods
Int

Implement the Parcelable interface

Boolean
equals(other: Any?)

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

Int

Returns the id of the light.

String

Returns the name of the light.

Int

Returns the ordinal of the light.

Int

Returns the logical type of the light.

Boolean

Check whether the light has led brightness control.

Boolean

Check whether the light has RGB led control.

Int

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Implement the Parcelable interface

Properties
static Parcelable.Creator<Light!>

Implement the Parcelable interface

Constants

LIGHT_CAPABILITY_BRIGHTNESS

Added in API level 31
static val LIGHT_CAPABILITY_BRIGHTNESS: Int

Capability for lights that could adjust its LED brightness. If the capability is not present the LED can only be turned either on or off.

Value: 1

LIGHT_CAPABILITY_COLOR_RGB

Added in API level 34
static val LIGHT_CAPABILITY_COLOR_RGB: Int

Capability for lights that have red, green and blue LEDs to control the light's color.

Value: 2

LIGHT_CAPABILITY_RGB

Added in API level 31
Deprecated in API level 34
static val LIGHT_CAPABILITY_RGB: Int

Deprecated: Wrong int based flag with value 0. Use capability flag LIGHT_CAPABILITY_COLOR_RGB instead.

Capability for lights that have red, green and blue LEDs to control the light's color.

Value: 0

LIGHT_TYPE_INPUT

Added in API level 31
static val LIGHT_TYPE_INPUT: Int

Type for lights that indicate a monochrome color LED light.

Value: 10001

LIGHT_TYPE_KEYBOARD_BACKLIGHT

Added in API level 34
static val LIGHT_TYPE_KEYBOARD_BACKLIGHT: Int

Type for lights that illuminate keyboard keys.

Value: 10003

LIGHT_TYPE_MICROPHONE

Added in API level 31
static val LIGHT_TYPE_MICROPHONE: Int

Type for lights that indicate microphone usage

Value: 8

LIGHT_TYPE_PLAYER_ID

Added in API level 31
static val LIGHT_TYPE_PLAYER_ID: Int

Type for lights that indicate a group of LED lights representing player id. Player id lights normally present on game controllers are lights that consist of a row of LEDs. During multi-player game, the player id for the current game controller is represented by one of the LED that is lit according to its position in the row.

Value: 10002

Public methods

describeContents

Added in API level 31
fun describeContents(): Int

Implement the Parcelable interface

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

equals

Added in API level 31
fun equals(other: Any?): Boolean

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

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj This value may be null.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getId

Added in API level 31
fun getId(): Int

Returns the id of the light.

This is an opaque value used as a unique identifier for the light.

getName

Added in API level 31
fun getName(): String

Returns the name of the light.

Return
String This value cannot be null.

getOrdinal

Added in API level 31
fun getOrdinal(): Int

Returns the ordinal of the light.

This is a sort key that represents the physical order of lights on the device with the same type. In the case of multiple lights arranged in a line, for example, the ordinals could be [1, 2, 3, 4], or [0, 10, 20, 30], or any other values that have the same sort order.

hasBrightnessControl

Added in API level 31
fun hasBrightnessControl(): Boolean

Check whether the light has led brightness control.

Return
Boolean True if the hardware can control the led brightness, otherwise false.

hasRgbControl

Added in API level 31
fun hasRgbControl(): Boolean

Check whether the light has RGB led control.

Return
Boolean True if the hardware can control the RGB led, otherwise false.

hashCode

Added in API level 31
fun hashCode(): Int
Return
Int a hash code value for this object.

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

Implement the Parcelable interface

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<Light!>

Implement the Parcelable interface