summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/dreams
diff options
context:
space:
mode:
authorChristopher R. Palmer <crpalmer@gmail.com>2015-05-01 06:15:47 -0400
committerSteve Kondik <steve@cyngn.com>2015-10-26 21:55:40 -0700
commit6d6d1393091bd4ab659e8ed9c2254fb2ceed7f60 (patch)
tree31b9db1cce95f29682a1aeec07f7294131328b2b /services/core/java/com/android/server/dreams
parentaaddd07cb416c9d529df3b60f78e375a35a11fb5 (diff)
downloadframeworks_base-6d6d1393091bd4ab659e8ed9c2254fb2ceed7f60.zip
frameworks_base-6d6d1393091bd4ab659e8ed9c2254fb2ceed7f60.tar.gz
frameworks_base-6d6d1393091bd4ab659e8ed9c2254fb2ceed7f60.tar.bz2
ambient display: Fix volume key music control
Previously the dream service would only report whether or not it was dreaming. Ambient display counts as dreaming. When dreaming, the volume inputs are passed back to the application which is not what we want for ambient display. Fix this by exposing isDozing() and allow volume keys to control music when we are dreaming and have moved into doze mode (aka, sleeping). Change-Id: I3b1e72b95ec8b1b63ef0219259dfee77a5d339d3
Diffstat (limited to 'services/core/java/com/android/server/dreams')
-rw-r--r--services/core/java/com/android/server/dreams/DreamManagerService.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java
index 8813a61..e1893f9 100644
--- a/services/core/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/core/java/com/android/server/dreams/DreamManagerService.java
@@ -150,6 +150,12 @@ public final class DreamManagerService extends SystemService {
}
}
+ private boolean isDozingInternal() {
+ synchronized (mLock) {
+ return mCurrentDreamIsDozing;
+ }
+ }
+
private void requestDreamInternal() {
// Ask the power manager to nap. It will eventually call back into
// startDream() if/when it is appropriate to start dreaming.
@@ -530,6 +536,18 @@ public final class DreamManagerService extends SystemService {
}
@Override // Binder call
+ public boolean isDozing() {
+ checkPermission(android.Manifest.permission.READ_DREAM_STATE);
+
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ return isDozingInternal();
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override // Binder call
public void dream() {
checkPermission(android.Manifest.permission.WRITE_DREAM_STATE);
@@ -638,6 +656,11 @@ public final class DreamManagerService extends SystemService {
public boolean isDreaming() {
return isDreamingInternal();
}
+
+ @Override
+ public boolean isDozing() {
+ return isDozingInternal();
+ }
}
private final Runnable mSystemPropertiesChanged = new Runnable() {