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

Commit 3e1603ed authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

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

Merge "Ensure handover from LTE to WIFI event gets sent in some edge cases." am: 4c59f9b7 am: 1f405921
am: 1794977e

Change-Id: Ib85f6223177292db71e7a6b3df343a02adab03aa
parents f7d4e5d2 1794977e
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -668,12 +668,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
@@ -2274,13 +2274,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());
        }

@@ -2839,7 +2841,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(
@@ -2889,9 +2891,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(),
@@ -2929,8 +2931,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    conn.onHandoverToWifiFailed();
                }
            }
            if (!mHasPerformedStartOfCallHandover) {
                mHasPerformedStartOfCallHandover = true;
            if (!mHasAttemptedStartOfCallHandover) {
                mHasAttemptedStartOfCallHandover = true;
            }
        }

@@ -3005,7 +3007,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) {
@@ -3305,6 +3307,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);