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

Commit 0b93f32c authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Notify telephony when a handover from LTE to WIFI fails.

Also adding test intent which can be used to simulate this situation.

Bug: 30697460
Change-Id: Ic45708699bbeedbb58920373180ea63a8d65ad78
parent 44342517
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public abstract class Connection {
        public void onExtrasChanged(Bundle extras);
        public void onExitedEcmMode();
        public void onCallPullFailed(Connection externalConnection);
        public void onHandoverToWifiFailed();
    }

    /**
@@ -130,6 +131,8 @@ public abstract class Connection {
        public void onExitedEcmMode() {}
        @Override
        public void onCallPullFailed(Connection externalConnection) {}
        @Override
        public void onHandoverToWifiFailed() {}
    }

    public static final int AUDIO_QUALITY_STANDARD = 1;
@@ -938,6 +941,15 @@ public abstract class Connection {
        }
    }

    /**
     * Notifies the connection that there was a failure while handing over to WIFI.
     */
    public void onHandoverToWifiFailed() {
        for (Listener l : mListeners) {
            l.onHandoverToWifiFailed();
        }
    }

    /**
     * Notifies this Connection of a request to disconnect a participant of the conference managed
     * by the connection.
+34 −0
Original line number Diff line number Diff line
@@ -23,11 +23,13 @@ import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import android.telephony.Rlog;
import android.telephony.ServiceState;

import com.android.ims.ImsCall;
import com.android.ims.ImsCallProfile;
import com.android.ims.ImsConferenceState;
import com.android.ims.ImsExternalCallState;
import com.android.ims.ImsReasonInfo;
import com.android.internal.telephony.imsphone.ImsExternalCallTracker;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
@@ -71,6 +73,12 @@ public class TelephonyTester {
    private static final String EXTRA_STATE = "state";
    private static final String EXTRA_CANPULL = "canPull";

    /**
     * Test-only intent used to trigger the signalling which occurs when a handover to WIFI fails.
     */
    private static final String ACTION_TEST_HANDOVER_FAIL =
            "com.android.internal.telephony.TestHandoverFail";

    private static List<ImsExternalCallState> mImsExternalCallStates = null;

    private Phone mPhone;
@@ -94,6 +102,9 @@ public class TelephonyTester {
            } else if (action.equals(ACTION_TEST_DIALOG_EVENT_PACKAGE)) {
                log("handle test dialog event package intent");
                handleTestDialogEventPackageIntent(intent);
            } else if (action.equals(ACTION_TEST_HANDOVER_FAIL)) {
                log("handle handover fail test intent");
                handleHandoverFailedIntent();
            } else {
                if (DBG) log("onReceive: unknown action=" + action);
            }
@@ -116,6 +127,7 @@ public class TelephonyTester {
                log("register for intent action=" + ACTION_TEST_CONFERENCE_EVENT_PACKAGE);
                filter.addAction(ACTION_TEST_CONFERENCE_EVENT_PACKAGE);
                filter.addAction(ACTION_TEST_DIALOG_EVENT_PACKAGE);
                filter.addAction(ACTION_TEST_HANDOVER_FAIL);
                mImsExternalCallStates = new ArrayList<ImsExternalCallState>();
            }

@@ -133,6 +145,28 @@ public class TelephonyTester {
        Rlog.d(LOG_TAG, s);
    }

    private void handleHandoverFailedIntent() {
        // Attempt to get the active IMS call
        ImsPhone imsPhone = (ImsPhone) mPhone;
        if (imsPhone == null) {
            return;
        }

        ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
        if (imsPhoneCall == null) {
            return;
        }

        ImsCall imsCall = imsPhoneCall.getImsCall();
        if (imsCall == null) {
            return;
        }

        imsCall.getImsCallSessionListenerProxy().callSessionHandoverFailed(imsCall.getCallSession(),
                ServiceState.RIL_RADIO_TECHNOLOGY_LTE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN,
                new ImsReasonInfo());
    }

    /**
     * Handles request to send a test conference event package to the active Ims call.
     *
+9 −0
Original line number Diff line number Diff line
@@ -1820,6 +1820,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                log("onCallHandover ::  srcAccessTech=" + srcAccessTech + ", targetAccessTech=" +
                    targetAccessTech + ", reasonInfo=" + reasonInfo);
            }

            mEventLog.writeOnImsCallHandover(imsCall.getCallSession(),
                    srcAccessTech, targetAccessTech, reasonInfo);
        }
@@ -1833,6 +1834,14 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            }
            mEventLog.writeOnImsCallHandoverFailed(imsCall.getCallSession(),
                    srcAccessTech, targetAccessTech, reasonInfo);

            boolean isHandoverToWifi = srcAccessTech != ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN &&
                    targetAccessTech == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN;
            ImsPhoneConnection conn = findConnection(imsCall);
            if (conn != null && isHandoverToWifi) {
                log("onCallHandoverFailed - handover to WIFI Failed");
                conn.onHandoverToWifiFailed();
            }
        }

        /**