summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-01-30 21:47:47 -0800
committerJeff Brown <jeffbrown@google.com>2014-02-20 13:39:13 -0800
commit2687550272ba061448f5d5b914700dc335299ee7 (patch)
treefc68c5ecec24ec2aa120ccf490d7a56573704a73 /core/java/android/view
parentd43ad2f35abcc647f7985abd09ed9de5899faf18 (diff)
downloadframeworks_base-2687550272ba061448f5d5b914700dc335299ee7.zip
frameworks_base-2687550272ba061448f5d5b914700dc335299ee7.tar.gz
frameworks_base-2687550272ba061448f5d5b914700dc335299ee7.tar.bz2
Add a new "doze mode" based on Dream components.
When a doze component has been specified in a config.xml resource overlay, the power manager will try to start a preconfigured dream whenever it would have otherwise gone to sleep and turned the screen off. The dream should render whatever it intends to show then call startDozing() to tell the power manager to put the display into a low power "doze" state and allow the application processor to be suspended. The dream may wake up periodically using the alarm manager or other features to update the contents of the display. Added several new config.xml resources related to dreams and dozing. In particular for dozing there are two new resources that pertain to decoupling auto-suspend mode and interactive mode from the display state. This is a requirement to enable the application processor and other components to be suspended while dozing. Most devices do not support these features today. Consolidated the power manager's NAPPING and DREAMING states into one to simplify the logic. The NAPPING state was mostly superfluous and simply indicated that the power manager should attempt to start a new dream. This state is now tracked in the mSandmanSummoned field. Added a new DOZING state which is analoguous to DREAMING. The normal state transition is now: AWAKE -> DREAMING -> DOZING -> ASLEEP. The PowerManager.goToSleep() method now enters the DOZING state instead of immediately going to sleep. While in the doze state, the screen remains on. However, we actually tell the rest of the system that the screen is off. This is somewhat unfortunate but much of the system makes inappropriate assumptions about what it means for the screen to be on or off. In particular, screen on is usually taken to indicate an interactive state where the user is present but that's not at all true for dozing (and is only sometimes true while dreaming). We will probably need to add some more precise externally visible states at some point. The DozeHardware interface encapsulates a generic microcontroller interface to allow a doze dream for off-loading rendering or other functions while dozing. If the device possesses an MCU HAL for dozing then it is exposed to the DreamService here. Removed a number of catch blocks in DreamService that caught Throwable and attempted to cause the dream to finish itself. We actually just want to let the process crash. Cleanup will happen automatically if needed. Catching these exceptions results in mysterious undefined behavior and broken dreams. Bug: 12494706 Change-Id: Ie78336b37dde7250d1ce65b3d367879e3bfb2b8b
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/WindowManagerPolicy.java22
1 files changed, 3 insertions, 19 deletions
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index c5a1b86..74dda77 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -115,20 +115,6 @@ public interface WindowManagerPolicy {
public final static int ACTION_PASS_TO_USER = 0x00000001;
/**
- * This key event should wake the device.
- * To be returned from {@link #interceptKeyBeforeQueueing}.
- * Do not return this and {@link #ACTION_GO_TO_SLEEP} or {@link #ACTION_PASS_TO_USER}.
- */
- public final static int ACTION_WAKE_UP = 0x00000002;
-
- /**
- * This key event should put the device to sleep (and engage keyguard if necessary)
- * To be returned from {@link #interceptKeyBeforeQueueing}.
- * Do not return this and {@link #ACTION_WAKE_UP} or {@link #ACTION_PASS_TO_USER}.
- */
- public final static int ACTION_GO_TO_SLEEP = 0x00000004;
-
- /**
* Interface to the Window Manager state associated with a particular
* window. You can hold on to an instance of this interface from the call
* to prepareAddWindow() until removeWindow().
@@ -751,8 +737,7 @@ public interface WindowManagerPolicy {
* @param policyFlags The policy flags associated with the key.
* @param isScreenOn True if the screen is already on
*
- * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
- * {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
+ * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
*/
public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn);
@@ -765,10 +750,9 @@ public interface WindowManagerPolicy {
* because it's the most fragile.
* @param policyFlags The policy flags associated with the motion.
*
- * @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
- * {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
+ * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
*/
- public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags);
+ public int interceptMotionBeforeQueueingWhenScreenOff(long whenNanos, int policyFlags);
/**
* Called from the input dispatcher thread before a key is dispatched to a window.