Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +12 −3 Original line number Diff line number Diff line Loading @@ -5491,7 +5491,8 @@ public class ServiceStateTracker extends Handler { } /** * Consider dataRegState if voiceRegState is OOS to determine SPN to be displayed * Consider dataRegState if voiceRegState is OOS to determine SPN to be displayed. * If dataRegState is in service on IWLAN, also check for wifi calling enabled. * @param ss service state. */ protected int getCombinedRegState(ServiceState ss) { Loading @@ -5500,9 +5501,17 @@ public class ServiceStateTracker extends Handler { if ((regState == ServiceState.STATE_OUT_OF_SERVICE || regState == ServiceState.STATE_POWER_OFF) && (dataRegState == ServiceState.STATE_IN_SERVICE)) { if (ss.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN) { if (mPhone.getImsPhone() != null && mPhone.getImsPhone().isWifiCallingEnabled()) { log("getCombinedRegState: return STATE_IN_SERVICE for IWLAN as " + "Data is in service and WFC is enabled"); regState = dataRegState; } } else { log("getCombinedRegState: return STATE_IN_SERVICE as Data is in service"); regState = dataRegState; } } return regState; } Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +30 −19 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { private static final int PHONE_ID = 0; private static final String CARRIER_NAME_DISPLAY_NO_SERVICE = "no service"; private static final String CARRIER_NAME_DISPLAY_NO_SERVICE = "No service"; private static final String CARRIER_NAME_DISPLAY_EMERGENCY_CALL = "emergency call"; private static final String WIFI_CALLING_VOICE_FORMAT = "%s wifi calling"; private static final String WIFI_CALLING_DATA_FORMAT = "%s wifi data"; Loading Loading @@ -2356,16 +2356,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { verify(mEriManager, times(1)).loadEriFile(); } private void enableCdnr() { mBundle.putBoolean( CarrierConfigManager.KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL, true); sendCarrierConfigUpdate(); } @Test public void testUpdateSpnDisplay_noService_displayEmergencyCallOnly() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2388,8 +2380,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_noServiceAndEmergencyCallNotAvailable_displayOOS() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2412,8 +2402,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_flightMode_displayOOS() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2435,8 +2423,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_spnNotEmptyAndWifiCallingEnabled_showSpnOnly() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2467,8 +2453,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { public void testUpdateSpnDisplay_spnEmptyAndWifiCallingEnabled_showPlmnOnly() { // set empty service provider name mBundle.putString(CarrierConfigManager.KEY_CARRIER_NAME_STRING, ""); enableCdnr(); sendCarrierConfigUpdate(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2497,8 +2482,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_inServiceNoWifiCalling_showSpnAndPlmn() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2545,6 +2528,34 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertTrue(sst.shouldForceDisplayNoService()); } @Test public void testUpdateSpnDisplayLegacy_WlanServiceNoWifiCalling_displayOOS() { mBundle.putBoolean( CarrierConfigManager.KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL, false); sendCarrierConfigUpdate(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); // voice out of service but data in service (connected to IWLAN) doReturn(ServiceState.STATE_OUT_OF_SERVICE).when(mServiceState).getState(); doReturn(ServiceState.STATE_IN_SERVICE).when(mServiceState).getDataRegistrationState(); doReturn(TelephonyManager.NETWORK_TYPE_IWLAN).when(mServiceState).getDataNetworkType(); sst.mSS = mServiceState; // wifi-calling is disable doReturn(false).when(mPhone).isWifiCallingEnabled(); // update the spn sst.updateSpnDisplay(); // Plmn should be shown, and the string is "No service" Bundle b = getExtrasFromLastSpnUpdateIntent(); assertThat(b.getString(TelephonyManager.EXTRA_PLMN)) .isEqualTo(CARRIER_NAME_DISPLAY_NO_SERVICE); assertThat(b.getBoolean(TelephonyManager.EXTRA_SHOW_PLMN)).isTrue(); } private Bundle getExtrasFromLastSpnUpdateIntent() { // Verify the spn update notification was sent ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +12 −3 Original line number Diff line number Diff line Loading @@ -5491,7 +5491,8 @@ public class ServiceStateTracker extends Handler { } /** * Consider dataRegState if voiceRegState is OOS to determine SPN to be displayed * Consider dataRegState if voiceRegState is OOS to determine SPN to be displayed. * If dataRegState is in service on IWLAN, also check for wifi calling enabled. * @param ss service state. */ protected int getCombinedRegState(ServiceState ss) { Loading @@ -5500,9 +5501,17 @@ public class ServiceStateTracker extends Handler { if ((regState == ServiceState.STATE_OUT_OF_SERVICE || regState == ServiceState.STATE_POWER_OFF) && (dataRegState == ServiceState.STATE_IN_SERVICE)) { if (ss.getDataNetworkType() == TelephonyManager.NETWORK_TYPE_IWLAN) { if (mPhone.getImsPhone() != null && mPhone.getImsPhone().isWifiCallingEnabled()) { log("getCombinedRegState: return STATE_IN_SERVICE for IWLAN as " + "Data is in service and WFC is enabled"); regState = dataRegState; } } else { log("getCombinedRegState: return STATE_IN_SERVICE as Data is in service"); regState = dataRegState; } } return regState; } Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +30 −19 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { private static final int PHONE_ID = 0; private static final String CARRIER_NAME_DISPLAY_NO_SERVICE = "no service"; private static final String CARRIER_NAME_DISPLAY_NO_SERVICE = "No service"; private static final String CARRIER_NAME_DISPLAY_EMERGENCY_CALL = "emergency call"; private static final String WIFI_CALLING_VOICE_FORMAT = "%s wifi calling"; private static final String WIFI_CALLING_DATA_FORMAT = "%s wifi data"; Loading Loading @@ -2356,16 +2356,8 @@ public class ServiceStateTrackerTest extends TelephonyTest { verify(mEriManager, times(1)).loadEriFile(); } private void enableCdnr() { mBundle.putBoolean( CarrierConfigManager.KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL, true); sendCarrierConfigUpdate(); } @Test public void testUpdateSpnDisplay_noService_displayEmergencyCallOnly() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2388,8 +2380,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_noServiceAndEmergencyCallNotAvailable_displayOOS() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2412,8 +2402,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_flightMode_displayOOS() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading @@ -2435,8 +2423,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_spnNotEmptyAndWifiCallingEnabled_showSpnOnly() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2467,8 +2453,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { public void testUpdateSpnDisplay_spnEmptyAndWifiCallingEnabled_showPlmnOnly() { // set empty service provider name mBundle.putString(CarrierConfigManager.KEY_CARRIER_NAME_STRING, ""); enableCdnr(); sendCarrierConfigUpdate(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2497,8 +2482,6 @@ public class ServiceStateTrackerTest extends TelephonyTest { @Test public void testUpdateSpnDisplay_inServiceNoWifiCalling_showSpnAndPlmn() { enableCdnr(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); Loading Loading @@ -2545,6 +2528,34 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertTrue(sst.shouldForceDisplayNoService()); } @Test public void testUpdateSpnDisplayLegacy_WlanServiceNoWifiCalling_displayOOS() { mBundle.putBoolean( CarrierConfigManager.KEY_ENABLE_CARRIER_DISPLAY_NAME_RESOLVER_BOOL, false); sendCarrierConfigUpdate(); // GSM phone doReturn(true).when(mPhone).isPhoneTypeGsm(); // voice out of service but data in service (connected to IWLAN) doReturn(ServiceState.STATE_OUT_OF_SERVICE).when(mServiceState).getState(); doReturn(ServiceState.STATE_IN_SERVICE).when(mServiceState).getDataRegistrationState(); doReturn(TelephonyManager.NETWORK_TYPE_IWLAN).when(mServiceState).getDataNetworkType(); sst.mSS = mServiceState; // wifi-calling is disable doReturn(false).when(mPhone).isWifiCallingEnabled(); // update the spn sst.updateSpnDisplay(); // Plmn should be shown, and the string is "No service" Bundle b = getExtrasFromLastSpnUpdateIntent(); assertThat(b.getString(TelephonyManager.EXTRA_PLMN)) .isEqualTo(CARRIER_NAME_DISPLAY_NO_SERVICE); assertThat(b.getBoolean(TelephonyManager.EXTRA_SHOW_PLMN)).isTrue(); } private Bundle getExtrasFromLastSpnUpdateIntent() { // Verify the spn update notification was sent ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); Loading