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

Commit b867295c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Exclude IWLAN network type from isInService check"

parents 9879a637 0e48aacf
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
package com.android.settingslib;

import static android.telephony.ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN;

import android.annotation.ColorInt;
import android.content.Context;
import android.content.Intent;
@@ -429,12 +431,14 @@ public class Utils {
        // 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.
        // is not available. Note that we ignore the IWLAN service state
        // because that state indicates the use of VoWIFI and not cell service
        int state = serviceState.getState();
        int dataState = serviceState.getDataRegState();
        if (state == ServiceState.STATE_OUT_OF_SERVICE
                || state == ServiceState.STATE_EMERGENCY_ONLY) {
            if (dataState == ServiceState.STATE_IN_SERVICE) {
            if (dataState == ServiceState.STATE_IN_SERVICE
                    && serviceState.getDataNetworkType() != RIL_RADIO_TECHNOLOGY_IWLAN) {
                return ServiceState.STATE_IN_SERVICE;
            }
        }
+9 −0
Original line number Diff line number Diff line
@@ -246,6 +246,15 @@ public class UtilsTest {
        assertThat(Utils.isInService(mServiceState)).isTrue();
    }

    @Test
    public void isInService_voiceOutOfServiceDataInServiceOnIwLan_returnFalse() {
        when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
        when(mServiceState.getDataNetworkType())
                .thenReturn(ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN);
        when(mServiceState.getDataRegState()).thenReturn(ServiceState.STATE_IN_SERVICE);
        assertThat(Utils.isInService(mServiceState)).isFalse();
    }

    @Test
    public void isInService_voiceOutOfServiceDataOutOfService_returnFalse() {
        when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);