Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +9 −2 Original line number Diff line number Diff line Loading @@ -540,6 +540,8 @@ public class ServiceStateTracker extends Handler { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private boolean mEmergencyOnly = false; private boolean mCSEmergencyOnly = false; private boolean mPSEmergencyOnly = false; /** Started the recheck process after finding gprs should registered but not. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private boolean mStartedGprsRegCheck; Loading Loading @@ -2291,15 +2293,16 @@ public class ServiceStateTracker extends Handler { int cssIndicator = voiceSpecificStates.cssSupported ? 1 : 0; int newVoiceRat = ServiceState.networkTypeToRilRadioTechnology( networkRegState.getAccessNetworkTechnology()); mNewSS.setVoiceRegState(regCodeToServiceState(registrationState)); mNewSS.setCssIndicator(cssIndicator); mNewSS.addNetworkRegistrationInfo(networkRegState); setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity()); //Denial reason if registrationState = 3 int reasonForDenial = networkRegState.getRejectCause(); mEmergencyOnly = networkRegState.isEmergencyEnabled(); mCSEmergencyOnly = networkRegState.isEmergencyEnabled(); mEmergencyOnly = (mCSEmergencyOnly || mPSEmergencyOnly); if (mPhone.isPhoneTypeGsm()) { mGsmVoiceRoaming = regCodeIsRoaming(registrationState); Loading Loading @@ -2397,6 +2400,8 @@ public class ServiceStateTracker extends Handler { mServiceStateStats.onServiceStateChanged(mSS); } mPSEmergencyOnly = networkRegState.isEmergencyEnabled(); mEmergencyOnly = (mCSEmergencyOnly || mPSEmergencyOnly); if (mPhone.isPhoneTypeGsm()) { mNewReasonDataDenied = networkRegState.getRejectCause(); Loading Loading @@ -5441,6 +5446,8 @@ public class ServiceStateTracker extends Handler { pw.println(" mGsmVoiceRoaming=" + mGsmVoiceRoaming); pw.println(" mGsmDataRoaming=" + mGsmDataRoaming); pw.println(" mEmergencyOnly=" + mEmergencyOnly); pw.println(" mCSEmergencyOnly=" + mCSEmergencyOnly); pw.println(" mPSEmergencyOnly=" + mPSEmergencyOnly); pw.flush(); mNitzState.dumpState(pw); pw.println(" mLastNitzData=" + mLastNitzData); Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +58 −0 Original line number Diff line number Diff line Loading @@ -2053,6 +2053,64 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertEquals(null, sst.getServiceState().getOperatorAlpha()); } @Test public void testCSEmergencyRegistrationState() throws Exception { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst", Collections.emptyList()); NetworkRegistrationInfo dataReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, false, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), 1, false, false, false, null); NetworkRegistrationInfo voiceReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, true, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in oos sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); assertTrue(sst.mSS.isEmergencyOnly()); } @Test public void testPSEmergencyRegistrationState() throws Exception { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst", Collections.emptyList()); NetworkRegistrationInfo dataReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, true, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), 1, false, false, false, null); NetworkRegistrationInfo voiceReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, false, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in oos sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); assertTrue(sst.mSS.isEmergencyOnly()); } // Edge and GPRS are grouped under the same family and Edge has higher rate than GPRS. // Expect no rat update when move from E to G. @Test Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +9 −2 Original line number Diff line number Diff line Loading @@ -540,6 +540,8 @@ public class ServiceStateTracker extends Handler { */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private boolean mEmergencyOnly = false; private boolean mCSEmergencyOnly = false; private boolean mPSEmergencyOnly = false; /** Started the recheck process after finding gprs should registered but not. */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private boolean mStartedGprsRegCheck; Loading Loading @@ -2291,15 +2293,16 @@ public class ServiceStateTracker extends Handler { int cssIndicator = voiceSpecificStates.cssSupported ? 1 : 0; int newVoiceRat = ServiceState.networkTypeToRilRadioTechnology( networkRegState.getAccessNetworkTechnology()); mNewSS.setVoiceRegState(regCodeToServiceState(registrationState)); mNewSS.setCssIndicator(cssIndicator); mNewSS.addNetworkRegistrationInfo(networkRegState); setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity()); //Denial reason if registrationState = 3 int reasonForDenial = networkRegState.getRejectCause(); mEmergencyOnly = networkRegState.isEmergencyEnabled(); mCSEmergencyOnly = networkRegState.isEmergencyEnabled(); mEmergencyOnly = (mCSEmergencyOnly || mPSEmergencyOnly); if (mPhone.isPhoneTypeGsm()) { mGsmVoiceRoaming = regCodeIsRoaming(registrationState); Loading Loading @@ -2397,6 +2400,8 @@ public class ServiceStateTracker extends Handler { mServiceStateStats.onServiceStateChanged(mSS); } mPSEmergencyOnly = networkRegState.isEmergencyEnabled(); mEmergencyOnly = (mCSEmergencyOnly || mPSEmergencyOnly); if (mPhone.isPhoneTypeGsm()) { mNewReasonDataDenied = networkRegState.getRejectCause(); Loading Loading @@ -5441,6 +5446,8 @@ public class ServiceStateTracker extends Handler { pw.println(" mGsmVoiceRoaming=" + mGsmVoiceRoaming); pw.println(" mGsmDataRoaming=" + mGsmDataRoaming); pw.println(" mEmergencyOnly=" + mEmergencyOnly); pw.println(" mCSEmergencyOnly=" + mCSEmergencyOnly); pw.println(" mPSEmergencyOnly=" + mPSEmergencyOnly); pw.flush(); mNitzState.dumpState(pw); pw.println(" mLastNitzData=" + mLastNitzData); Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +58 −0 Original line number Diff line number Diff line Loading @@ -2053,6 +2053,64 @@ public class ServiceStateTrackerTest extends TelephonyTest { assertEquals(null, sst.getServiceState().getOperatorAlpha()); } @Test public void testCSEmergencyRegistrationState() throws Exception { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst", Collections.emptyList()); NetworkRegistrationInfo dataReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, false, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), 1, false, false, false, null); NetworkRegistrationInfo voiceReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, true, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in oos sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); assertTrue(sst.mSS.isEmergencyOnly()); } @Test public void testPSEmergencyRegistrationState() throws Exception { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "001", "01", "test", "tst", Collections.emptyList()); NetworkRegistrationInfo dataReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, true, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), 1, false, false, false, null); NetworkRegistrationInfo voiceReg = new NetworkRegistrationInfo( NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN, 0, 16, 0, false, null, cellIdentity, getPlmnFromCellIdentity(cellIdentity), false, 0, 0, 0); sst.mPollingContext[0] = 2; // update data reg state to be in oos sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_PS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, dataReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); sst.sendMessage(sst.obtainMessage( ServiceStateTracker.EVENT_POLL_STATE_CS_CELLULAR_REGISTRATION, new AsyncResult(sst.mPollingContext, voiceReg, null))); waitForLastHandlerAction(mSSTTestHandler.getThreadHandler()); assertTrue(sst.mSS.isEmergencyOnly()); } // Edge and GPRS are grouped under the same family and Edge has higher rate than GPRS. // Expect no rat update when move from E to G. @Test Loading