summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/calllog/VoicemailQueryHandler.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-08-31 06:57:16 -0700
committerEric Erfanian <erfanian@google.com>2017-08-31 16:13:53 +0000
commit2ca4318cc1ee57dda907ba2069bd61d162b1baef (patch)
treee282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/dialer/app/calllog/VoicemailQueryHandler.java
parent68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff)
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google source control system and only exported to public during AOSP drops. The Dialer team is now switching to a public development model similar to the telephony team. This CL represents all internal Google changes that were committed to Dialer between the public O release and today's tip of tree on internal master. This CL squashes those changes into a single commit. In subsequent changes, changes will be exported on a per-commit basis. Test: make, flash install, run Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160 Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8 PiperOrigin-RevId: 167068436
Diffstat (limited to 'java/com/android/dialer/app/calllog/VoicemailQueryHandler.java')
-rw-r--r--java/com/android/dialer/app/calllog/VoicemailQueryHandler.java44
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);
}
}