summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-01-25 16:14:15 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-25 17:34:21 -0800
commit04306a75588b58208758f43821e1898c6f125baf (patch)
tree71f651124922c345bfcca2687f918dce76e7e927 /java
parentc1623fe219f3229bf9191afdcf0667efd0f549b8 (diff)
Update preferred SIM SuggestionProvider
"remember this SIM" checkbox state is reported to the provider. The other SIM is reported to the provider when "change SIM" is used Bug: 70503524 Test: Unit tests PiperOrigin-RevId: 183308581 Change-Id: I3d097d14a503c759f130044c9a9c48c420eee19d
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java10
-rw-r--r--java/com/android/dialer/preferredsim/PreferredAccountUtil.java (renamed from java/com/android/dialer/precall/impl/PreferredAccountUtil.java)4
-rw-r--r--java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java6
-rw-r--r--java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java6
-rw-r--r--java/com/android/incallui/multisim/SwapSimWorker.java2
5 files changed, 18 insertions, 10 deletions
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 9397d1848..d5ee0f278 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -56,6 +56,7 @@ import com.android.dialer.logging.Logger;
import com.android.dialer.precall.PreCallAction;
import com.android.dialer.precall.PreCallCoordinator;
import com.android.dialer.precall.PreCallCoordinator.PendingAction;
+import com.android.dialer.preferredsim.PreferredAccountUtil;
import com.android.dialer.preferredsim.PreferredSimFallbackContract;
import com.android.dialer.preferredsim.PreferredSimFallbackContract.PreferredSim;
import com.android.dialer.preferredsim.suggestion.SimSuggestionComponent;
@@ -483,7 +484,8 @@ public class CallingAccountSelector implements PreCallAction {
if (number != null) {
DialerExecutorComponent.get(coordinator.getActivity())
.dialerExecutorFactory()
- .createNonUiTaskBuilder(new UserSelectionReporter(selectedAccountHandle, number))
+ .createNonUiTaskBuilder(
+ new UserSelectionReporter(selectedAccountHandle, number, setDefault))
.build()
.executeParallel(coordinator.getActivity());
}
@@ -505,11 +507,13 @@ public class CallingAccountSelector implements PreCallAction {
private final String number;
private final PhoneAccountHandle phoneAccountHandle;
+ private final boolean remember;
public UserSelectionReporter(
- @NonNull PhoneAccountHandle phoneAccountHandle, @Nullable String number) {
+ @NonNull PhoneAccountHandle phoneAccountHandle, @Nullable String number, boolean remember) {
this.phoneAccountHandle = Assert.isNotNull(phoneAccountHandle);
this.number = Assert.isNotNull(number);
+ this.remember = remember;
}
@Nullable
@@ -517,7 +521,7 @@ public class CallingAccountSelector implements PreCallAction {
public Void doInBackground(@NonNull Context context) throws Throwable {
SimSuggestionComponent.get(context)
.getSuggestionProvider()
- .reportUserSelection(context, number, phoneAccountHandle);
+ .reportUserSelection(context, number, phoneAccountHandle, remember);
return null;
}
}
diff --git a/java/com/android/dialer/precall/impl/PreferredAccountUtil.java b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
index 650588829..1cfdbb161 100644
--- a/java/com/android/dialer/precall/impl/PreferredAccountUtil.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountUtil.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package com.android.dialer.precall.impl;
+package com.android.dialer.preferredsim;
import android.content.ComponentName;
import android.content.Context;
@@ -64,7 +64,7 @@ public class PreferredAccountUtil {
return Optional.absent();
}
- private static boolean isPhoneAccountValid(
+ public static boolean isPhoneAccountValid(
Context context, PhoneAccountHandle phoneAccountHandle) {
if (VERSION.SDK_INT >= VERSION_CODES.O) {
return context
diff --git a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
index c1114b3f3..bb50889ec 100644
--- a/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/SuggestionProvider.java
@@ -62,8 +62,10 @@ public interface SuggestionProvider {
void reportUserSelection(
@NonNull Context context,
@NonNull String number,
- @NonNull PhoneAccountHandle phoneAccountHandle);
+ @NonNull PhoneAccountHandle phoneAccountHandle,
+ boolean rememberSelection);
@WorkerThread
- void reportIncorrectSuggestion(@NonNull Context context, @NonNull String number);
+ void reportIncorrectSuggestion(
+ @NonNull Context context, @NonNull String number, @NonNull PhoneAccountHandle newAccount);
}
diff --git a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
index 6fb73ac5d..bd54ddb3a 100644
--- a/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
+++ b/java/com/android/dialer/preferredsim/suggestion/stub/StubSuggestionProvider.java
@@ -40,8 +40,10 @@ public class StubSuggestionProvider implements SuggestionProvider {
public void reportUserSelection(
@NonNull Context context,
@NonNull String number,
- @NonNull PhoneAccountHandle phoneAccountHandle) {}
+ @NonNull PhoneAccountHandle phoneAccountHandle,
+ boolean rememberSelection) {}
@Override
- public void reportIncorrectSuggestion(@NonNull Context context, @NonNull String number) {}
+ public void reportIncorrectSuggestion(
+ @NonNull Context context, @NonNull String number, PhoneAccountHandle newAccount) {}
}
diff --git a/java/com/android/incallui/multisim/SwapSimWorker.java b/java/com/android/incallui/multisim/SwapSimWorker.java
index 28cf293b0..1014d824a 100644
--- a/java/com/android/incallui/multisim/SwapSimWorker.java
+++ b/java/com/android/incallui/multisim/SwapSimWorker.java
@@ -102,7 +102,7 @@ public class SwapSimWorker implements Worker<Void, Void>, DialerCallListener, Ca
try {
SimSuggestionComponent.get(context)
.getSuggestionProvider()
- .reportIncorrectSuggestion(context, number);
+ .reportIncorrectSuggestion(context, number, otherAccount);
if (!PermissionsUtil.hasPhonePermissions(context)) {
LogUtil.e("SwapSimWorker.doInBackground", "missing phone permission");