summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxwelb <maxwelb@google.com>2018-04-05 19:38:06 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-04-05 19:38:06 -0700
commitee03ca34fadf6c116a85e1fb59cef324e9588597 (patch)
tree650224acb737e2b0a5e9a745060d9dcdfacf3733
parentecba590737e62760dd4ee33429e0becdbb4ad7ce (diff)
parent7be4f8eb0bc5402308c49e7f828d08b7ce7dc603 (diff)
Merge "Add Spam#updateSpamSync API to control when syncing the Apdl spam list is enabled"
am: 7be4f8eb0b Change-Id: I6369ff7c1778c1c263ea0d78e9e162d9f4747ff6
-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);
}