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

Commit 9d92dd3e authored by Brad Ebinger's avatar Brad Ebinger Committed by Gerrit Code Review
Browse files

Merge "Fix ServiceState to better merge IWLAN service state"

parents 5611e841 85af3e73
Loading
Loading
Loading
Loading
+27 −2
Original line number Original line Diff line number Diff line
@@ -421,8 +421,7 @@ public class GsmCdmaPhone extends Phone {
    public ServiceState getServiceState() {
    public ServiceState getServiceState() {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
            if (mImsPhone != null) {
            if (mImsPhone != null) {
                return ServiceState.mergeServiceStates(
                return mergeServiceStates((mSST == null) ? new ServiceState() : mSST.mSS,
                        (mSST == null) ? new ServiceState() : mSST.mSS,
                        mImsPhone.getServiceState());
                        mImsPhone.getServiceState());
            }
            }
        }
        }
@@ -829,6 +828,32 @@ public class GsmCdmaPhone extends Phone {
        return mCT.mRingingCall;
        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(
    private boolean handleCallDeflectionIncallSupplementaryService(
            String dialString) {
            String dialString) {
        if (dialString.length() > 1) {
        if (dialString.length() > 1) {