diff options
author | Treehugger Robot <android-build-prod@system.gserviceaccount.com> | 2022-03-14 04:18:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-03-14 04:18:26 +0000 |
commit | 82fbc3e0e7c7c12c1c6a1339b95235c84ddcf05e (patch) | |
tree | 6870806ba2e45c25af2a90dcb4a8b32d20837e75 | |
parent | c2942d8e7d02bfb6d6cb5c178971930602b89d48 (diff) | |
parent | 92d21658a23588cba604e0802bc72603b17879ba (diff) |
Merge "Fix concurrent calls occurs when E911 redial happens" into s-keystone-qcom-dev
-rw-r--r-- | src/com/android/services/telephony/TelephonyConnectionService.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java index 0abbce756e..6757b4a9bc 100644 --- a/src/com/android/services/telephony/TelephonyConnectionService.java +++ b/src/com/android/services/telephony/TelephonyConnectionService.java @@ -255,6 +255,7 @@ public class TelephonyConnectionService extends ConnectionService { boolean hasIccCard(int slotId); boolean isCurrentEmergencyNumber(String number); Map<Integer, List<EmergencyNumber>> getCurrentEmergencyNumberList(); + boolean isConcurrentCallsPossible(); } private TelephonyManagerProxy mTelephonyManagerProxy; @@ -294,6 +295,11 @@ public class TelephonyConnectionService extends ConnectionService { return new HashMap<>(); } } + + @Override + public boolean isConcurrentCallsPossible() { + return mTelephonyManager.isConcurrentCallsPossible(); + } } /** @@ -2107,7 +2113,13 @@ public class TelephonyConnectionService extends ConnectionService { Bundle connExtras = c.getExtras(); Log.i(this, "retryOutgoingOriginalConnection, redialing on Phone Id: " + newPhoneToUse); c.clearOriginalConnection(); - if (phoneId != newPhoneToUse.getPhoneId()) updatePhoneAccount(c, newPhoneToUse); + if (phoneId != newPhoneToUse.getPhoneId()) { + if (!mTelephonyManagerProxy.isConcurrentCallsPossible()) { + disconnectAllCallsOnOtherSubs( + mPhoneUtilsProxy.makePstnPhoneAccountHandle(newPhoneToUse)); + } + updatePhoneAccount(c, newPhoneToUse); + } placeOutgoingConnection(c, newPhoneToUse, videoState, connExtras); } else { // We have run out of Phones to use. Disconnect the call and destroy the connection. @@ -3450,4 +3462,23 @@ public class TelephonyConnectionService extends ConnectionService { } }); } + + private void disconnectAllCallsOnOtherSubs (@NonNull PhoneAccountHandle handle) { + Collection<Connection>connections = getAllConnections(); + connections.stream() + .filter(c -> + (c.getState() == Connection.STATE_ACTIVE + || c.getState() == Connection.STATE_HOLDING) + // Include any calls not on same sub as current connection. + && !Objects.equals(c.getPhoneAccountHandle(), handle)) + .forEach(c -> { + if (c instanceof TelephonyConnection) { + TelephonyConnection tc = (TelephonyConnection) c; + Log.i(LOG_TAG, "disconnectAllCallsOnOtherSubs: disconnect" + + " %s due to redial happened on other sub.", + tc.getTelecomCallId()); + tc.hangup(android.telephony.DisconnectCause.LOCAL); + } + }); + } } |