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

Commit f033977d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add networkAgent Id to precise data connection" into main

parents db016cde 6977f834
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -17,3 +17,14 @@ flag {
  description: "This flag controls the support of the new MMS error code MMS_ERROR_MMS_DISABLED."
  bug: "305062594"
}

# OWNER=linggm TARGET=24Q4
flag {
  name: "mms_get_apn_from_pdsc"
  namespace: "telephony"
  description: "This flag controls get APN details from PDSC instead of telephony provider."
  bug: "324280016"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
 No newline at end of file
+6 −2
Original line number Diff line number Diff line
@@ -2225,6 +2225,7 @@ public class DataNetwork extends StateMachine {
        // will always be registered with NOT_SUSPENDED capability.
        mNetworkAgent = createNetworkAgent();
        mNetworkAgent.markConnected();
        notifyPreciseDataConnectionState();
        // Because network agent is always created with NOT_SUSPENDED, we need to update
        // the suspended if it's was in suspended state.
        if (mSuspended) {
@@ -3414,6 +3415,7 @@ public class DataNetwork extends StateMachine {
        return new PreciseDataConnectionState.Builder()
                .setTransportType(mTransport)
                .setId(mCid.get(mTransport))
                .setNetworkAgentId(mNetworkAgent.getId())
                .setState(getState())
                .setApnSetting(mDataProfile.getApnSetting())
                .setLinkProperties(mLinkProperties)
@@ -3429,14 +3431,16 @@ public class DataNetwork extends StateMachine {
     * {@link android.telephony.TelephonyCallback.PreciseDataConnectionStateListener}.
     *
     * Note that notify only when {@link DataState} or {@link
     * PreciseDataConnectionState.NetworkValidationStatus} changes.
     * PreciseDataConnectionState.NetworkValidationStatus} or {@link TelephonyNetworkAgent#getId}
     * changes.
     */
    private void notifyPreciseDataConnectionState() {
        PreciseDataConnectionState pdcs = getPreciseDataConnectionState();
        if (mPreciseDataConnectionState == null
                || mPreciseDataConnectionState.getState() != pdcs.getState()
                || mPreciseDataConnectionState.getNetworkValidationStatus()
                        != pdcs.getNetworkValidationStatus()) {
                        != pdcs.getNetworkValidationStatus()
                || mPreciseDataConnectionState.getNetId() != pdcs.getNetId()) {
            mPreciseDataConnectionState = pdcs;
            logv("notifyPreciseDataConnectionState=" + pdcs);
            mPhone.notifyDataConnection(pdcs);
+13 −0
Original line number Diff line number Diff line
@@ -660,6 +660,19 @@ public class DataNetworkTest extends TelephonyTest {
        // The final network should not have NOT_SUSPENDED because the device is OOS.
        assertThat(mDataNetworkUT.getNetworkCapabilities().hasCapability(
                NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED)).isFalse();

        // Verify recreation triggers notifyDataConnection with new network agent Id.
        ArgumentCaptor<PreciseDataConnectionState> pdcsCaptor =
                ArgumentCaptor.forClass(PreciseDataConnectionState.class);

        // 4 times connecting, connected, data state changed, re-create network agent
        verify(mPhone, times(4)).notifyDataConnection(pdcsCaptor.capture());
        List<PreciseDataConnectionState> pdcsList = pdcsCaptor.getAllValues();
        assertThat(pdcsList.get(0).getState()).isEqualTo(TelephonyManager.DATA_CONNECTING);
        assertThat(pdcsList.get(1).getState()).isEqualTo(TelephonyManager.DATA_CONNECTED);
        assertThat(pdcsList.get(2).getState()).isEqualTo(TelephonyManager.DATA_SUSPENDED);
        assertThat(pdcsList.get(3).getNetId())
                .isNotEqualTo(pdcsList.get(2).getNetId());
    }

    @Test