diff options
Diffstat (limited to 'java/com/android/dialer/phonelookup/PhoneLookup.java')
-rw-r--r-- | java/com/android/dialer/phonelookup/PhoneLookup.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/java/com/android/dialer/phonelookup/PhoneLookup.java b/java/com/android/dialer/phonelookup/PhoneLookup.java index 66f166d6d..183277569 100644 --- a/java/com/android/dialer/phonelookup/PhoneLookup.java +++ b/java/com/android/dialer/phonelookup/PhoneLookup.java @@ -27,8 +27,8 @@ import com.google.common.util.concurrent.ListenableFuture; * Provides operations related to retrieving information about phone numbers. * * <p>Some operations defined by this interface are generally targeted towards specific use cases; - * for example {@link #isDirty(ImmutableSet, long)} and {@link #bulkUpdate(ImmutableMap, long)} are - * generally intended to be used by the call log. + * for example {@link #isDirty(ImmutableSet)}, {@link #bulkUpdate(ImmutableMap)}, and {@link + * #onSuccessfulBulkUpdate()} are generally intended to be used by the call log. */ public interface PhoneLookup { @@ -43,14 +43,14 @@ public interface PhoneLookup { /** * Returns a future which returns true if the information for any of the provided phone numbers - * has changed since {@code lastModified} according to this {@link PhoneLookup}. + * has changed, usually since {@link #onSuccessfulBulkUpdate()} was last invoked. */ - ListenableFuture<Boolean> isDirty( - ImmutableSet<DialerPhoneNumber> phoneNumbers, long lastModified); + ListenableFuture<Boolean> isDirty(ImmutableSet<DialerPhoneNumber> phoneNumbers); /** - * Given a set of existing information and a timestamp, returns a set of information with any - * changes made since the timestamp according to this {@link PhoneLookup}. + * Performs a bulk update of this {@link PhoneLookup}. The returned map must contain the exact + * same keys as the provided map. Most implementations will rely on last modified timestamps to + * efficiently only update the data which needs to be updated. * * <p>If there are no changes required, it is valid for this method to simply return the provided * {@code existingInfoMap}. @@ -59,5 +59,15 @@ public interface PhoneLookup { * deleted) the returned map should contain an empty {@link PhoneLookupInfo} for that number. */ ListenableFuture<ImmutableMap<DialerPhoneNumber, PhoneLookupInfo>> bulkUpdate( - ImmutableMap<DialerPhoneNumber, PhoneLookupInfo> existingInfoMap, long lastModified); + ImmutableMap<DialerPhoneNumber, PhoneLookupInfo> existingInfoMap); + + /** + * Called when the results of the {@link #bulkUpdate(ImmutableMap)} have been applied by the + * caller. + * + * <p>Typically implementations will use this to store a "last processed" timestamp so that future + * invocations of {@link #isDirty(ImmutableSet)} and {@link #bulkUpdate(ImmutableMap)} can be + * efficiently implemented. + */ + ListenableFuture<Void> onSuccessfulBulkUpdate(); } |