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

Commit f1cb3066 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "consider PS registration state for emergency" am: 1fe128c8

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1704345

Change-Id: Ie0f25f5e205e7da5b9ccdab18c81f9febadfe09a
parents 4dfc2a5f 1fe128c8
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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);
@@ -2397,6 +2400,8 @@ public class ServiceStateTracker extends Handler {
                    mServiceStateStats.onServiceStateChanged(mSS);
                }

                mPSEmergencyOnly = networkRegState.isEmergencyEnabled();
                mEmergencyOnly = (mCSEmergencyOnly || mPSEmergencyOnly);
                if (mPhone.isPhoneTypeGsm()) {

                    mNewReasonDataDenied = networkRegState.getRejectCause();
@@ -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);
+58 −0
Original line number Diff line number Diff line
@@ -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