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

Commit 8b6c352d authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Add logic to retry call without RTT

am: e5c56852

Change-Id: I0913c64badca134cf8ef7163fa1a4e76b58796aa
parents baeac10d e5c56852
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -95,13 +95,13 @@ import com.android.internal.telephony.Connection;
import com.android.internal.telephony.LocaleTracker;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneInternalInterface;
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyProperties;
import com.android.internal.telephony.dataconnection.DataEnabledSettings;
import com.android.internal.telephony.dataconnection.DataEnabledSettings.DataEnabledChangedReason;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsPhone.ImsDialArgs;
import com.android.internal.telephony.metrics.CallQualityMetrics;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState;
@@ -301,6 +301,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private static final int EVENT_REDIAL_WIFI_E911_TIMEOUT = 29;
    private static final int EVENT_ANSWER_WAITING_CALL = 30;
    private static final int EVENT_RESUME_NOW_FOREGROUND_CALL = 31;
    private static final int EVENT_REDIAL_WITHOUT_RTT = 32;

    private static final int TIMEOUT_HANGUP_PENDINGMO = 500;

@@ -422,7 +423,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private HoldSwapState mHoldSwitchingState = HoldSwapState.INACTIVE;

    private String mLastDialString = null;
    private PhoneInternalInterface.DialArgs mLastDialArgs = null;
    private ImsDialArgs mLastDialArgs = null;

    /**
     * Listeners to changes in the phone state.  Intended for use by other interested IMS components
     * without the need to register a full blown {@link android.telephony.PhoneStateListener}.
@@ -2409,6 +2411,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                        .getSystemService(Context.CONNECTIVITY_SERVICE);
                mgr.setAirplaneMode(false);
                return;
            } else if (reasonInfo.getCode() == ImsReasonInfo.CODE_RETRY_ON_IMS_WITHOUT_RTT) {
                Pair<ImsCall, ImsReasonInfo> callInfo = new Pair<>(imsCall, reasonInfo);
                sendMessage(obtainMessage(EVENT_REDIAL_WITHOUT_RTT, callInfo));
                return;
            } else {
                processCallStateChange(imsCall, ImsPhoneCall.State.DISCONNECTED, cause);
            }
@@ -3445,6 +3451,30 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                sendCallStartFailedDisconnect(callInfo.first, callInfo.second);
                break;
            }

            case EVENT_REDIAL_WITHOUT_RTT: {
                Pair<ImsCall, ImsReasonInfo> callInfo = (Pair<ImsCall, ImsReasonInfo>) msg.obj;
                removeMessages(EVENT_REDIAL_WITHOUT_RTT);
                ImsPhoneConnection oldConnection = findConnection(callInfo.first);
                if (oldConnection == null) {
                    sendCallStartFailedDisconnect(callInfo.first, callInfo.second);
                    break;
                }
                mForegroundCall.detach(oldConnection);
                removeConnection(oldConnection);
                try {
                    mPendingMO = null;
                    ImsDialArgs newDialArgs = ImsDialArgs.Builder.from(mLastDialArgs)
                            .setRttTextStream(null)
                            .build();
                    Connection newConnection =
                            mPhone.getDefaultPhone().dial(mLastDialString, newDialArgs);
                    oldConnection.onOriginalConnectionReplaced(newConnection);
                } catch (CallStateException e) {
                    sendCallStartFailedDisconnect(callInfo.first, callInfo.second);
                }
                break;
            }
        }
    }