Notify NetworkStats only when interfaces changed in updateLinkProperties
In ConnectivityService, updateLinkProperties calls NetworkStats even though the ip address or interface name has not changed and only the tcp buffer size has changed. This is noisy and could be problematic when RAT change occurs frequently, since when RAT changes tcp buffer size configuration also changes. This CL also fixes a wrong nullability annotation where the oldLp of updateLinkProperties could be null when updateNetworkInfo is called. Test: atest ConnectivityServiceTest#testStatsIfacesChanged Fix: 232048480 Change-Id: Ic226eb4a8aa1f38cba293510813f1cb55f0ea658
This commit is contained in:
@@ -7109,6 +7109,15 @@ public class ConnectivityServiceTest {
|
||||
expectNotifyNetworkStatus(onlyCell, MOBILE_IFNAME);
|
||||
reset(mStatsManager);
|
||||
|
||||
// Verify change fields other than interfaces does not trigger a notification to NSS.
|
||||
cellLp.addLinkAddress(new LinkAddress("192.0.2.4/24"));
|
||||
cellLp.addRoute(new RouteInfo((IpPrefix) null, InetAddress.getByName("192.0.2.4"),
|
||||
MOBILE_IFNAME));
|
||||
cellLp.setDnsServers(List.of(InetAddress.getAllByName("8.8.8.8")));
|
||||
mCellNetworkAgent.sendLinkProperties(cellLp);
|
||||
verifyNoMoreInteractions(mStatsManager);
|
||||
reset(mStatsManager);
|
||||
|
||||
// Default network switch should update ifaces.
|
||||
mWiFiNetworkAgent.connect(false);
|
||||
mWiFiNetworkAgent.sendLinkProperties(wifiLp);
|
||||
|
||||
Reference in New Issue
Block a user