Oct 30

Five-minute AOSP hack: dismiss voicemail notification

My Android device (a Nexus 4) won't let me dismiss the voicemail notification icon without actually clearing the voicemail. This is pretty annoying, particularly since either my phone provider (Three UK) or my device sometimes gets it wrong and tells me that I have voicemail when I don't.

If you're compiling your version of Android from the AOSP source code (and I realise this means almost nobody) you can change this by removing the piece of code in the phone app which tells Android not to let you dismiss the notification. Here's a patch against 4.2.2:

wzdd@ubuntu:~/aosp-nexus4/packages/apps/Phone$ git diff
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 42dcdb6..906ba61 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -1283,7 +1283,7 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
             if (vibrate) {
                 notification.defaults |= Notification.DEFAULT_VIBRATE;
-            notification.flags |= Notification.FLAG_NO_CLEAR;
             mNotificationManager.notify(VOICEMAIL_NOTIFICATION, notification);
         } else {

Remember to envsetup and lunch. Then you can patch and "mmm packages/apps/Phone", then copy the new Phone.apk (from out/) to the device.

4.4 update: For Android 4.4, it all changed:

  • Modify packages/services/Telephony/src/com/android/phone/NotificationMgr.java
  • mmm packages/services/Telephony/
  • Install out/target/product/hammerhead/system/priv-app/TeleService.apk