Update lights HAL to include low-persistence mode.
Bug: 22855417
Change-Id: Ie76430025157930a3d824b7f18b5e23ba7d92f12
diff --git a/include/hardware/lights.h b/include/hardware/lights.h
index 2cf5519..b426caf 100644
--- a/include/hardware/lights.h
+++ b/include/hardware/lights.h
@@ -30,6 +30,28 @@
*/
#define LIGHTS_HARDWARE_MODULE_ID "lights"
+/**
+ * Header file version.
+ */
+#define LIGHTS_HEADER_VERSION 1
+
+/**
+ * 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.
+ */
+#define LIGHTS_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, LIGHTS_HEADER_VERSION)
+
+/**
+ * Device API version 2.0
+ *
+ * Devices reporting this version or higher may additionally support the
+ * following modes:
+ * - BRIGHTNESS_MODE_LOW_PERSISTENCE
+ */
+#define LIGHTS_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION_2(2, 0, LIGHTS_HEADER_VERSION)
+
/*
* These light IDs correspond to logical lights, not physical.
* So for example, if your INDICATOR light is in line with your
@@ -82,6 +104,34 @@
#define BRIGHTNESS_MODE_SENSOR 1
/**
+ * 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
+ * overriden by the HAL implementation.
+ *
+ * For an optimal HMD viewing experience, the display should meet the following
+ * criteria in this mode:
+ * - Less than 2ms display persistence.
+ * - 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.
+ *
+ * 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
+ */
+#define BRIGHTNESS_MODE_LOW_PERSISTENCE 2
+
+/**
* The parameters that can be set for a given light.
*
* Not all lights must support all parameters. If you