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

Commit 590163ef authored by Etan Cohen's avatar Etan Cohen Committed by Android Git Automerger
Browse files

am 2b267872: Added mechanism to merge voice & baseline ServiceState objects.

* commit '2b26787292a93265c323aa2c81af3b5bb71db299':
  Added mechanism to merge voice & baseline ServiceState objects.
parents 2fa8f509 dcc0736c
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -861,4 +861,23 @@ public class ServiceState implements Parcelable {
                || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B
                || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B
                || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD;
                || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD;
    }
    }

    /**
     * Returns a merged ServiceState consisting of the base SS with voice settings from the
     * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned).
     * @hide
     * */
    public static ServiceState mergeServiceStates(ServiceState baseSs, ServiceState voiceSs) {
        if (voiceSs.mVoiceRegState != STATE_IN_SERVICE) {
            return baseSs;
        }

        ServiceState newSs = new ServiceState(baseSs);

        // voice overrides
        newSs.mVoiceRegState = voiceSs.mVoiceRegState;
        newSs.mIsEmergencyOnly = false; // only get here if voice is IN_SERVICE

        return newSs;
    }
}
}