diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-04-06 02:08:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-06 02:08:54 +0000 |
commit | 7be4f8eb0bc5402308c49e7f828d08b7ce7dc603 (patch) | |
tree | 650224acb737e2b0a5e9a745060d9dcdfacf3733 /java | |
parent | 3f801a8d28f92357c2b27e337fc4e599b490df4d (diff) | |
parent | d88b2c704f6b710d4a5dd1ebe75263657b1b1018 (diff) |
Merge "Add Spam#updateSpamSync API to control when syncing the Apdl spam list is enabled"
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/spam/Spam.java | 16 | ||||
-rw-r--r-- | java/com/android/dialer/spam/SpamStub.java | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/java/com/android/dialer/spam/Spam.java b/java/com/android/dialer/spam/Spam.java index c22f541d8..21d770ed3 100644 --- a/java/com/android/dialer/spam/Spam.java +++ b/java/com/android/dialer/spam/Spam.java @@ -16,6 +16,8 @@ package com.android.dialer.spam; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.android.dialer.DialerPhoneNumber; @@ -39,6 +41,20 @@ public interface Spam { ImmutableSet<DialerPhoneNumber> dialerPhoneNumbers); /** + * Called as an indication that the Spam implementation should check whether downloading a spam + * list needs to occur or not. + * + * @param isEnabledByUser true if spam is enabled by the user. Generally, this value should be + * passed as {@link SpamSettings#isSpamEnabled()}. In the scenario where the user toggles the + * spam setting isSpamEnabled returns stale data: the SharedPreferences will not have updated + * prior to executing {@link OnPreferenceChangeListener#onPreferenceChange(Preference, + * Object)}. For that case, use the new value provided in the onPreferenceChange callback. + * @return a future containing no value. It is only an indication of success or failure of the + * operation. + */ + ListenableFuture<Void> updateSpamListDownload(boolean isEnabledByUser); + + /** * Checks if the given number is suspected of being a spam. * * @param number The phone number of the call. diff --git a/java/com/android/dialer/spam/SpamStub.java b/java/com/android/dialer/spam/SpamStub.java index 28f26d13b..8851fd09e 100644 --- a/java/com/android/dialer/spam/SpamStub.java +++ b/java/com/android/dialer/spam/SpamStub.java @@ -66,6 +66,12 @@ public class SpamStub implements Spam { } @Override + public ListenableFuture<Void> updateSpamListDownload(boolean isEnabledByUser) { + // no-op + return Futures.immediateFuture(null); + } + + @Override public void checkSpamStatus(String number, String countryIso, Listener listener) { listener.onComplete(false); } |