Merge "power: Adds a new power hint POWER_HINT_LOW_POWER"
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index de4ac0d..9327c41 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -436,10 +436,14 @@
 /*
  * The sensors below are wake_up variants of the base sensor types defined
  * above. When registered in batch mode, these sensors will wake up the AP when
- * their FIFOs are full. A separate FIFO has to be maintained for wake up
- * sensors and non wake up sensors. The non wake-up sensors need to overwrite
- * their FIFOs when they are full till the AP wakes up and the wake-up sensors
- * will wake-up the AP when their FIFOs are full without losing events.
+ * their FIFOs are full or when the batch timeout expires. A separate FIFO has
+ * to be maintained for wake up sensors and non wake up sensors. The non wake-up
+ * sensors need to overwrite their FIFOs when they are full till the AP wakes up
+ * and the wake-up sensors will wake-up the AP when their FIFOs are full or when
+ * the batch timeout expires without losing events.
+ * Note: Sensors of type SENSOR_TYPE_PROXIMITY are also wake up sensors and
+ * should be treated as such. Wake-up one-shot sensors like SIGNIFICANT_MOTION
+ * cannot be batched, hence the text about batch above doesn't apply to them.
  *
  * Define these sensors only if:
  * 1) batching is supported.
@@ -503,6 +507,53 @@
 #define SENSOR_TYPE_WAKE_UP_HEART_RATE                         (40)
 #define SENSOR_STRING_TYPE_WAKE_UP_HEART_RATE                  "android.sensor.wake_up_heart_rate"
 
+/*
+ * SENSOR_TYPE_WAKE_UP_TILT_DETECTOR
+ * trigger-mode: special (setDelay has no impact)
+ * wake-up sensor: yes (set SENSOR_FLAG_WAKE_UP flag)
+ *
+ * A sensor of this type generates an event each time a tilt event is detected. A tilt event
+ * should be generated if the direction of the 2-seconds window average gravity changed by at least
+ * 35 degrees since the activation of the sensor.
+ *     initial_estimated_gravity = average of accelerometer measurements over the first
+ *                                 1 second after activation.
+ *     current_estimated_gravity = average of accelerometer measurements over the last 2 seconds.
+ *     trigger when angle (initial_estimated_gravity, current_estimated_gravity) > 35 degrees
+ *
+ * Large accelerations without a change in phone orientation should not trigger a tilt event.
+ * For example, a sharp turn or strong acceleration while driving a car should not trigger a tilt
+ * event, even though the angle of the average acceleration might vary by more than 35 degrees.
+ *
+ * Typically, this sensor is implemented with the help of only an accelerometer. Other sensors can
+ * be used as well if they do not increase the power consumption significantly. This is a low power
+ * sensor that should allow the AP to go into suspend mode. Do not emulate this sensor in the HAL.
+ * Like other wake up sensors, the driver is expected to a hold a wake_lock with a timeout of 200 ms
+ * while reporting this event. The only allowed return value is 1.0.
+ */
+#define SENSOR_TYPE_WAKE_UP_TILT_DETECTOR                      (41)
+#define SENSOR_STRING_TYPE_WAKE_UP_TILT_DETECTOR               "android.sensor.wake_up_tilt_detector"
+
+/*
+ * SENSOR_TYPE_WAKE_GESTURE
+ * trigger-mode: one-shot
+ * wake-up sensor: yes (set SENSOR_FLAG_WAKE_UP flag)
+ *
+ * A sensor enabling waking up the device based on a device specific motion.
+ *
+ * When this sensor triggers, the device behaves as if the power button was
+ * pressed, turning the screen on. This behavior (turning on the screen when
+ * this sensor triggers) might be deactivated by the user in the device
+ * settings. Changes in settings do not impact the behavior of the sensor:
+ * only whether the framework turns the screen on when it triggers.
+ *
+ * The actual gesture to be detected is not specified, and can be chosen by
+ * the manufacturer of the device.
+ * This sensor must be low power, as it is likely to be activated 24/7.
+ * The only allowed value to return is 1.0.
+ */
+#define SENSOR_TYPE_WAKE_GESTURE                               (42)
+#define SENSOR_STRING_TYPE_WAKE_GESTURE                        "android.sensor.wake_gesture"
+
 /**
  * Values returned by the accelerometer in various locations in the universe.
  * all values are in SI units (m/s^2)
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp
index f7177a3..135e740 100644
--- a/modules/sensors/multihal.cpp
+++ b/modules/sensors/multihal.cpp
@@ -588,7 +588,7 @@
     common :{
         tag : HARDWARE_MODULE_TAG,
         version_major : 1,
-        version_minor : 0,
+        version_minor : 1,
         id : SENSORS_HARDWARE_MODULE_ID,
         name : "MultiHal Sensor Module",
         author : "Google, Inc",
@@ -609,7 +609,7 @@
     sensors_poll_context_t *dev = new sensors_poll_context_t();
     memset(dev, 0, sizeof(sensors_poll_device_1_t));
     dev->proxy_device.common.tag = HARDWARE_DEVICE_TAG;
-    dev->proxy_device.common.version = SENSORS_DEVICE_API_VERSION_1_0;
+    dev->proxy_device.common.version = SENSORS_DEVICE_API_VERSION_1_1;
     dev->proxy_device.common.module = const_cast<hw_module_t*>(hw_module);
     dev->proxy_device.common.close = device__close;
     dev->proxy_device.activate = device__activate;