From 06fee1b28472f1019443c9b63ea9bd8aad9f5757 Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 9 Jan 2018 17:33:48 -0800 Subject: Allow SimSuggestionProvider to auto select phone account. Bug: 70503524 Test: Unit tests. PiperOrigin-RevId: 181400523 Change-Id: I07f2f2cd7c1402d1acb6bfbde9db8d90c888edf6 --- .../preferredsim/suggestion/SuggestionProvider.java | 15 +++++++++++++-- .../suggestion/stub/StubSuggestionProvider.java | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/preferredsim') diff --git a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java index 61a831b5e..c1114b3f3 100644 --- a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java +++ b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java @@ -32,17 +32,25 @@ public interface SuggestionProvider { // The SIM has the same carrier as the callee. INTRA_CARRIER, // The user has selected the SIM for the callee multiple times. - FREQUENT + FREQUENT, + // The user has select the SIM for this category of calls (contacts from certain accounts, + // etc.). + USER_SET, } /** The suggestion. */ class Suggestion { @NonNull public final PhoneAccountHandle phoneAccountHandle; @NonNull public final Reason reason; + public final boolean shouldAutoSelect; - public Suggestion(@NonNull PhoneAccountHandle phoneAccountHandle, @NonNull Reason reason) { + public Suggestion( + @NonNull PhoneAccountHandle phoneAccountHandle, + @NonNull Reason reason, + boolean shouldAutoSelect) { this.phoneAccountHandle = Assert.isNotNull(phoneAccountHandle); this.reason = Assert.isNotNull(reason); + this.shouldAutoSelect = shouldAutoSelect; } } @@ -55,4 +63,7 @@ public interface SuggestionProvider { @NonNull Context context, @NonNull String number, @NonNull PhoneAccountHandle phoneAccountHandle); + + @WorkerThread + void reportIncorrectSuggestion(@NonNull Context context, @NonNull String number); } diff --git a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java index e3240448d..6fb73ac5d 100644 --- a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java +++ b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java @@ -41,4 +41,7 @@ public class StubSuggestionProvider implements SuggestionProvider { @NonNull Context context, @NonNull String number, @NonNull PhoneAccountHandle phoneAccountHandle) {} + + @Override + public void reportIncorrectSuggestion(@NonNull Context context, @NonNull String number) {} } -- cgit v1.2.3