diff options
author | Eric Erfanian <erfanian@google.com> | 2017-06-19 11:26:01 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-06-19 11:30:45 -0700 |
commit | 2f1c7586bcce334ca69022eb8dc6d8965ceb6a05 (patch) | |
tree | bf00ada449ee3de31ec983a14e84159200aa18c2 /java/com/android/dialer/app/calllog/VoicemailQueryHandler.java | |
parent | 3d0ca68e466482971a4cf46576c50cb2bd42bcb5 (diff) | |
download | android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.gz android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.tar.bz2 android_packages_apps_Dialer-2f1c7586bcce334ca69022eb8dc6d8965ceb6a05.zip |
Update AOSP Dialer source from internal google3 repository at
cl/159428781.
Test: make, treehugger
This CL updates the AOSP Dialer source with all the changes that have
gone into the private google3 repository. This includes all the
changes from cl/152373142 (4/06/2017) to cl/159428781 (6/19/2017).
This goal of these drops is to keep the AOSP source in sync with the
internal google3 repository. Currently these sync are done by hand
with very minor modifications to the internal source code.
See the Android.mk file for list of modifications.
Our current goal is to do frequent drops (daily if possible) and
eventually switched to an automated process.
Change-Id: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Diffstat (limited to 'java/com/android/dialer/app/calllog/VoicemailQueryHandler.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/VoicemailQueryHandler.java | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java b/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java index 777f4c79f..2fbebdd30 100644 --- a/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java +++ b/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java @@ -15,7 +15,6 @@ */ package com.android.dialer.app.calllog; -import android.app.NotificationManager; import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.content.ContentValues; @@ -23,30 +22,49 @@ import android.content.Context; import android.net.Uri; import android.provider.CallLog.Calls; import android.support.annotation.MainThread; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import com.android.dialer.app.R; +import android.support.annotation.WorkerThread; import com.android.dialer.common.Assert; -import com.android.dialer.notification.GroupedNotificationUtil; +import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.ThreadUtil; /** Handles asynchronous queries to the call log for voicemail. */ public class VoicemailQueryHandler extends AsyncQueryHandler { - private static final String TAG = "VoicemailQueryHandler"; - /** The token for the query to mark all new voicemails as old. */ private static final int UPDATE_MARK_VOICEMAILS_AS_OLD_TOKEN = 50; - private Context mContext; - @MainThread - public VoicemailQueryHandler(Context context, ContentResolver contentResolver) { + private VoicemailQueryHandler(ContentResolver contentResolver) { super(contentResolver); Assert.isMainThread(); - mContext = context; + } + + @WorkerThread + public static void markAllNewVoicemailsAsRead(final @NonNull Context context) { + ThreadUtil.postOnUiThread( + () -> { + new VoicemailQueryHandler(context.getContentResolver()).markNewVoicemailsAsOld(null); + }); + } + + @WorkerThread + public static void markSingleNewVoicemailAsRead( + final @NonNull Context context, final Uri voicemailUri) { + if (voicemailUri == null) { + LogUtil.e("VoicemailQueryHandler.markSingleNewVoicemailAsRead", "voicemail URI is null"); + return; + } + ThreadUtil.postOnUiThread( + () -> { + new VoicemailQueryHandler(context.getContentResolver()) + .markNewVoicemailsAsOld(voicemailUri); + }); } /** Updates all new voicemails to mark them as old. */ - public void markNewVoicemailsAsOld(@Nullable Uri voicemailUri) { + private void markNewVoicemailsAsOld(@Nullable Uri voicemailUri) { // Mark all "new" voicemails as not new anymore. StringBuilder where = new StringBuilder(); where.append(Calls.NEW); @@ -70,11 +88,5 @@ public class VoicemailQueryHandler extends AsyncQueryHandler { voicemailUri == null ? new String[] {Integer.toString(Calls.VOICEMAIL_TYPE)} : new String[] {Integer.toString(Calls.VOICEMAIL_TYPE), voicemailUri.toString()}); - - GroupedNotificationUtil.removeNotification( - mContext.getSystemService(NotificationManager.class), - voicemailUri != null ? voicemailUri.toString() : null, - R.id.notification_visual_voicemail, - DefaultVoicemailNotifier.VISUAL_VOICEMAIL_NOTIFICATION_TAG); } } |