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

Commit 2ee168ea authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Display signal strength on data-only SIMs.

On SIM cards that support data but not voice, we currently
display a null signal strength icon, which is confusing because
data is actually working.

Fix this by displaying signal bars as well as showing the
"emergency calls only" or "no service" text which indicates that
voice service is not available.

Bug: 3339315
Change-Id: I7d888721e8dc5e22fefd1b8fa85ba046d46a8fba
parent 58514937
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -430,7 +430,8 @@ public class NetworkController extends BroadcastReceiver {
        @Override
        public void onServiceStateChanged(ServiceState state) {
            if (DEBUG) {
                Log.d(TAG, "onServiceStateChanged state=" + state.getState());
                Log.d(TAG, "onServiceStateChanged voiceState=" + state.getVoiceRegState()
                        + " dataState=" + state.getDataRegState());
            }
            mServiceState = state;
            updateTelephonySignalStrength();
@@ -506,10 +507,16 @@ public class NetworkController extends BroadcastReceiver {

    private boolean hasService() {
        if (mServiceState != null) {
            switch (mServiceState.getState()) {
                case ServiceState.STATE_OUT_OF_SERVICE:
            // Consider the device to be in service if either voice or data service is available.
            // Some SIM cards are marketed as data-only and do not support voice service, and on
            // these SIM cards, we want to show signal bars for data service as well as the "no
            // service" or "emergency calls only" text that indicates that voice is not available.
            switch(mServiceState.getVoiceRegState()) {
                case ServiceState.STATE_POWER_OFF:
                    return false;
                case ServiceState.STATE_OUT_OF_SERVICE:
                case ServiceState.STATE_EMERGENCY_ONLY:
                    return mServiceState.getDataRegState() == ServiceState.STATE_IN_SERVICE;
                default:
                    return true;
            }