Merge "enforce limit on SubscriptionAddress" into udc-dev
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 09d8787..2658994 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -450,8 +450,6 @@
private boolean mCanAddCall = true;
- private int mMaxNumberOfSimultaneouslyActiveSims = -1;
-
private Runnable mStopTone;
private LinkedList<HandlerThread> mGraphHandlerThreads;
@@ -3117,6 +3115,18 @@
return constructPossiblePhoneAccounts(handle, user, isVideo, isEmergency, false);
}
+ // Returns whether the device is capable of 2 simultaneous active voice calls on different subs.
+ private boolean isDsdaCallingPossible() {
+ try {
+ return getTelephonyManager().getMaxNumberOfSimultaneouslyActiveSims() > 1
+ || getTelephonyManager().getPhoneCapability()
+ .getMaxActiveVoiceSubscriptions() > 1;
+ } catch (Exception e) {
+ Log.w(this, "exception in isDsdaCallingPossible(): ", e);
+ return false;
+ }
+ }
+
public List<PhoneAccountHandle> constructPossiblePhoneAccounts(Uri handle, UserHandle user,
boolean isVideo, boolean isEmergency, boolean isConference) {
@@ -3133,13 +3143,9 @@
capabilities,
isEmergency ? 0 : PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY,
isEmergency);
- if (mMaxNumberOfSimultaneouslyActiveSims < 0) {
- mMaxNumberOfSimultaneouslyActiveSims =
- getTelephonyManager().getMaxNumberOfSimultaneouslyActiveSims();
- }
// Only one SIM PhoneAccount can be active at one time for DSDS. Only that SIM PhoneAccount
// should be available if a call is already active on the SIM account.
- if (mMaxNumberOfSimultaneouslyActiveSims == 1) {
+ if (!isDsdaCallingPossible()) {
List<PhoneAccountHandle> simAccounts =
mPhoneAccountRegistrar.getSimPhoneAccountsOfCurrentUser();
PhoneAccountHandle ongoingCallAccount = null;