From 791f820f5108b3ea914690145ef261d6c01bf41a Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 19 Sep 2017 12:45:46 -0700 Subject: Perform remote reachability query if caller is not in contacts Lightbringer.supportsUpgrade() is changed to return absent optional when it does not have data for the number. Seeing this LightbringerTech will use Lightbringer.updateReachability() to retrieve it from the remote package, which will store it in the reachability cache. Bug: 63601277 Test: RemoteReachabillityQueryHandlerTest, LightbringerTechTest PiperOrigin-RevId: 169283953 Change-Id: I3f26d9158fc6cfed196fd533da2aad598c8e6a7a --- .../android/dialer/lightbringer/Lightbringer.java | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'java/com/android/dialer/lightbringer/Lightbringer.java') diff --git a/java/com/android/dialer/lightbringer/Lightbringer.java b/java/com/android/dialer/lightbringer/Lightbringer.java index fa57b0166..2318ef5fd 100644 --- a/java/com/android/dialer/lightbringer/Lightbringer.java +++ b/java/com/android/dialer/lightbringer/Lightbringer.java @@ -25,6 +25,9 @@ import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.telecom.Call; import android.telecom.PhoneAccountHandle; +import com.google.auto.value.AutoValue; +import com.google.common.base.Optional; +import java.util.List; public interface Lightbringer { @@ -33,8 +36,12 @@ public interface Lightbringer { @MainThread boolean isReachable(@NonNull Context context, @Nullable String number); + /** @return {@code null} if result is unknown. */ @MainThread - boolean supportsUpgrade(@NonNull Context context, @Nullable String number); + Optional supportsUpgrade(@NonNull Context context, @Nullable String number); + + @MainThread + void updateReachability(@NonNull Context context, @NonNull List numbers); @MainThread Intent getIntent(@NonNull Context context, @NonNull String number); @@ -67,4 +74,19 @@ public interface Lightbringer { @StringRes @MainThread int getIncomingCallTypeText(); + + /** Reachability information for a number. */ + @AutoValue + abstract class ReachabilityData { + public abstract String number(); + + public abstract boolean videoCallable(); + + public abstract boolean supportsUpgrade(); + + public static ReachabilityData create( + String number, boolean videoCallable, boolean supportsUpgrade) { + return new AutoValue_Lightbringer_ReachabilityData(number, videoCallable, supportsUpgrade); + } + } } -- cgit v1.2.3