Clear the calling identity when using the notification manager.

Some of the recent refactoring work could have caused this
code to run in a different context. Telecom used to be the
one executing this code but it is not anymore.

Bug: 19941388
Change-Id: I0590c0653c3bd43cba79b05ce5a747d1bc2402bb
diff --git a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
index 9022d27..d26f4c5 100644
--- a/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
+++ b/src/com/android/server/telecom/ui/MissedCallNotifierImpl.java
@@ -41,6 +41,7 @@
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.AsyncTask;
+import android.os.Binder;
 import android.os.UserHandle;
 import android.provider.CallLog.Calls;
 import android.telecom.CallState;
@@ -195,15 +196,25 @@
         configureLedOnNotification(notification);
 
         Log.i(this, "Adding missed call notification for %s.", call);
-        mNotificationManager.notifyAsUser(
-                null /* tag */ , MISSED_CALL_NOTIFICATION_ID, notification, UserHandle.CURRENT);
+        long token = Binder.clearCallingIdentity();
+        try {
+            mNotificationManager.notifyAsUser(
+                    null /* tag */, MISSED_CALL_NOTIFICATION_ID, notification, UserHandle.CURRENT);
+        } finally {
+            Binder.restoreCallingIdentity(token);
+        }
     }
 
     /** Cancels the "missed call" notification. */
     private void cancelMissedCallNotification() {
         // Reset the number of missed calls to 0.
         mMissedCallCount = 0;
-        mNotificationManager.cancel(MISSED_CALL_NOTIFICATION_ID);
+        long token = Binder.clearCallingIdentity();
+        try {
+            mNotificationManager.cancel(MISSED_CALL_NOTIFICATION_ID);
+        } finally {
+            Binder.restoreCallingIdentity(token);
+        }
     }
 
     /**