Skip to content

Commit 460847c

Browse files
John SpurlockAndroid (Google) Code Review
authored andcommitted
Merge "Stop screensaver on incoming phone call." into jb-mr1-dev
2 parents b26295b + 7be1a3d commit 460847c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

services/java/com/android/server/NotificationManagerService.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import android.os.UserId;
5252
import android.os.Vibrator;
5353
import android.provider.Settings;
54+
import android.service.dreams.IDreamManager;
5455
import android.telephony.TelephonyManager;
5556
import android.text.TextUtils;
5657
import android.util.AtomicFile;
@@ -148,6 +149,8 @@ public class NotificationManagerService extends INotificationManager.Stub
148149
private AtomicFile mPolicyFile;
149150
private HashSet<String> mBlockedPackages = new HashSet<String>();
150151

152+
private IDreamManager mSandman;
153+
151154
private static final int DB_VERSION = 1;
152155

153156
private static final String TAG_BODY = "notification-policy";
@@ -634,6 +637,8 @@ public void update() {
634637
void systemReady() {
635638
mAudioService = IAudioService.Stub.asInterface(
636639
ServiceManager.getService(Context.AUDIO_SERVICE));
640+
mSandman = IDreamManager.Stub.asInterface(
641+
ServiceManager.getService("dreams"));
637642

638643
// no beeping until we're basically done booting
639644
mSystemReady = true;
@@ -972,6 +977,16 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
972977
| Notification.FLAG_NO_CLEAR;
973978
}
974979

980+
// Stop screensaver if the notification has a full-screen intent.
981+
// (like an incoming phone call)
982+
if (notification.fullScreenIntent != null && mSandman != null) {
983+
try {
984+
mSandman.awaken();
985+
} catch (RemoteException e) {
986+
// noop
987+
}
988+
}
989+
975990
if (notification.icon != 0) {
976991
StatusBarNotification n = new StatusBarNotification(pkg, id, tag,
977992
r.uid, r.initialPid, score, notification);

0 commit comments

Comments
 (0)