diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-05 15:23:13 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-05 15:23:13 +0000 |
commit | 300a8683b9c28424fb0f0c571a0abe128c461f69 (patch) | |
tree | 3a325b0effac02fbd228b8ddf2f96589e5df72cd /java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java | |
parent | d67f1627521b174f12e0c247f154c7c93c5e408e (diff) | |
parent | 10b34a5ebf12e97ecba0caf3c8e30b476b038a96 (diff) |
Update Dialer to V10 RC16
am: 10b34a5ebf
Change-Id: Iea3e96ccdeaf1fa796ceca702cace82ca20f298c
Diffstat (limited to 'java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java b/java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java index 0007d1863..d67f12266 100644 --- a/java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/DefaultVoicemailNotifier.java @@ -31,6 +31,7 @@ import android.os.PersistableBundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.annotation.WorkerThread; import android.support.v4.os.BuildCompat; import android.support.v4.util.Pair; import android.telecom.PhoneAccount; @@ -48,6 +49,7 @@ import com.android.dialer.app.R; import com.android.dialer.app.calllog.CallLogNotificationsQueryHelper.NewCall; import com.android.dialer.app.contactinfo.ContactPhotoLoader; import com.android.dialer.app.list.DialtactsPagerAdapter; +import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.common.Assert; @@ -76,17 +78,24 @@ public class DefaultVoicemailNotifier { private final Context context; private final CallLogNotificationsQueryHelper queryHelper; + private final FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) - DefaultVoicemailNotifier(Context context, CallLogNotificationsQueryHelper queryHelper) { + DefaultVoicemailNotifier( + Context context, + CallLogNotificationsQueryHelper queryHelper, + FilteredNumberAsyncQueryHandler filteredNumberAsyncQueryHandler) { this.context = context; this.queryHelper = queryHelper; + this.filteredNumberAsyncQueryHandler = filteredNumberAsyncQueryHandler; } /** Returns an instance of {@link DefaultVoicemailNotifier}. */ public static DefaultVoicemailNotifier getInstance(Context context) { return new DefaultVoicemailNotifier( - context, CallLogNotificationsQueryHelper.getInstance(context)); + context, + CallLogNotificationsQueryHelper.getInstance(context), + new FilteredNumberAsyncQueryHandler(context)); } /** @@ -97,7 +106,9 @@ public class DefaultVoicemailNotifier { * * <p>It is not safe to call this method from the main thread. */ + @WorkerThread public void updateNotification() { + Assert.isWorkerThread(); // Lookup the list of new voicemails to include in the notification. final List<NewCall> newCalls = queryHelper.getNewVoicemails(); @@ -121,13 +132,15 @@ public class DefaultVoicemailNotifier { NewCall newCall = itr.next(); // Skip notifying for numbers which are blocked. - if (FilteredNumbersUtil.shouldBlockVoicemail( - context, newCall.number, newCall.countryIso, newCall.dateMs)) { + if (!FilteredNumbersUtil.hasRecentEmergencyCall(context) + && filteredNumberAsyncQueryHandler.getBlockedIdSynchronous( + newCall.number, newCall.countryIso) + != null) { itr.remove(); if (newCall.voicemailUri != null) { // Delete the voicemail. - context.getContentResolver().delete(newCall.voicemailUri, null, null); + CallLogAsyncTaskUtil.deleteVoicemailSynchronous(context, newCall.voicemailUri); } continue; } |