|
51 | 51 | import android.os.UserId; |
52 | 52 | import android.os.Vibrator; |
53 | 53 | import android.provider.Settings; |
| 54 | +import android.service.dreams.IDreamManager; |
54 | 55 | import android.telephony.TelephonyManager; |
55 | 56 | import android.text.TextUtils; |
56 | 57 | import android.util.AtomicFile; |
@@ -148,6 +149,8 @@ public class NotificationManagerService extends INotificationManager.Stub |
148 | 149 | private AtomicFile mPolicyFile; |
149 | 150 | private HashSet<String> mBlockedPackages = new HashSet<String>(); |
150 | 151 |
|
| 152 | + private IDreamManager mSandman; |
| 153 | + |
151 | 154 | private static final int DB_VERSION = 1; |
152 | 155 |
|
153 | 156 | private static final String TAG_BODY = "notification-policy"; |
@@ -634,6 +637,8 @@ public void update() { |
634 | 637 | void systemReady() { |
635 | 638 | mAudioService = IAudioService.Stub.asInterface( |
636 | 639 | ServiceManager.getService(Context.AUDIO_SERVICE)); |
| 640 | + mSandman = IDreamManager.Stub.asInterface( |
| 641 | + ServiceManager.getService("dreams")); |
637 | 642 |
|
638 | 643 | // no beeping until we're basically done booting |
639 | 644 | mSystemReady = true; |
@@ -972,6 +977,16 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP |
972 | 977 | | Notification.FLAG_NO_CLEAR; |
973 | 978 | } |
974 | 979 |
|
| 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 | + |
975 | 990 | if (notification.icon != 0) { |
976 | 991 | StatusBarNotification n = new StatusBarNotification(pkg, id, tag, |
977 | 992 | r.uid, r.initialPid, score, notification); |
|
0 commit comments