summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/ClearMissedCalls.java
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-03-30 17:12:55 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-30 17:14:03 -0700
commit07206e2c106eec909fd38c16a66957a5e00372de (patch)
treefef38ad919265f8179b14ae01fdb6023e6024429 /java/com/android/dialer/calllog/ClearMissedCalls.java
parentf6be61727fba9b0fdac3b9d69588e4467f861552 (diff)
Use IS_READ instead of NEW in new call log.
We want to be more consistent with other usages of NEW in the app, i.e. NEW should be used primarily by notifications. Bug: 74821515 Test: unit PiperOrigin-RevId: 191139559 Change-Id: Ib6fbead8b5589aedd881db26a07f7daed4d83543
Diffstat (limited to 'java/com/android/dialer/calllog/ClearMissedCalls.java')
-rw-r--r--java/com/android/dialer/calllog/ClearMissedCalls.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/java/com/android/dialer/calllog/ClearMissedCalls.java b/java/com/android/dialer/calllog/ClearMissedCalls.java
index d216e7b88..78eb80294 100644
--- a/java/com/android/dialer/calllog/ClearMissedCalls.java
+++ b/java/com/android/dialer/calllog/ClearMissedCalls.java
@@ -38,8 +38,8 @@ import java.util.Collection;
import javax.inject.Inject;
/**
- * Clears missed calls. This includes cancelling notifications and updating the "NEW" status in the
- * system call log.
+ * Clears missed calls. This includes cancelling notifications and updating the "IS_READ" status in
+ * the system call log.
*/
public final class ClearMissedCalls {
@@ -58,11 +58,11 @@ public final class ClearMissedCalls {
}
/**
- * Cancels all missed call notifications and marks all "new" missed calls in the system call log
- * as "not new".
+ * Cancels all missed call notifications and marks all "unread" missed calls in the system call
+ * log as "read".
*/
public ListenableFuture<Void> clearAll() {
- ListenableFuture<Void> markNewFuture = markNotNew(ImmutableSet.of());
+ ListenableFuture<Void> markReadFuture = markRead(ImmutableSet.of());
ListenableFuture<Void> cancelNotificationsFuture =
uiThreadExecutor.submit(
() -> {
@@ -73,11 +73,11 @@ public final class ClearMissedCalls {
// Note on this usage of whenAllComplete:
// -The returned future completes when all sub-futures complete (whether they fail or not)
// -The returned future fails if any sub-future fails
- return Futures.whenAllComplete(markNewFuture, cancelNotificationsFuture)
+ return Futures.whenAllComplete(markReadFuture, cancelNotificationsFuture)
.call(
() -> {
// Calling get() is necessary to propagate failures.
- markNewFuture.get();
+ markReadFuture.get();
cancelNotificationsFuture.get();
return null;
},
@@ -86,12 +86,12 @@ public final class ClearMissedCalls {
/**
* For the provided set of IDs from the system call log, cancels their missed call notifications
- * and marks them "not new".
+ * and marks them "read".
*
* @param ids IDs from the system call log (see {@link Calls#_ID}}.
*/
public ListenableFuture<Void> clearBySystemCallLogId(Collection<Long> ids) {
- ListenableFuture<Void> markNewFuture = markNotNew(ids);
+ ListenableFuture<Void> markReadFuture = markRead(ids);
ListenableFuture<Void> cancelNotificationsFuture =
uiThreadExecutor.submit(
() -> {
@@ -105,11 +105,11 @@ public final class ClearMissedCalls {
// Note on this usage of whenAllComplete:
// -The returned future completes when all sub-futures complete (whether they fail or not)
// -The returned future fails if any sub-future fails
- return Futures.whenAllComplete(markNewFuture, cancelNotificationsFuture)
+ return Futures.whenAllComplete(markReadFuture, cancelNotificationsFuture)
.call(
() -> {
// Calling get() is necessary to propagate failures.
- markNewFuture.get();
+ markReadFuture.get();
cancelNotificationsFuture.get();
return null;
},
@@ -117,28 +117,28 @@ public final class ClearMissedCalls {
}
/**
- * Marks all provided system call log IDs as not new, or if the provided collection is empty,
- * marks all calls as not new.
+ * Marks all provided system call log IDs as read, or if the provided collection is empty, marks
+ * all calls as read.
*/
@SuppressLint("MissingPermission")
- private ListenableFuture<Void> markNotNew(Collection<Long> ids) {
+ private ListenableFuture<Void> markRead(Collection<Long> ids) {
return backgroundExecutor.submit(
() -> {
if (!UserManagerCompat.isUserUnlocked(appContext)) {
- LogUtil.e("ClearMissedCalls.markNotNew", "locked");
+ LogUtil.e("ClearMissedCalls.markRead", "locked");
return null;
}
if (!PermissionsUtil.hasCallLogWritePermissions(appContext)) {
- LogUtil.e("ClearMissedCalls.markNotNew", "no permission");
+ LogUtil.e("ClearMissedCalls.markRead", "no permission");
return null;
}
ContentValues values = new ContentValues();
- values.put(Calls.NEW, 0);
+ values.put(Calls.IS_READ, 1);
Selection.Builder selectionBuilder =
Selection.builder()
- .and(Selection.column(Calls.NEW).is("=", 1))
+ .and(Selection.column(Calls.IS_READ).is("=", 0))
.and(Selection.column(Calls.TYPE).is("=", Calls.MISSED_TYPE));
if (!ids.isEmpty()) {
selectionBuilder.and(Selection.column(Calls._ID).in(toStrings(ids)));