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

Commit 70ebab5f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed a crash when data network does not have PCO" into tm-qpr-dev

parents a04bc342 ace33afe
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3290,14 +3290,14 @@ public class DataNetwork extends StateMachine {

    /**
     * @return The PCO data map of the network. The key is the PCO id, the value is the PCO data.
     * An empty map if PCO data is not available.
     * An empty map if PCO data is not available (or when the network is on IWLAN).
     */
    public @NonNull Map<Integer, PcoData> getPcoData() {
        if (mTransport == AccessNetworkConstants.TRANSPORT_TYPE_WLAN
                || mCid.get(mTransport) == INVALID_CID) {
            return Collections.emptyMap();
        }
        return mPcoData.get(mCid.get(mTransport));
        return mPcoData.getOrDefault(mCid.get(mTransport), Collections.emptyMap());
    }

    /**
+14 −0
Original line number Diff line number Diff line
@@ -2515,6 +2515,20 @@ public class DataNetworkControllerTest extends TelephonyTest {
        verify(mMockedDataNetworkControllerCallback).onNrAdvancedCapableByPcoChanged(eq(true));
    }

    @Test
    public void testNrAdvancedByPcoMultipleNetworks() throws Exception {
        testSetupDataNetwork();
        setSuccessfulSetupDataResponse(mMockedDataServiceManagers
                .get(AccessNetworkConstants.TRANSPORT_TYPE_WWAN), 2);
        testSetupImsDataNetwork();

        verify(mMockedDataNetworkControllerCallback, never())
                .onNrAdvancedCapableByPcoChanged(anyBoolean());
        mSimulatedCommands.triggerPcoData(2, "IPV6", 1234, new byte[]{1});
        processAllMessages();
        verify(mMockedDataNetworkControllerCallback).onNrAdvancedCapableByPcoChanged(eq(true));
    }

    @Test
    public void testNrAdvancedByEarlyUnrelatedPco() {
        Mockito.reset(mMockedWwanDataServiceManager);