Make addExistingConnection MSIM aware
addExistingConnection was using the default subscription to
find the SIM call manager, which changes, depending on the user
settings for voice subscription ID. In some cases, we were not
finding the Fi call manager (Fi ESIM and no voice pref set), which
was causing addExistingConnection to only try to find a call manager
associated with the pSIM, which does not exist. This was causing
conferencing to fail.
Instead, check all SIM calling accounts for an associated call manager
and make sure the connection being added is associated with one of
those accounts if it is not associated with a SIM calling account.
Bug: 134691559
Test: atest CtsTelecomTestCases; manual testing
Change-Id: I72e7d57b651d62ad44356720f03895da0ea9462b
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index d4b073c..4621558 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -823,9 +823,18 @@
}
// Allow the Sim call manager account as well, even if its disabled.
if (phoneAccountHandle == null && callingPhoneAccountHandle != null) {
- if (callingPhoneAccountHandle.equals(
- mPhoneAccountRegistrar.getSimCallManager(userHandle))) {
- phoneAccountHandle = callingPhoneAccountHandle;
+ // Search all SIM PhoneAccounts to see if there is a SIM call manager
+ // associated with any of them and verify that the calling handle matches.
+ for (PhoneAccountHandle handle :
+ mPhoneAccountRegistrar.getSimPhoneAccounts(userHandle)) {
+ int subId = mPhoneAccountRegistrar.getSubscriptionIdForPhoneAccount(
+ handle);
+ PhoneAccountHandle connectionMgrHandle =
+ mPhoneAccountRegistrar.getSimCallManager(subId, userHandle);
+ if (callingPhoneAccountHandle.equals(connectionMgrHandle)) {
+ phoneAccountHandle = connectionMgrHandle;
+ break;
+ }
}
}
if (phoneAccountHandle != null) {