diff options
author | Nick Armstrong-Crews <strongarm@google.com> | 2015-09-07 21:46:50 -0700 |
---|---|---|
committer | Nick Armstrong-Crews <strongarm@google.com> | 2015-09-07 21:46:50 -0700 |
commit | 56ecfcce6c88fc80cf509effcebb124bbe0c79f8 (patch) | |
tree | 1bd9da19b554a4aa287707b9917a49076ba66271 /core | |
parent | 9b8f82a3a073891965a962251f9e613ba8cc90bb (diff) | |
download | frameworks_base-56ecfcce6c88fc80cf509effcebb124bbe0c79f8.zip frameworks_base-56ecfcce6c88fc80cf509effcebb124bbe0c79f8.tar.gz frameworks_base-56ecfcce6c88fc80cf509effcebb124bbe0c79f8.tar.bz2 |
Handle KEYCODE_SOFT_SLEEP from Ungaze.
Needed for Ungaze to trigger "soft sleep" (respecting wake locks); operates by
sending new KEYCODE_SOFT_SLEEP to PhoneWindowManager, which calls
PowerManagerService's new method setUserInactiveOverride (thereby
causing immediate sleep, modulo wakelocks, upon next iteration of
PowerManagerService's main loop).
BUG: b/23589870
Change-Id: Iddafdde923605d119075e890eeda5d3fd3fd2bc7
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/os/PowerManagerInternal.java | 6 | ||||
-rw-r--r-- | core/java/android/view/KeyEvent.java | 5 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/core/java/android/os/PowerManagerInternal.java b/core/java/android/os/PowerManagerInternal.java index e742f98..70cff00 100644 --- a/core/java/android/os/PowerManagerInternal.java +++ b/core/java/android/os/PowerManagerInternal.java @@ -108,6 +108,12 @@ public abstract class PowerManagerInternal { public abstract void setUserActivityTimeoutOverrideFromWindowManager(long timeoutMillis); /** + * Used by the window manager to tell the power manager that the user is no longer actively + * using the device. + */ + public abstract void setUserInactiveOverrideFromWindowManager(); + + /** * Used by device administration to set the maximum screen off timeout. * * This method must only be called by the device administration policy manager. diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 52852e7..052ef7c 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -784,8 +784,11 @@ public class KeyEvent extends InputEvent implements Parcelable { /** Key code constant: Step backward media key. * Steps media backward, one frame at a time. */ public static final int KEYCODE_MEDIA_STEP_BACKWARD = 275; + /** Key code constant: put device to sleep unless a wakelock is held. + * @hide */ + public static final int KEYCODE_SOFT_SLEEP = 276; - private static final int LAST_KEYCODE = KEYCODE_MEDIA_STEP_BACKWARD; + private static final int LAST_KEYCODE = KEYCODE_SOFT_SLEEP; // NOTE: If you add a new keycode here you must also add it to: // isSystem() diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a024656..cf83422 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1814,6 +1814,7 @@ i <enum name="KEYCODE_MEDIA_SKIP_BACKWARD" value="273" /> <enum name="KEYCODE_MEDIA_STEP_FORWARD" value="274" /> <enum name="KEYCODE_MEDIA_STEP_BACKWARD" value="275" /> + <enum name="KEYCODE_SOFT_SLEEP" value="276" /> </attr> <!-- ***************************************************************** --> |