summaryrefslogtreecommitdiff
path: root/java/com
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-11-22 17:12:49 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-22 17:21:14 -0800
commit38af651c6e0181957533fc31fca265c09dab05d2 (patch)
tree6d97ae7ea8e40418662d25141e8393e0cbbbdc20 /java/com
parent711c98ed1a282b5d93f3252ab67abde24c7a7f47 (diff)
Prevent SIM selection and change SIM from showing when there are active calls
Most devices are DSDS (dual SIM dual standby) which only one SIM can have active calls at a time. Telecom will ignore the phone account handle and use the current active SIM. The SIM selection dialog has no effect, and the change SIM button will just redial with the same SIM. Bug: 69417430 Test: CallingAccountSelectorTest, CallButtonPresenterTest PiperOrigin-RevId: 176718021 Change-Id: I231cfeaa5ff77c29cdaf8e0865d096c85cfb7fc4
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java12
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java6
2 files changed, 17 insertions, 1 deletions
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 8d3df2360..5d928b4fb 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -54,6 +54,7 @@ import com.android.dialer.preferredsim.PreferredSimFallbackContract;
import com.android.dialer.preferredsim.PreferredSimFallbackContract.PreferredSim;
import com.android.dialer.preferredsim.suggestion.SimSuggestionComponent;
import com.android.dialer.preferredsim.suggestion.SuggestionProvider.Suggestion;
+import com.android.dialer.telecom.TelecomUtil;
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
@@ -87,6 +88,17 @@ public class CallingAccountSelector implements PreCallAction {
if (accounts.size() <= 1) {
return false;
}
+
+ if (TelecomUtil.isInManagedCall(context)) {
+ // Most devices are DSDS (dual SIM dual standby) which only one SIM can have active calls at
+ // a time. Telecom will ignore the phone account handle and use the current active SIM, thus
+ // there's no point of selecting SIMs
+ // TODO(a bug): let the user know selections are not available and preferred SIM is not
+ // used
+ // TODO(twyen): support other dual SIM modes when the API is exposed.
+ return false;
+ }
+
return true;
}
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 6b7eb9b4c..bd3ba6dc6 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -464,7 +464,11 @@ public class CallButtonPresenter
&& call.getState() != DialerCall.State.CONNECTING;
mOtherAccount = TelecomUtil.getOtherAccount(getContext(), call.getAccountHandle());
- boolean showSwapSim = mOtherAccount != null && DialerCall.State.isDialing(call.getState());
+ boolean showSwapSim =
+ mOtherAccount != null
+ && DialerCall.State.isDialing(call.getState())
+ // Most devices cannot make calls on 2 SIMs at the same time.
+ && InCallPresenter.getInstance().getCallList().getAllCalls().size() == 1;
mInCallButtonUi.showButton(InCallButtonIds.BUTTON_AUDIO, true);
mInCallButtonUi.showButton(InCallButtonIds.BUTTON_SWAP, showSwap);