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

Commit c36ada66 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Ensure handover from LTE to WIFI event gets sent in some edge cases.

Where a call starts on LTE and WIFI is not available, the user would never
see the "call continued on wifi" toast.
This is due to the fact we suppress the handover message when handover
happens at the start of the call.
To fix this, if there is no wifi available at the start of a call, deem
the "start of call handover" phase to have already ended, and allow the
message to be shown.

Test: Manual
Bug: 65490850
Change-Id: Ic01eac1f2f0aef4229881818f50afe0c14b4e5da
parent ee497c36
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -666,12 +666,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    private boolean mNotifyHandoverVideoFromLTEToWifi = false;

    /**
     * When {@code} false, indicates that no handover from LTE to WIFI has occurred during the start
     * of the call.
     * When {@code} false, indicates that no handover from LTE to WIFI has been attempted during the
     * start of the call.
     * When {@code true}, indicates that the start of call handover from LTE to WIFI has been
     * attempted (it may have suceeded or failed).
     * attempted (it may have succeeded or failed).
     */
    private boolean mHasPerformedStartOfCallHandover = false;
    private boolean mHasAttemptedStartOfCallHandover = false;

    /**
     * Carrier configuration option which determines whether the carrier supports the
@@ -2272,13 +2272,15 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    // Schedule check to see if handover succeeded.
                    sendMessageDelayed(obtainMessage(EVENT_CHECK_FOR_WIFI_HANDOVER, imsCall),
                            HANDOVER_TO_WIFI_TIMEOUT_MS);
                    mHasAttemptedStartOfCallHandover = false;
                } else {
                    // No wifi connectivity, so keep track of network availability for potential
                    // handover.
                    registerForConnectivityChanges();
                    // No WIFI, so assume we've already attempted a handover.
                    mHasAttemptedStartOfCallHandover = true;
                }
            }
            mHasPerformedStartOfCallHandover = false;
            mMetrics.writeOnImsCallStarted(mPhone.getPhoneId(), imsCall.getCallSession());
        }

@@ -2837,7 +2839,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    if (isHandoverToWifi) {
                        removeMessages(EVENT_CHECK_FOR_WIFI_HANDOVER);

                        if (mNotifyHandoverVideoFromLTEToWifi && mHasPerformedStartOfCallHandover) {
                        if (mNotifyHandoverVideoFromLTEToWifi && mHasAttemptedStartOfCallHandover) {
                            // This is a handover which happened mid-call (ie not the start of call
                            // handover from LTE to WIFI), so we'll notify the InCall UI.
                            conn.onConnectionEvent(
@@ -2887,9 +2889,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            } else {
                loge("onCallHandover :: connection null.");
            }

            if (!mHasPerformedStartOfCallHandover) {
                mHasPerformedStartOfCallHandover = true;
            // If there's a handover, then we're not in the "start of call" handover phase.
            if (!mHasAttemptedStartOfCallHandover) {
                mHasAttemptedStartOfCallHandover = true;
            }
            mMetrics.writeOnImsCallHandoverEvent(mPhone.getPhoneId(),
                    TelephonyCallSession.Event.Type.IMS_CALL_HANDOVER, imsCall.getCallSession(),
@@ -2927,8 +2929,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    conn.onHandoverToWifiFailed();
                }
            }
            if (!mHasPerformedStartOfCallHandover) {
                mHasPerformedStartOfCallHandover = true;
            if (!mHasAttemptedStartOfCallHandover) {
                mHasAttemptedStartOfCallHandover = true;
            }
        }

@@ -3003,7 +3005,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        public void onCallTerminated(ImsCall imsCall, ImsReasonInfo reasonInfo) {
            if (DBG) log("mImsUssdListener onCallTerminated reasonCode=" + reasonInfo.getCode());
            removeMessages(EVENT_CHECK_FOR_WIFI_HANDOVER);
            mHasPerformedStartOfCallHandover = false;
            mHasAttemptedStartOfCallHandover = false;
            unregisterForConnectivityChanges();

            if (imsCall == mUssdSession) {
@@ -3303,6 +3305,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                        // Handover check and its not the foreground call any more.
                        return;
                    }
                    if (!mHasAttemptedStartOfCallHandover) {
                        mHasAttemptedStartOfCallHandover = true;
                    }
                    if (!imsCall.isWifiCall()) {
                        // Call did not handover to wifi, notify of handover failure.
                        ImsPhoneConnection conn = findConnection(imsCall);