From 7be1a3d67c32d73b20e30e85084f07c609617762 Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Mon, 13 Aug 2012 16:45:12 -0400 Subject: [PATCH] Stop screensaver on incoming phone call. Use notification manager as an indicator of when to stop the screensaver due to immediately-needed user interaction. Any notification with a fullScreenIntent will now exit the screensaver. Bug: 6976796 Change-Id: Id91cd4c32f3fad018b56f4dfe24b37110bab32d8 --- .../server/NotificationManagerService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 9ab1a9ddac738..798915b7286fd 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -51,6 +51,7 @@ import android.os.ServiceManager; import android.os.UserId; import android.os.Vibrator; import android.provider.Settings; +import android.service.dreams.IDreamManager; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.AtomicFile; @@ -148,6 +149,8 @@ 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"; @@ -634,6 +637,8 @@ 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; @@ -972,6 +977,16 @@ 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);