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

Commit 636fa631 authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "Expand onCallHandover logging and add data enabled check." am: bfa913f2

am: fc8e6d9e

Change-Id: I0a4738fec062ac2d023d1cdd60c2e52ee4d8fcc9
parents e6958a45 fc8e6d9e
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -2744,9 +2744,20 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        @Override
        public void onCallHandover(ImsCall imsCall, int srcAccessTech, int targetAccessTech,
            ImsReasonInfo reasonInfo) {
            // Check with the DCTracker to see if data is enabled; there may be a case when
            // ImsPhoneCallTracker isn't being informed of the right data enabled state via its
            // registration, so we'll refresh now.
            boolean isDataEnabled = mPhone.getDefaultPhone().mDcTracker.isDataEnabled();
            if (DBG) {
                log("onCallHandover ::  srcAccessTech=" + srcAccessTech + ", targetAccessTech=" +
                        targetAccessTech + ", reasonInfo=" + reasonInfo);
                log("onCallHandover ::  srcAccessTech=" + srcAccessTech + ", targetAccessTech="
                        + targetAccessTech + ", reasonInfo=" + reasonInfo + ", dataEnabled="
                        + mIsDataEnabled + "/" + isDataEnabled + ", dataMetered="
                        + mIsViLteDataMetered);
            }
            if (mIsDataEnabled != isDataEnabled) {
                loge("onCallHandover: data enabled state doesn't match! (was=" + mIsDataEnabled
                        + ", actually=" + isDataEnabled);
                mIsDataEnabled = isDataEnabled;
            }

            // Only consider it a valid handover to WIFI if the source radio tech is known.
@@ -2808,6 +2819,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    if (!mIsDataEnabled && mIsViLteDataMetered) {
                        // Call was downgraded from WIFI to LTE and data is metered; downgrade the
                        // call now.
                        log("onCallHandover :: data is not enabled; attempt to downgrade.");
                        downgradeVideoCall(ImsReasonInfo.CODE_WIFI_LOST, conn);
                    }
                }
@@ -3889,16 +3901,21 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    Connection.Capability.SUPPORTS_DOWNGRADE_TO_VOICE_LOCAL |
                            Connection.Capability.SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE)
                            && !mSupportPauseVideo) {

                log("downgradeVideoCall :: callId=" + conn.getTelecomCallId()
                        + " Downgrade to audio");
                // If the carrier supports downgrading to voice, then we can simply issue a
                // downgrade to voice instead of terminating the call.
                modifyVideoCall(imsCall, VideoProfile.STATE_AUDIO_ONLY);
            } else if (mSupportPauseVideo && reasonCode != ImsReasonInfo.CODE_WIFI_LOST) {
                // The carrier supports video pause signalling, so pause the video if we didn't just
                // lose wifi; in that case just disconnect.
                log("downgradeVideoCall :: callId=" + conn.getTelecomCallId()
                        + " Pause audio");
                mShouldUpdateImsConfigOnDisconnect = true;
                conn.pauseVideo(VideoPauseTracker.SOURCE_DATA_ENABLED);
            } else {
                log("downgradeVideoCall :: callId=" + conn.getTelecomCallId()
                        + " Disconnect call.");
                // At this point the only choice we have is to terminate the call.
                try {
                    imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED, reasonCode);
+2 −0
Original line number Diff line number Diff line
@@ -383,6 +383,8 @@ public abstract class TelephonyTest {
        doReturn(mServiceState).when(mPhone).getServiceState();
        doReturn(mServiceState).when(mImsPhone).getServiceState();
        doReturn(mPhone).when(mImsPhone).getDefaultPhone();
        mPhone.mDcTracker = mDcTracker;
        doReturn(true).when(mDcTracker).isDataEnabled();
        doReturn(true).when(mPhone).isPhoneTypeGsm();
        doReturn(PhoneConstants.PHONE_TYPE_GSM).when(mPhone).getPhoneType();
        doReturn(mCT).when(mPhone).getCallTracker();