summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxwelb <maxwelb@google.com>2018-04-05 19:47:29 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-04-05 19:47:29 -0700
commitd98a5cc04c5f57056b1066d4cc457cea595557b3 (patch)
tree7609195d618daa6ae9459b0fad249c30180e9dd8
parentbeb96f7369b6c632eb1e6aa2b70839df88bd90a3 (diff)
parentee03ca34fadf6c116a85e1fb59cef324e9588597 (diff)
Merge "Add Spam#updateSpamSync API to control when syncing the Apdl spam list is enabled" am: 7be4f8eb0b
am: ee03ca34fa Change-Id: Ibe8ed8f8aec07a31092c58f79771863758f9fe10
-rw-r--r--java/com/android/dialer/spam/Spam.java16
-rw-r--r--java/com/android/dialer/spam/SpamStub.java6
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);
}