Loading src/java/com/android/internal/telephony/Phone.java +1 −0 Original line number Diff line number Diff line Loading @@ -4083,6 +4083,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println(" getActiveApnTypes()=" + getActiveApnTypes()); pw.println(" needsOtaServiceProvisioning=" + needsOtaServiceProvisioning()); pw.println(" isInEmergencySmsMode=" + isInEmergencySmsMode()); pw.println(" service state=" + getServiceState()); pw.flush(); pw.println("++++++++++++++++++++++++++++++++"); Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -5223,6 +5223,10 @@ public class ServiceStateTracker extends Handler { mNewSS.addNetworkRegistrationInfo(nri); } mNewSS.setOperatorAlphaLong(operator); // Since it's in airplane mode, cellular must be out of service. The only possible // transport for data to go through is the IWLAN transport. Setting this to true // so that ServiceState.getDataNetworkType can report the right RAT. mNewSS.setIwlanPreferred(true); log("pollStateDone: mNewSS = " + mNewSS); } return; Loading src/java/com/android/internal/telephony/imsphone/ImsPhone.java +1 −0 Original line number Diff line number Diff line Loading @@ -1444,6 +1444,7 @@ public class ImsPhone extends ImsPhoneBase { mSS.addNetworkRegistrationInfo(nri); } mSS.setIwlanPreferred(ss.isIwlanPreferred()); logd("updateDataServiceState: defSs = " + ss + " imsSs = " + mSS); } } Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +84 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,89 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(serviceState, mPhoneUT.getServiceState()); } @Test @SmallTest public void testGetMergedServiceState() throws Exception { ServiceState imsServiceState = new ServiceState(); NetworkRegistrationInfo imsCsWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_CS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); NetworkRegistrationInfo imsPsWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); NetworkRegistrationInfo imsPsWlanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); imsServiceState.addNetworkRegistrationInfo(imsCsWwanRegInfo); imsServiceState.addNetworkRegistrationInfo(imsPsWwanRegInfo); imsServiceState.addNetworkRegistrationInfo(imsPsWlanRegInfo); imsServiceState.setVoiceRegState(ServiceState.STATE_IN_SERVICE); imsServiceState.setDataRegState(ServiceState.STATE_IN_SERVICE); imsServiceState.setIwlanPreferred(true); doReturn(imsServiceState).when(mImsPhone).getServiceState(); replaceInstance(Phone.class, "mImsPhone", mPhoneUT, mImsPhone); ServiceState serviceState = new ServiceState(); NetworkRegistrationInfo csWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_CS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING) .build(); NetworkRegistrationInfo psWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING) .build(); NetworkRegistrationInfo psWlanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); serviceState.addNetworkRegistrationInfo(csWwanRegInfo); serviceState.addNetworkRegistrationInfo(psWwanRegInfo); serviceState.addNetworkRegistrationInfo(psWlanRegInfo); serviceState.setVoiceRegState(ServiceState.STATE_OUT_OF_SERVICE); serviceState.setDataRegState(ServiceState.STATE_IN_SERVICE); serviceState.setIwlanPreferred(true); mSST.mSS = serviceState; mPhoneUT.mSST = mSST; ServiceState mergedServiceState = mPhoneUT.getServiceState(); assertEquals(ServiceState.STATE_IN_SERVICE, mergedServiceState.getVoiceRegState()); assertEquals(ServiceState.STATE_IN_SERVICE, mergedServiceState.getDataRegState()); assertEquals(TelephonyManager.NETWORK_TYPE_IWLAN, mergedServiceState.getDataNetworkType()); } @Test @SmallTest public void testGetSubscriberIdForGsmPhone() { Loading Loading @@ -1002,3 +1085,4 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(msisdn, mPhoneUT.getLine1Number()); } } Loading
src/java/com/android/internal/telephony/Phone.java +1 −0 Original line number Diff line number Diff line Loading @@ -4083,6 +4083,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { pw.println(" getActiveApnTypes()=" + getActiveApnTypes()); pw.println(" needsOtaServiceProvisioning=" + needsOtaServiceProvisioning()); pw.println(" isInEmergencySmsMode=" + isInEmergencySmsMode()); pw.println(" service state=" + getServiceState()); pw.flush(); pw.println("++++++++++++++++++++++++++++++++"); Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +4 −0 Original line number Diff line number Diff line Loading @@ -5223,6 +5223,10 @@ public class ServiceStateTracker extends Handler { mNewSS.addNetworkRegistrationInfo(nri); } mNewSS.setOperatorAlphaLong(operator); // Since it's in airplane mode, cellular must be out of service. The only possible // transport for data to go through is the IWLAN transport. Setting this to true // so that ServiceState.getDataNetworkType can report the right RAT. mNewSS.setIwlanPreferred(true); log("pollStateDone: mNewSS = " + mNewSS); } return; Loading
src/java/com/android/internal/telephony/imsphone/ImsPhone.java +1 −0 Original line number Diff line number Diff line Loading @@ -1444,6 +1444,7 @@ public class ImsPhone extends ImsPhoneBase { mSS.addNetworkRegistrationInfo(nri); } mSS.setIwlanPreferred(ss.isIwlanPreferred()); logd("updateDataServiceState: defSs = " + ss + " imsSs = " + mSS); } } Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaPhoneTest.java +84 −0 Original line number Diff line number Diff line Loading @@ -167,6 +167,89 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(serviceState, mPhoneUT.getServiceState()); } @Test @SmallTest public void testGetMergedServiceState() throws Exception { ServiceState imsServiceState = new ServiceState(); NetworkRegistrationInfo imsCsWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_CS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); NetworkRegistrationInfo imsPsWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); NetworkRegistrationInfo imsPsWlanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); imsServiceState.addNetworkRegistrationInfo(imsCsWwanRegInfo); imsServiceState.addNetworkRegistrationInfo(imsPsWwanRegInfo); imsServiceState.addNetworkRegistrationInfo(imsPsWlanRegInfo); imsServiceState.setVoiceRegState(ServiceState.STATE_IN_SERVICE); imsServiceState.setDataRegState(ServiceState.STATE_IN_SERVICE); imsServiceState.setIwlanPreferred(true); doReturn(imsServiceState).when(mImsPhone).getServiceState(); replaceInstance(Phone.class, "mImsPhone", mPhoneUT, mImsPhone); ServiceState serviceState = new ServiceState(); NetworkRegistrationInfo csWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_CS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING) .build(); NetworkRegistrationInfo psWwanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING) .build(); NetworkRegistrationInfo psWlanRegInfo = new NetworkRegistrationInfo.Builder() .setDomain(NetworkRegistrationInfo.DOMAIN_PS) .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN) .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN) .setRegistrationState( NetworkRegistrationInfo.REGISTRATION_STATE_HOME) .build(); serviceState.addNetworkRegistrationInfo(csWwanRegInfo); serviceState.addNetworkRegistrationInfo(psWwanRegInfo); serviceState.addNetworkRegistrationInfo(psWlanRegInfo); serviceState.setVoiceRegState(ServiceState.STATE_OUT_OF_SERVICE); serviceState.setDataRegState(ServiceState.STATE_IN_SERVICE); serviceState.setIwlanPreferred(true); mSST.mSS = serviceState; mPhoneUT.mSST = mSST; ServiceState mergedServiceState = mPhoneUT.getServiceState(); assertEquals(ServiceState.STATE_IN_SERVICE, mergedServiceState.getVoiceRegState()); assertEquals(ServiceState.STATE_IN_SERVICE, mergedServiceState.getDataRegState()); assertEquals(TelephonyManager.NETWORK_TYPE_IWLAN, mergedServiceState.getDataNetworkType()); } @Test @SmallTest public void testGetSubscriberIdForGsmPhone() { Loading Loading @@ -1002,3 +1085,4 @@ public class GsmCdmaPhoneTest extends TelephonyTest { assertEquals(msisdn, mPhoneUT.getLine1Number()); } }