From 3b552ec65b973cdf2c7c9293d67bce436c20b0fa Mon Sep 17 00:00:00 2001 From: maxwelb Date: Thu, 31 May 2018 16:50:35 -0700 Subject: Add new spam API which can query additional data. Bug: 80303132 Test: InAppSpamTest, verified using Blueline device PiperOrigin-RevId: 198801576 Change-Id: I30f8c0c7c850ac4bd7b6fcf2dad18c0d70f1b2d1 --- java/com/android/dialer/spam/Spam.java | 13 +++++++++++++ java/com/android/dialer/spam/stub/SpamStub.java | 6 ++++++ java/com/android/incallui/call/CallList.java | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/java/com/android/dialer/spam/Spam.java b/java/com/android/dialer/spam/Spam.java index 028bda40a..b797ce3c4 100644 --- a/java/com/android/dialer/spam/Spam.java +++ b/java/com/android/dialer/spam/Spam.java @@ -60,6 +60,19 @@ public interface Spam { */ ListenableFuture checkSpamStatus(String number, @Nullable String defaultCountryIso); + /** + * Checks if the given number is suspected of being spam, checking additional information as + * needed for the in-call ui. + * + *

See {@link #checkSpamStatus(String, String)}. + * + * @param number the phone number. + * @param defaultCountryIso the default country to use if it's not part of the number. + * @return the {@link SpamStatus} for the given number. + */ + ListenableFuture checkSpamStatusForInCallUi( + String number, @Nullable String defaultCountryIso); + /** * Called as an indication that the Spam implementation should check whether downloading a spam * list needs to occur or not. diff --git a/java/com/android/dialer/spam/stub/SpamStub.java b/java/com/android/dialer/spam/stub/SpamStub.java index 5eeed4571..7d48ca6ef 100644 --- a/java/com/android/dialer/spam/stub/SpamStub.java +++ b/java/com/android/dialer/spam/stub/SpamStub.java @@ -67,6 +67,12 @@ public class SpamStub implements Spam { return Futures.immediateFuture(SimpleSpamStatus.notSpam()); } + @Override + public ListenableFuture checkSpamStatusForInCallUi( + String number, @Nullable String defaultCountryIso) { + return checkSpamStatus(number, defaultCountryIso); + } + @Override public ListenableFuture updateSpamListDownload(boolean isEnabledByUser) { // no-op diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 634a302a2..31afe71db 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -150,7 +150,9 @@ public class CallList implements DialerCallDelegate { if (SpamComponent.get(context).spamSettings().isSpamEnabled()) { String number = TelecomCallUtil.getNumber(telecomCall); ListenableFuture futureSpamStatus = - SpamComponent.get(context).spam().checkSpamStatus(number, call.getCountryIso()); + SpamComponent.get(context) + .spam() + .checkSpamStatusForInCallUi(number, call.getCountryIso()); Futures.addCallback( futureSpamStatus, -- cgit v1.2.3