From 24518e466ab36ce7c6d2ffd733ac4d57f255766e Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 4 Sep 2012 13:23:01 -0400 Subject: [PATCH 1/2] Do not play sounds or vibes for background users' notifications. USER_ALL notifications will still play/vibe for any user. Change-Id: Ie8cc69bd1541193ed9c4207ef38a8d4898af0a9d --- services/java/com/android/server/NotificationManagerService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 40f6ecf76b437..e7b839f6745a0 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -1047,6 +1047,7 @@ public class NotificationManagerService extends INotificationManager.Stub if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0) && (!(old != null && (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 )) + && (r.userId == UserHandle.USER_ALL || r.userId == userId) && mSystemReady) { final AudioManager audioManager = (AudioManager) mContext From c9ce0abe29baecc540c48f4913255a71586bcfd3 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 4 Sep 2012 13:27:09 -0400 Subject: [PATCH 2/2] Make the SystemUI stop the screen saver when a full-screen notification is posted. This keeps all the fullScreenIntent logic (including multiuser implications) in one place. Change-Id: I4ef284daf90464f105780ade1d971e9e081fbbb5 --- .../systemui/statusbar/phone/PhoneStatusBar.java | 4 ++++ .../android/server/NotificationManagerService.java | 14 -------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 31bc8a0e68093..41541d62c0613 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -746,6 +746,10 @@ public class PhoneStatusBar extends BaseStatusBar { */ if (notification.notification.fullScreenIntent != null) { + // Stop screensaver if the notification has a full-screen intent. + // (like an incoming phone call) + awakenDreams(); + // not immersive & a full-screen alert should be shown Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent"); try { diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index e7b839f6745a0..3caba1f8ab759 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -151,8 +151,6 @@ public class NotificationManagerService extends INotificationManager.Stub private AtomicFile mPolicyFile; private HashSet mBlockedPackages = new HashSet(); - private IDreamManager mSandman; - private static final int DB_VERSION = 1; private static final String TAG_BODY = "notification-policy"; @@ -658,8 +656,6 @@ public class NotificationManagerService extends INotificationManager.Stub void systemReady() { mAudioService = IAudioService.Stub.asInterface( ServiceManager.getService(Context.AUDIO_SERVICE)); - mSandman = IDreamManager.Stub.asInterface( - ServiceManager.getService("dreams")); // no beeping until we're basically done booting mSystemReady = true; @@ -995,16 +991,6 @@ public class NotificationManagerService extends INotificationManager.Stub | Notification.FLAG_NO_CLEAR; } - // Stop screensaver if the notification has a full-screen intent. - // (like an incoming phone call) - if (notification.fullScreenIntent != null && mSandman != null) { - try { - mSandman.awaken(); - } catch (RemoteException e) { - // noop - } - } - if (notification.icon != 0) { StatusBarNotification n = new StatusBarNotification(pkg, id, tag, r.uid, r.initialPid, score, notification);