diff options
-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); } |