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

Commit 20584377 authored by Ling Ma's avatar Ling Ma
Browse files

Consider MMS as mutable cap

Previously, to accomodate wlan specifc APN, telephony dynamically add and remove MMS cap from the default network depending on QNS's preference.
However, since APN capabilities are considered immutable by connectivity, every dynamic change triggers an internet validation, which drains bettery power.
Terefore, in this change, telephony no longer recreate network agent, thus connectivity would no longer perform internet validation.
The consequence of this change is that connectivity won't perform network re-assign for the apps who already knows the old network, but it's fine because MMS requests are short-lived and only MMS service make such request.

Fix: 347018492
Test: daily check b/347018492#comment33
Test: send MMS w/ TMO using WLAN and cellular, reviewed log
Test: atest datanetworktest.java
Flag: NONE associated with a nextfood rolled out flag, time not allowed to rollout with another separate flag to deliver along with the original fix
Change-Id: I498d4195434d06c6c28f925ba76a1df6a6c218f4
parent 63adce85
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -460,7 +460,10 @@ public class DataNetwork extends StateMachine {
            // Dynamically add and remove MMTEL capability when network transition between VoPS
            // Dynamically add and remove MMTEL capability when network transition between VoPS
            // and non-VoPS network if the request is not MMTEL. For MMTEL, we retain the capability
            // and non-VoPS network if the request is not MMTEL. For MMTEL, we retain the capability
            // to prevent immediate tear down.
            // to prevent immediate tear down.
            NetworkCapabilities.NET_CAPABILITY_MMTEL
            NetworkCapabilities.NET_CAPABILITY_MMTEL,
            // Dynamically add and remove MMS capability depending on QNS's preference if there is
            // a transport specific APN alternative.
            NetworkCapabilities.NET_CAPABILITY_MMS
    );
    );


    /** The parent state. Any messages not handled by the child state fallback to this. */
    /** The parent state. Any messages not handled by the child state fallback to this. */
+8 −2
Original line number Original line Diff line number Diff line
@@ -2421,6 +2421,10 @@ public class DataNetworkTest extends TelephonyTest {
        doReturn(true).when(mFeatureFlags).forceIwlanMms();
        doReturn(true).when(mFeatureFlags).forceIwlanMms();
        setupDataNetwork();
        setupDataNetwork();


        TelephonyNetworkAgent mockNetworkAgent = Mockito.mock(TelephonyNetworkAgent.class);
        replaceInstance(DataNetwork.class, "mNetworkAgent",
                mDataNetworkUT, mockNetworkAgent);

        assertThat(mDataNetworkUT.getNetworkCapabilities()
        assertThat(mDataNetworkUT.getNetworkCapabilities()
                .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)).isTrue();
                .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)).isTrue();


@@ -2465,11 +2469,13 @@ public class DataNetworkTest extends TelephonyTest {
                .onPreferredTransportChanged(NetworkCapabilities.NET_CAPABILITY_MMS, false);
                .onPreferredTransportChanged(NetworkCapabilities.NET_CAPABILITY_MMS, false);
        processAllMessages();
        processAllMessages();


        // Check if MMS capability is removed.
        // Check if MMS capability is removed, and we don't recreat network agent which triggers
        // powering comsuming internet validation.
        assertThat(mDataNetworkUT.getNetworkCapabilities()
        assertThat(mDataNetworkUT.getNetworkCapabilities()
                .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)).isFalse();
                .hasCapability(NetworkCapabilities.NET_CAPABILITY_MMS)).isFalse();
        verify(mockNetworkAgent, never()).abandon();


        // Now QNS prefers MMS on IWLAN
        // Now QNS prefers MMS on WWAN
        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WWAN).when(mAccessNetworksManager)
        doReturn(AccessNetworkConstants.TRANSPORT_TYPE_WWAN).when(mAccessNetworksManager)
            .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
            .getPreferredTransportByNetworkCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
        accessNetworksManagerCallbackArgumentCaptor.getValue()
        accessNetworksManagerCallbackArgumentCaptor.getValue()