Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b654919a authored by Hyunho Shin's avatar Hyunho Shin Committed by Android (Google) Code Review
Browse files

Merge "The framework sends a hang up request to the modem before terminating...

Merge "The framework sends a hang up request to the modem before terminating the connection" into tm-dev
parents 0e19c38b 148116cf
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1193,7 +1193,19 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    @VisibleForTesting
    public void hangupAllOrphanedConnections(int disconnectCause) {
        Log.w(LOG_TAG, "hangupAllOngoingConnections called for cause " + disconnectCause);

        // Send a call terminate request to all available connections.
        // In the ImsPhoneCallTrackerTest, when the hangup() of the connection call,
        // onCallTerminated() is called immediately and the connection is removed.
        // As a result, an IndexOutOfBoundsException is thrown.
        // This is why it counts backwards.
        int size = getConnections().size();
        for (int index = size - 1; index > -1; index--) {
            try {
                getConnections().get(index).hangup();
            } catch (CallStateException e) {
                loge("Failed to disconnet call...");
            }
        }
        // Move connections to disconnected and notify the reason why.
        for (ImsPhoneConnection connection : mConnections) {
            connection.update(connection.getImsCall(), ImsPhoneCall.State.DISCONNECTED);