Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b552ec6 authored by maxwelb's avatar maxwelb Committed by Copybara-Service
Browse files

Add new spam API which can query additional data.

Bug: 80303132
Test: InAppSpamTest, verified using Blueline device
PiperOrigin-RevId: 198801576
Change-Id: I30f8c0c7c850ac4bd7b6fcf2dad18c0d70f1b2d1
parent 5af531ea
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -60,6 +60,19 @@ public interface Spam {
   */
   */
  ListenableFuture<SpamStatus> checkSpamStatus(String number, @Nullable String defaultCountryIso);
  ListenableFuture<SpamStatus> 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.
   *
   * <p>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<SpamStatus> checkSpamStatusForInCallUi(
      String number, @Nullable String defaultCountryIso);

  /**
  /**
   * Called as an indication that the Spam implementation should check whether downloading a spam
   * Called as an indication that the Spam implementation should check whether downloading a spam
   * list needs to occur or not.
   * list needs to occur or not.
+6 −0
Original line number Original line Diff line number Diff line
@@ -67,6 +67,12 @@ public class SpamStub implements Spam {
    return Futures.immediateFuture(SimpleSpamStatus.notSpam());
    return Futures.immediateFuture(SimpleSpamStatus.notSpam());
  }
  }


  @Override
  public ListenableFuture<SpamStatus> checkSpamStatusForInCallUi(
      String number, @Nullable String defaultCountryIso) {
    return checkSpamStatus(number, defaultCountryIso);
  }

  @Override
  @Override
  public ListenableFuture<Void> updateSpamListDownload(boolean isEnabledByUser) {
  public ListenableFuture<Void> updateSpamListDownload(boolean isEnabledByUser) {
    // no-op
    // no-op
+3 −1
Original line number Original line Diff line number Diff line
@@ -150,7 +150,9 @@ public class CallList implements DialerCallDelegate {
    if (SpamComponent.get(context).spamSettings().isSpamEnabled()) {
    if (SpamComponent.get(context).spamSettings().isSpamEnabled()) {
      String number = TelecomCallUtil.getNumber(telecomCall);
      String number = TelecomCallUtil.getNumber(telecomCall);
      ListenableFuture<SpamStatus> futureSpamStatus =
      ListenableFuture<SpamStatus> futureSpamStatus =
          SpamComponent.get(context).spam().checkSpamStatus(number, call.getCountryIso());
          SpamComponent.get(context)
              .spam()
              .checkSpamStatusForInCallUi(number, call.getCountryIso());


      Futures.addCallback(
      Futures.addCallback(
          futureSpamStatus,
          futureSpamStatus,