summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java16
-rw-r--r--java/com/android/dialer/app/calllog/VisualVoicemailUpdateTask.java2
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 {