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

Commit 85af3e73 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Fix ServiceState to better merge IWLAN service state

We now always use the ServiceState from the ServiceStateTracker
unless we are on IWLAN. In this case, the voice reg state
is represented by the data reg state, so override the voice
reg state.

Bug: 72483562
Test: Shield Box testing
Change-Id: I6b6023c00a88fa398a6d46d233ba05ac8bb7cf6b
parent 7e057b99
Loading
Loading
Loading
Loading
+27 −2
Original line number Diff line number Diff line
@@ -421,8 +421,7 @@ public class GsmCdmaPhone extends Phone {
    public ServiceState getServiceState() {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
            if (mImsPhone != null) {
                return ServiceState.mergeServiceStates(
                        (mSST == null) ? new ServiceState() : mSST.mSS,
                return mergeServiceStates((mSST == null) ? new ServiceState() : mSST.mSS,
                        mImsPhone.getServiceState());
            }
        }
@@ -829,6 +828,32 @@ public class GsmCdmaPhone extends Phone {
        return mCT.mRingingCall;
    }

    /**
     * ImsService reports "IN_SERVICE" for its voice registration state even if the device
     * has lost the physical link to the tower. This helper method merges the IMS and modem
     * ServiceState, only overriding the voice registration state when we are registered to IMS over
     * IWLAN. In this case the voice registration state will always be "OUT_OF_SERVICE", so override
     * the voice registration state with the data registration state.
     */
    private ServiceState mergeServiceStates(ServiceState baseSs, ServiceState imsSs) {
        // "IN_SERVICE" in this case means IMS is registered.
        if (imsSs.getVoiceRegState() != ServiceState.STATE_IN_SERVICE) {
            return baseSs;
        }

        if (imsSs.getRilDataRadioTechnology() == ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN) {
            ServiceState newSs = new ServiceState(baseSs);
            // Voice override for IWLAN. In this case, voice registration is OUT_OF_SERVICE, but
            // the data RAT is IWLAN, so use that as a basis for determining whether or not the
            // physical link is available.
            newSs.setVoiceRegState(baseSs.getDataRegState());
            newSs.setEmergencyOnly(false); // only get here if voice is IN_SERVICE
            return newSs;
        }

        return baseSs;
    }

    private boolean handleCallDeflectionIncallSupplementaryService(
            String dialString) {
        if (dialString.length() > 1) {