diff options
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogNotificationsService.java')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogNotificationsService.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/dialer/calllog/CallLogNotificationsService.java b/src/com/android/dialer/calllog/CallLogNotificationsService.java index 2e0e50258..22809db8c 100644 --- a/src/com/android/dialer/calllog/CallLogNotificationsService.java +++ b/src/com/android/dialer/calllog/CallLogNotificationsService.java @@ -17,10 +17,13 @@ package com.android.dialer.calllog; import android.app.IntentService; +import android.content.Context; import android.content.Intent; import android.net.Uri; import android.util.Log; +import com.android.dialer.util.TelecomUtil; + /** * Provides operations for managing notifications. * <p> @@ -84,4 +87,24 @@ public class CallLogNotificationsService extends IntentService { Log.d(TAG, "onHandleIntent: could not handle: " + intent); } } + + /** + * Updates notifications for any new voicemails. + * + * @param context a valid context. + * @param voicemailUri The uri pointing to the voicemail to update the notification for. If + * {@code null}, then notifications for all new voicemails will be updated. + */ + public static void updateVoicemailNotifications(Context context, Uri voicemailUri) { + if (TelecomUtil.hasReadWriteVoicemailPermissions(context)) { + Intent serviceIntent = new Intent(context, CallLogNotificationsService.class); + serviceIntent.setAction(CallLogNotificationsService.ACTION_UPDATE_NOTIFICATIONS); + // If voicemailUri is null, then notifications for all voicemails will be updated. + if (voicemailUri != null) { + serviceIntent.putExtra( + CallLogNotificationsService.EXTRA_NEW_VOICEMAIL_URI, voicemailUri); + } + context.startService(serviceIntent); + } + } } |