summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/dreams
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-09-26 01:30:41 -0700
committerJeff Brown <jeffbrown@google.com>2012-09-26 15:24:27 -0700
commit62c82e4d92cc0b856059f905d81885f7808a0e7d (patch)
tree74203a2312cd0c51235e4686f2162811aebea1e5 /core/java/android/service/dreams
parentcef440f2a2bb8b6e8d082d12a67dc21f2ee65e3c (diff)
downloadframeworks_base-62c82e4d92cc0b856059f905d81885f7808a0e7d.zip
frameworks_base-62c82e4d92cc0b856059f905d81885f7808a0e7d.tar.gz
frameworks_base-62c82e4d92cc0b856059f905d81885f7808a0e7d.tar.bz2
Make DreamManagerService more robust.
Clearly isolated the DreamManagerService and DreamController responsibilities. DreamManagerService contains just enough logic to manage the global synchronous behaviors. All of the asynchronous behaviors are in DreamController. Added a new PowerManager function called nap() to request the device to start napping. If it is a good time to nap, then the PowerManagerService will call startDream() on the DreamManagerService to start dreaming. Fixed a possible multi-user issue by explicitly tracking for which user a dream service is being started and stopping dreams when the current user changes. The user id is also passed to bindService() to ensure that the dream has the right environment. Fix interactions with docks and the UI mode manager. It is important that we always send the ACTION_DOCK_EVENT broadcast to the system so that it can configure audio routing and the like. When docked, the UI mode manager starts a dock app if there is one, otherwise it starts a dream. This change resolves issues with dreams started for reasons other than a user activity timeout. Bug: 7204211 Change-Id: I3193cc8190982c0836319176fa2e9c4dcad9c01f
Diffstat (limited to 'core/java/android/service/dreams')
-rw-r--r--core/java/android/service/dreams/Dream.java10
-rw-r--r--core/java/android/service/dreams/IDreamManager.aidl2
2 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/service/dreams/Dream.java b/core/java/android/service/dreams/Dream.java
index 473414c..590acfa 100644
--- a/core/java/android/service/dreams/Dream.java
+++ b/core/java/android/service/dreams/Dream.java
@@ -72,6 +72,12 @@ public class Dream extends Service implements Window.Callback {
private final String TAG = Dream.class.getSimpleName() + "[" + getClass().getSimpleName() + "]";
/**
+ * The name of the dream manager service.
+ * @hide
+ */
+ public static final String DREAM_SERVICE = "dreams";
+
+ /**
* Used with {@link Intent#ACTION_MAIN} to declare the necessary intent-filter for a dream.
*
* @see Dream
@@ -499,7 +505,7 @@ public class Dream extends Service implements Window.Callback {
// end public api
private void loadSandman() {
- mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService("dreams"));
+ mSandman = IDreamManager.Stub.asInterface(ServiceManager.getService(DREAM_SERVICE));
}
private final void attach(IBinder windowToken) {
@@ -584,7 +590,7 @@ public class Dream extends Service implements Window.Callback {
mFinished = true;
if (mSandman != null) {
- mSandman.awakenSelf(mWindowToken);
+ mSandman.finishSelf(mWindowToken);
} else {
Slog.w(TAG, "No dream manager found");
}
diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl
index bd1c524..1c1b390 100644
--- a/core/java/android/service/dreams/IDreamManager.aidl
+++ b/core/java/android/service/dreams/IDreamManager.aidl
@@ -30,5 +30,5 @@ interface IDreamManager {
ComponentName getDefaultDreamComponent();
void testDream(in ComponentName componentName);
boolean isDreaming();
- void awakenSelf(in IBinder token);
+ void finishSelf(in IBinder token);
} \ No newline at end of file