Implement auto-sleep functionality.
Added a new SLEEP_TIMEOUT setting which governs how long the device will
remain awake or dreaming without user activity. By default this
value is set to -1 which maintains today's existing behavior.
We basically represent the time we are allowed to be dreaming as a new
kind of user activity summary state called DREAM, similar to BRIGHT
and DIM. When the sleep timeout expires, the state is cleared and
the dream ends.
Bug: 17665809
Change-Id: I59aa7648dcec215f1285464fc1134934a09230e5
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ec4a53e..e40c88f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2001,7 +2001,10 @@
public static final String DIM_SCREEN = "dim_screen";
/**
- * The timeout before the screen turns off.
+ * The amount of time in milliseconds before the device goes to sleep or begins
+ * to dream after a period of inactivity. This value is also known as the
+ * user activity timeout period since the screen isn't necessarily turned off
+ * when it expires.
*/
public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
@@ -4817,6 +4820,20 @@
"usb_audio_automatic_routing_disabled";
/**
+ * The timeout in milliseconds before the device fully goes to sleep after
+ * a period of inactivity. This value sets an upper bound on how long the device
+ * will stay awake or dreaming without user activity. It should generally
+ * be longer than {@link #SCREEN_OFF_TIMEOUT} as otherwise the device
+ * will sleep before it ever has a chance to dream.
+ * <p>
+ * Use -1 to disable this timeout.
+ * </p>
+ *
+ * @hide
+ */
+ public static final String SLEEP_TIMEOUT = "sleep_timeout";
+
+ /**
* This are the settings to be backed up.
*
* NOTE: Settings are backed up and restored in the order they appear
@@ -4865,7 +4882,8 @@
MOUNT_UMS_AUTOSTART,
MOUNT_UMS_PROMPT,
MOUNT_UMS_NOTIFY_ENABLED,
- UI_NIGHT_MODE
+ UI_NIGHT_MODE,
+ SLEEP_TIMEOUT
};
/**