diff options
author | twyen <twyen@google.com> | 2017-09-05 11:05:06 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-11 10:56:03 -0700 |
commit | 9effa5c8840b462f58a1844693776a3b7bfccb1b (patch) | |
tree | f7b54d5c7efd190a0998ca492eed6bad7b1f4dab /java | |
parent | 5c7c9fe90a6f64adefcc86d24c159b50fb4159e3 (diff) |
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
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java | 8 |
1 files changed, 7 insertions, 1 deletions
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( |