lights.h File Reference
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <hardware/hardware.h>

Go to the source code of this file.

Data Structures

struct  light_state_t
struct  light_device_t


#define LIGHTS_HARDWARE_MODULE_ID   "lights"
#define LIGHT_ID_BACKLIGHT   "backlight"
#define LIGHT_ID_KEYBOARD   "keyboard"
#define LIGHT_ID_BUTTONS   "buttons"
#define LIGHT_ID_BATTERY   "battery"
#define LIGHT_ID_NOTIFICATIONS   "notifications"
#define LIGHT_ID_ATTENTION   "attention"
#define LIGHT_ID_BLUETOOTH   "bluetooth"
#define LIGHT_ID_WIFI   "wifi"
#define LIGHT_FLASH_NONE   0

Macro Definition Documentation


Use a low-persistence mode for display backlights.

When set, the device driver must switch to a mode optimized for low display persistence that is intended to be used when the device is being treated as a head mounted display (HMD). The actual display brightness in this mode is implementation dependent, and any value set for color in light_state may be overridden by the HAL implementation.

For an optimal HMD viewing experience, the display must meet the following criteria in this mode:

  • Gray-to-Gray, White-to-Black, and Black-to-White switching time must be ≤ 3 ms.
  • The display must support low-persistence with ≤ 3.5 ms persistence. Persistence is defined as the amount of time for which a pixel is emitting light for a single frame.
  • Any "smart panel" or other frame buffering options that increase display latency are disabled.
  • Display brightness is set so that the display is still visible to the user under normal indoor lighting.
  • The display must update at 60 Hz at least, but higher refresh rates are recommended for low latency.

This mode will only be used with light devices of type LIGHT_ID_BACKLIGHT, and will only be called by the Android framework for light_device_t implementations that report a version >= 2.0 in their hw_device_t common fields. If the device version is >= 2.0 and this mode is unsupported, calling set_light with this mode must return the negative error code -ENOSYS (-38) without altering any settings.

Available only for version >= LIGHTS_DEVICE_API_VERSION_2_0

Definition at line 137 of file lights.h.


Light brightness is managed by a light sensor.

Definition at line 104 of file lights.h.


Light brightness is managed by a user setting.

Definition at line 99 of file lights.h.


To flash the light using hardware assist, set flashMode to the hardware mode.

Definition at line 94 of file lights.h.

#define LIGHT_FLASH_NONE   0

Definition at line 80 of file lights.h.


To flash the light at a given rate, set flashMode to LIGHT_FLASH_TIMED, and then flashOnMS should be set to the number of milliseconds to turn the light on, followed by the number of milliseconds to turn the light off.

Definition at line 88 of file lights.h.

#define LIGHT_ID_ATTENTION   "attention"

Definition at line 66 of file lights.h.

#define LIGHT_ID_BACKLIGHT   "backlight"

Definition at line 61 of file lights.h.

#define LIGHT_ID_BATTERY   "battery"

Definition at line 64 of file lights.h.

#define LIGHT_ID_BLUETOOTH   "bluetooth"

Definition at line 73 of file lights.h.

#define LIGHT_ID_BUTTONS   "buttons"

Definition at line 63 of file lights.h.

#define LIGHT_ID_KEYBOARD   "keyboard"

Definition at line 62 of file lights.h.

#define LIGHT_ID_NOTIFICATIONS   "notifications"

Definition at line 65 of file lights.h.

#define LIGHT_ID_WIFI   "wifi"

Definition at line 74 of file lights.h.


Device API version 0.0-1.0

Base version for the device API in the lights HAL: all versions less than 2.0 are treated as being this version.

Definition at line 44 of file lights.h.


Device API version 2.0

Devices reporting this version or higher may additionally support the following modes:


Definition at line 53 of file lights.h.

#define LIGHTS_HARDWARE_MODULE_ID   "lights"

The id of this module

Definition at line 31 of file lights.h.


Header file version.

Definition at line 36 of file lights.h.