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

Commit 6cec95ea authored by SongFerngWang's avatar SongFerngWang
Browse files

ServiceState merges voice and data into a single value

The voice and data is the same for operator name at ServiceState.
So ServiceState merges voice and data into a single value.
- merge the voice and data OperatorAlphaLong,OperatorAlphaShort, and
OperatorNumeric.

Bug: 144663018
Test: Build pass.
      atest ServiceStateTest (PASS)
      atest TelephonyMetricsTest (PASS)
      atest ServiceStateProviderTest (PASS)

Change-Id: I5415774951f1da190bf67e717e91955b919fbc1e
Merged-In: I5415774951f1da190bf67e717e91955b919fbc1e
parent 74379dc8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5211,7 +5211,7 @@ public class ServiceStateTracker extends Handler {
            if (currentServiceState.getVoiceRoaming()) {
                if (mPhone.isPhoneTypeGsm()) {
                    // check roaming type by MCC
                    if (inSameCountry(currentServiceState.getVoiceOperatorNumeric())) {
                    if (inSameCountry(currentServiceState.getOperatorNumeric())) {
                        currentServiceState.setVoiceRoamingType(
                                ServiceState.ROAMING_TYPE_DOMESTIC);
                    } else {
@@ -5235,7 +5235,7 @@ public class ServiceStateTracker extends Handler {
                        }
                    } else {
                        // check roaming type by MCC
                        if (inSameCountry(currentServiceState.getVoiceOperatorNumeric())) {
                        if (inSameCountry(currentServiceState.getOperatorNumeric())) {
                            currentServiceState.setVoiceRoamingType(
                                    ServiceState.ROAMING_TYPE_DOMESTIC);
                        } else {
@@ -5282,7 +5282,7 @@ public class ServiceStateTracker extends Handler {
                        }
                    } else {
                        // take it as 3GPP roaming
                        if (inSameCountry(currentServiceState.getDataOperatorNumeric())) {
                        if (inSameCountry(currentServiceState.getOperatorNumeric())) {
                            currentServiceState.setDataRoamingType(ServiceState.ROAMING_TYPE_DOMESTIC);
                        } else {
                            currentServiceState.setDataRoamingType(
+10 −21
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RIL;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.SmsResponse;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.internal.telephony.UUSInfo;
import com.android.internal.telephony.imsphone.ImsPhoneCall;
import com.android.internal.telephony.nano.TelephonyProto;
@@ -105,6 +104,7 @@ import com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState;
import com.android.internal.telephony.nano.TelephonyProto.TelephonySettings;
import com.android.internal.telephony.nano.TelephonyProto.TimeInterval;
import com.android.internal.telephony.protobuf.nano.MessageNano;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.internal.util.IndentingPrintWriter;

import java.io.FileDescriptor;
@@ -882,31 +882,20 @@ public class TelephonyMetrics {
        ssProto.dataRoamingType = serviceState.getDataRoamingType();

        ssProto.voiceOperator = new TelephonyServiceState.TelephonyOperator();

        if (serviceState.getVoiceOperatorAlphaLong() != null) {
            ssProto.voiceOperator.alphaLong = serviceState.getVoiceOperatorAlphaLong();
        }

        if (serviceState.getVoiceOperatorAlphaShort() != null) {
            ssProto.voiceOperator.alphaShort = serviceState.getVoiceOperatorAlphaShort();
        }

        if (serviceState.getVoiceOperatorNumeric() != null) {
            ssProto.voiceOperator.numeric = serviceState.getVoiceOperatorNumeric();
        }

        ssProto.dataOperator = new TelephonyServiceState.TelephonyOperator();

        if (serviceState.getDataOperatorAlphaLong() != null) {
            ssProto.dataOperator.alphaLong = serviceState.getDataOperatorAlphaLong();
        if (serviceState.getOperatorAlphaLong() != null) {
            ssProto.voiceOperator.alphaLong = serviceState.getOperatorAlphaLong();
            ssProto.dataOperator.alphaLong = serviceState.getOperatorAlphaLong();
        }

        if (serviceState.getDataOperatorAlphaShort() != null) {
            ssProto.dataOperator.alphaShort = serviceState.getDataOperatorAlphaShort();
        if (serviceState.getOperatorAlphaShort() != null) {
            ssProto.voiceOperator.alphaShort = serviceState.getOperatorAlphaShort();
            ssProto.dataOperator.alphaShort = serviceState.getOperatorAlphaShort();
        }

        if (serviceState.getDataOperatorNumeric() != null) {
            ssProto.dataOperator.numeric = serviceState.getDataOperatorNumeric();
        if (serviceState.getOperatorNumeric() != null) {
            ssProto.voiceOperator.numeric = serviceState.getOperatorNumeric();
            ssProto.dataOperator.numeric = serviceState.getOperatorNumeric();
        }

        ssProto.voiceRat = serviceState.getRilVoiceRadioTechnology();
+5 −11
Original line number Diff line number Diff line
@@ -200,19 +200,13 @@ public class ServiceStateTest extends TestCase {
    public void testOperatorName() {
        ServiceState ss = new ServiceState();

        ss.setDataOperatorAlphaLong("abc");
        assertEquals("abc", ss.getDataOperatorAlphaLong());

        ss.setDataOperatorName("def", "xyz", "123456");
        assertEquals("xyz", ss.getDataOperatorAlphaShort());
        ss.setOperatorAlphaLong("abc");
        assertEquals("abc", ss.getOperatorAlphaLong());

        ss.setOperatorName("long", "short", "numeric");
        assertEquals("long", ss.getVoiceOperatorAlphaLong());
        assertEquals("short", ss.getVoiceOperatorAlphaShort());
        assertEquals("numeric", ss.getVoiceOperatorNumeric());
        assertEquals("long", ss.getDataOperatorAlphaLong());
        assertEquals("short", ss.getDataOperatorAlphaShort());
        assertEquals("numeric", ss.getDataOperatorNumeric());
        assertEquals("long", ss.getOperatorAlphaLong());
        assertEquals("short", ss.getOperatorAlphaShort());
        assertEquals("numeric", ss.getOperatorNumeric());
        assertEquals("long", ss.getOperatorAlpha());

        ss.setOperatorName("", "short", "");
+11 −14
Original line number Diff line number Diff line
@@ -108,12 +108,9 @@ public class TelephonyMetricsTest extends TelephonyTest {

        doReturn(ROAMING_TYPE_DOMESTIC).when(mServiceState).getVoiceRoamingType();
        doReturn(ROAMING_TYPE_DOMESTIC).when(mServiceState).getDataRoamingType();
        doReturn("voiceshort").when(mServiceState).getVoiceOperatorAlphaShort();
        doReturn("voicelong").when(mServiceState).getVoiceOperatorAlphaLong();
        doReturn("datashort").when(mServiceState).getDataOperatorAlphaShort();
        doReturn("datalong").when(mServiceState).getDataOperatorAlphaLong();
        doReturn("123456").when(mServiceState).getVoiceOperatorNumeric();
        doReturn("123456").when(mServiceState).getDataOperatorNumeric();
        doReturn("short").when(mServiceState).getOperatorAlphaShort();
        doReturn("long").when(mServiceState).getOperatorAlphaLong();
        doReturn("123456").when(mServiceState).getOperatorNumeric();
        doReturn(RIL_RADIO_TECHNOLOGY_LTE).when(mServiceState).getRilVoiceRadioTechnology();
        doReturn(RIL_RADIO_TECHNOLOGY_LTE).when(mServiceState).getRilDataRadioTechnology();
    }
@@ -675,15 +672,15 @@ public class TelephonyMetricsTest extends TelephonyTest {

        assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);

        assertEquals("voicelong", state.voiceOperator.alphaLong);
        assertEquals("long", state.voiceOperator.alphaLong);

        assertEquals("voiceshort", state.voiceOperator.alphaShort);
        assertEquals("short", state.voiceOperator.alphaShort);

        assertEquals("123456", state.voiceOperator.numeric);

        assertEquals("datalong", state.dataOperator.alphaLong);
        assertEquals("long", state.dataOperator.alphaLong);

        assertEquals("datashort", state.dataOperator.alphaShort);
        assertEquals("short", state.dataOperator.alphaShort);

        assertEquals("123456", state.dataOperator.numeric);
    }
@@ -719,15 +716,15 @@ public class TelephonyMetricsTest extends TelephonyTest {

        assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);

        assertEquals("voicelong", state.voiceOperator.alphaLong);
        assertEquals("long", state.voiceOperator.alphaLong);

        assertEquals("voiceshort", state.voiceOperator.alphaShort);
        assertEquals("short", state.voiceOperator.alphaShort);

        assertEquals("123456", state.voiceOperator.numeric);

        assertEquals("datalong", state.dataOperator.alphaLong);
        assertEquals("long", state.dataOperator.alphaLong);

        assertEquals("datashort", state.dataOperator.alphaShort);
        assertEquals("short", state.dataOperator.alphaShort);

        assertEquals("123456", state.dataOperator.numeric);
    }