Handle cancelMissedCallsNotification.

Change-Id: Icdbca5371c54af4da098409275092c34c3bddc8b
diff --git a/src/com/android/telecomm/TelecommServiceImpl.java b/src/com/android/telecomm/TelecommServiceImpl.java
index 24d6cc4..d723aef 100644
--- a/src/com/android/telecomm/TelecommServiceImpl.java
+++ b/src/com/android/telecomm/TelecommServiceImpl.java
@@ -76,6 +76,9 @@
                     case MSG_ACCEPT_RINGING_CALL:
                         acceptRingingCallInternal();
                         break;
+                    case MSG_CANCEL_MISSED_CALLS_NOTIFICATION:
+                        mMissedCallNotifier.clearMissedCalls();
+                        break;
                 }
 
                 if (result != null) {
@@ -99,15 +102,17 @@
     private static final int MSG_IS_RINGING = 4;
     private static final int MSG_END_CALL = 5;
     private static final int MSG_ACCEPT_RINGING_CALL = 6;
+    private static final int MSG_CANCEL_MISSED_CALLS_NOTIFICATION = 7;
 
     /** The singleton instance. */
     private static TelecommServiceImpl sInstance;
 
     private final CallsManager mCallsManager = CallsManager.getInstance();
-
+    private final MissedCallNotifier mMissedCallNotifier;
     private final MainThreadHandler mMainThreadHandler = new MainThreadHandler();
 
-    private TelecommServiceImpl() {
+    private TelecommServiceImpl(MissedCallNotifier missedCallNotifier) {
+        mMissedCallNotifier = missedCallNotifier;
         publish();
     }
 
@@ -115,10 +120,10 @@
      * Initialize the singleton TelecommServiceImpl instance.
      * This is only done once, at startup, from TelecommApp.onCreate().
      */
-    static TelecommServiceImpl init() {
+    static TelecommServiceImpl init(MissedCallNotifier missedCallNotifier) {
         synchronized (TelecommServiceImpl.class) {
             if (sInstance == null) {
-                sInstance = new TelecommServiceImpl();
+                sInstance = new TelecommServiceImpl(missedCallNotifier);
             } else {
                 Log.wtf(TAG, "init() called multiple times!  sInstance %s", sInstance);
             }
@@ -206,8 +211,12 @@
 
     @Override
     public void showCallScreen(boolean showDialpad) {
-        mMainThreadHandler.obtainMessage(MSG_SHOW_CALL_SCREEN, showDialpad ? 1 : 0, 0)
-                .sendToTarget();
+        sendRequestAsync(MSG_SHOW_CALL_SCREEN, showDialpad ? 1 : 0);
+    }
+
+    @Override
+    public void cancelMissedCallsNotification() {
+        sendRequestAsync(MSG_CANCEL_MISSED_CALLS_NOTIFICATION, 0);
     }
 
     //