From 266a8ac75ab0cd0c0529cf342f8ab33ab1095b20 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Wed, 2 Jul 2014 15:13:26 -0700 Subject: Make dialer use PhoneManager.cancelMissedCallsNotification. Change-Id: I1e8de39efe0918b974cf949e80e15e4c85c1a70c --- .../android/dialer/calllog/CallLogFragment.java | 2 +- .../dialer/calllog/CallLogNotificationsHelper.java | 24 ++++------------------ .../android/dialer/list/ShortcutCardsAdapter.java | 2 +- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 1d6ec79ff..1668895ef 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -489,7 +489,7 @@ public class CallLogFragment extends ListFragment if (!onEntry) { mCallLogQueryHandler.markMissedCallsAsRead(); } - CallLogNotificationsHelper.removeMissedCallNotifications(); + CallLogNotificationsHelper.removeMissedCallNotifications(getActivity()); CallLogNotificationsHelper.updateVoicemailNotifications(getActivity()); } } diff --git a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java index 6ce66f08f..2b4ae5020 100644 --- a/src/com/android/dialer/calllog/CallLogNotificationsHelper.java +++ b/src/com/android/dialer/calllog/CallLogNotificationsHelper.java @@ -18,32 +18,16 @@ package com.android.dialer.calllog; import android.content.Context; import android.content.Intent; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.util.Log; - -import com.android.internal.telephony.ITelephony; +import android.phone.PhoneManager; /** * Helper class operating on call log notifications. */ public class CallLogNotificationsHelper { - private static final String TAG = "CallLogNotificationsHelper"; - /** Removes the missed call notifications. */ - public static void removeMissedCallNotifications() { - try { - ITelephony telephony = - ITelephony.Stub.asInterface(ServiceManager.getService("phone")); - if (telephony != null) { - telephony.cancelMissedCallsNotification(); - } else { - Log.w(TAG, "Telephony service is null, can't call " + - "cancelMissedCallsNotification"); - } - } catch (RemoteException e) { - Log.e(TAG, "Failed to clear missed calls notification due to remote exception"); - } + public static void removeMissedCallNotifications(Context context) { + PhoneManager phoneManager = (PhoneManager) context.getSystemService(Context.PHONE_SERVICE); + phoneManager.cancelMissedCallsNotification(); } /** Update the voice mail notifications. */ diff --git a/src/com/android/dialer/list/ShortcutCardsAdapter.java b/src/com/android/dialer/list/ShortcutCardsAdapter.java index 766bddaa5..e856d800b 100644 --- a/src/com/android/dialer/list/ShortcutCardsAdapter.java +++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java @@ -78,7 +78,7 @@ public class ShortcutCardsAdapter extends BaseAdapter { public void onSwipe(View view) { mCallLogQueryHandler.markNewCallsAsOld(); mCallLogQueryHandler.markNewVoicemailsAsOld(); - CallLogNotificationsHelper.removeMissedCallNotifications(); + CallLogNotificationsHelper.removeMissedCallNotifications(mContext); CallLogNotificationsHelper.updateVoicemailNotifications(mContext); mFragment.dismissShortcut(view); } -- cgit v1.2.3