From 9effa5c8840b462f58a1844693776a3b7bfccb1b Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 5 Sep 2017 11:05:06 -0700 Subject: Ignore read missed calls and voicemails for notification When the call log is restored by the system, all items are marked as new even though they could already been read. This causes a torrent of "missed" calls after restoring call log with the setup wizard. This CL ignore read entities in the query. Bug: 62871863 Test: CallLogNotificationQueryHelperTest PiperOrigin-RevId: 167602820 Change-Id: Iba5609ace895a309685bfcd61eae85e080562ec5 --- .../dialer/app/calllog/CallLogNotificationsQueryHelper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'java/com/android/dialer/app') diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index 43e03e9fd..c749b65ba 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -298,7 +298,13 @@ public class CallLogNotificationsQueryHelper { "no READ_CALL_LOG permission, returning null for calls lookup."); return null; } - final String selection = String.format("%s = 1 AND %s = ?", Calls.NEW, Calls.TYPE); + // A call is "new" when: + // NEW is 1. usually set when a new row is inserted + // TYPE matches the query type. + // IS_READ is not 1. A call might be backed up and restored, so it will be "new" to the + // call log, but the user has already read it on another device. + final String selection = + String.format("%s = 1 AND %s = ? AND %s IS NOT 1", Calls.NEW, Calls.TYPE, Calls.IS_READ); final String[] selectionArgs = new String[] {Integer.toString(type)}; try (Cursor cursor = mContentResolver.query( -- cgit v1.2.3