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

Commit fdff63fc authored by SongFerng Wang's avatar SongFerng Wang Committed by Automerger Merge Worker
Browse files

Merge "[5G PCO]The PCO's contents is not fixed, so catch the last byte." into...

Merge "[5G PCO]The PCO's contents is not fixed, so catch the last byte." into sc-qpr1-dev am: b00d6547

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

Change-Id: I955fb47624ed1b5a104ba3e3c16d0717ed6463fa
parents 0a424be0 b00d6547
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -926,8 +926,10 @@ public class NetworkTypeController extends StateMachine {
                    && mNrAdvancedCapablePcoId > 0
                    && pcodata.pcoId == mNrAdvancedCapablePcoId
            ) {
                log("EVENT_PCO_DATA_CHANGED: Nr Advanced is allowed by PCO.");
                mIsNrAdvancedAllowedByPco = pcodata.contents[0] == 1;
                log("EVENT_PCO_DATA_CHANGED: Nr Advanced is allowed by PCO. length:"
                        + pcodata.contents.length + ",value: " + Arrays.toString(pcodata.contents));
                mIsNrAdvancedAllowedByPco = (pcodata.contents.length > 0)
                        ? pcodata.contents[pcodata.contents.length - 1] == 1 : false;
                updateNrAdvancedState();
            }
        }
+47 −0
Original line number Diff line number Diff line
@@ -482,6 +482,31 @@ public class NetworkTypeControllerTest extends TelephonyTest {
        assertEquals("connected", getCurrentState().getName());
    }

    @Test
    public void testTransitionToCurrentStateNrConnectedWithPcoLength4AndNoNrAdvancedCapable()
            throws Exception {
        assertEquals("DefaultState", getCurrentState().getName());
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();
        doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
        doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange();
        mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT, 0xFF03);
        broadcastCarrierConfigs();
        int cid = 1;
        byte[] contents = new byte[]{31, 1, 84, 0};
        doReturn(mDataConnection).when(mDcTracker).getDataConnectionByContextId(cid);
        doReturn(mApnSetting).when(mDataConnection).getApnSetting();
        doReturn(true).when(mApnSetting).canHandleType(ApnSetting.TYPE_DEFAULT);
        mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT, 0xFF03);
        broadcastCarrierConfigs();


        mNetworkTypeController.sendMessage(EVENT_PCO_DATA_CHANGED,
                new AsyncResult(null, new PcoData(cid, "", 0xff03, contents), null));
        mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE);
        processAllMessages();
        assertEquals("connected", getCurrentState().getName());
    }

    @Test
    public void testTransitionToCurrentStateNrConnectedWithWrongPcoAndNoNrAdvancedCapable()
            throws Exception {
@@ -529,6 +554,28 @@ public class NetworkTypeControllerTest extends TelephonyTest {
        assertEquals("connected_mmwave", getCurrentState().getName());
    }

    @Test
    public void testTransitionToCurrentStateNrConnectedWithNrAdvancedCapableAndPcoLength4()
            throws Exception {
        assertEquals("DefaultState", getCurrentState().getName());
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();
        doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
        doReturn(ServiceState.FREQUENCY_RANGE_MMWAVE).when(mServiceState).getNrFrequencyRange();
        int cid = 1;
        byte[] contents = new byte[]{31, 1, 84, 1};
        doReturn(mDataConnection).when(mDcTracker).getDataConnectionByContextId(cid);
        doReturn(mApnSetting).when(mDataConnection).getApnSetting();
        doReturn(true).when(mApnSetting).canHandleType(ApnSetting.TYPE_DEFAULT);
        mBundle.putInt(CarrierConfigManager.KEY_NR_ADVANCED_CAPABLE_PCO_ID_INT, 0xFF03);
        broadcastCarrierConfigs();

        mNetworkTypeController.sendMessage(EVENT_PCO_DATA_CHANGED,
                new AsyncResult(null, new PcoData(cid, "", 0xff03, contents), null));
        mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE);
        processAllMessages();
        assertEquals("connected_mmwave", getCurrentState().getName());
    }

    @Test
    public void testEventDataRatChanged() throws Exception {
        testTransitionToCurrentStateLegacy();