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

Commit 7dea152b authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Fix ServiceState to better merge IWLAN service state"

am: 9d92dd3e

Change-Id: I4b90861f9f19bf7d306b082d67903fcb717b3260
parents 90cec8de 9d92dd3e
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) {