diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-06-12 01:53:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-06-12 01:53:26 +0000 |
commit | ce07a46327a1c4d1879bdf16693fe0416bf73e46 (patch) | |
tree | 0f9eb35e6b37effc3710ef5410089334a79a0392 /java/com | |
parent | 1ffc9adf373b588505c9749f4db3f83098559f40 (diff) | |
parent | 443dcfbb54648034f58e1accecb54589cd0c5833 (diff) |
Merge "Ignore read voicemails for notifications"
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java | 16 | ||||
-rw-r--r-- | java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index b5ca0901b..152a3b837 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -260,7 +260,7 @@ public class CallLogNotificationsQueryHelper { /** Returns a {@link NewCall} pointed by the {@code callsUri} */ @Nullable - NewCall query(Uri callsUri); + NewCall queryUnreadVoicemail(Uri callsUri); } /** Information about a new voicemail. */ @@ -415,20 +415,26 @@ public class CallLogNotificationsQueryHelper { @Nullable @Override - public NewCall query(Uri callsUri) { + @SuppressWarnings("missingPermission") + public NewCall queryUnreadVoicemail(Uri voicemailUri) { if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CALL_LOG)) { LogUtil.w( "CallLogNotificationsQueryHelper.DefaultNewCallsQuery.query", "No READ_CALL_LOG permission, returning null for calls lookup."); return null; } - final String selection = String.format("%s = '%s'", Calls.VOICEMAIL_URI, callsUri.toString()); + Selection selection = + Selection.column(Calls.VOICEMAIL_URI) + .is("=", voicemailUri) + .buildUpon() + .and(Selection.column(Calls.IS_READ).is("IS NOT", 1)) + .build(); try (Cursor cursor = contentResolver.query( Calls.CONTENT_URI_WITH_VOICEMAIL, (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) ? PROJECTION_O : PROJECTION, - selection, - null, + selection.getSelection(), + selection.getSelectionArgs(), null)) { if (cursor == null) { return null; diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java b/java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java index bae30fa7b..e3cc5158e 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java @@ -160,7 +160,7 @@ class VisualVoicemailUpdateTask implements Worker<VisualVoicemailUpdateTask.Inpu } String uri = notification.getTag().replace(VisualVoicemailNotifier.NOTIFICATION_TAG_PREFIX, ""); - NewCall existingCall = queryHelper.getNewCallsQuery().query(Uri.parse(uri)); + NewCall existingCall = queryHelper.getNewCallsQuery().queryUnreadVoicemail(Uri.parse(uri)); if (existingCall != null) { result.add(existingCall); } else { |