[SP07] Remove reference of NetworkStatsService in IpServer

Currently NetworkStatsService is notified when downstream is
updated. However, it seems unnecessary given that tether stats
is persist since boot, and there is no any upstream change when
downstream is changed.

Test: atest NetworkStatsServiceTest IpServerTest
Bug: 130855321
Change-Id: Ie300bfeb0a04678fcfcf300843b6f859af9df91d
This commit is contained in:
junyulai
2019-12-03 14:34:13 +08:00
committed by markchien
parent 15d8bb03fe
commit 5864a3f0aa
3 changed files with 23 additions and 41 deletions

View File

@@ -26,7 +26,6 @@ import static android.net.util.TetheringMessageBase.BASE_IPSERVER;
import android.net.INetd;
import android.net.INetworkStackStatusCallback;
import android.net.INetworkStatsService;
import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.LinkProperties;
@@ -176,7 +175,6 @@ public class IpServer extends StateMachine {
private final SharedLog mLog;
private final INetd mNetd;
private final INetworkStatsService mStatsService;
private final Callback mCallback;
private final InterfaceController mInterfaceCtrl;
@@ -208,12 +206,10 @@ public class IpServer extends StateMachine {
public IpServer(
String ifaceName, Looper looper, int interfaceType, SharedLog log,
INetd netd, INetworkStatsService statsService, Callback callback,
boolean usingLegacyDhcp, Dependencies deps) {
INetd netd, Callback callback, boolean usingLegacyDhcp, Dependencies deps) {
super(ifaceName, looper);
mLog = log.forSubComponent(ifaceName);
mNetd = netd;
mStatsService = statsService;
mCallback = callback;
mInterfaceCtrl = new InterfaceController(ifaceName, mNetd, mLog);
mIfaceName = ifaceName;
@@ -881,12 +877,6 @@ public class IpServer extends StateMachine {
// Sometimes interfaces are gone before we get
// to remove their rules, which generates errors.
// Just do the best we can.
try {
// About to tear down NAT; gather remaining statistics.
mStatsService.forceUpdate();
} catch (Exception e) {
mLog.e("Exception in forceUpdate: " + e.toString());
}
try {
mNetd.ipfwdRemoveInterfaceForward(mIfaceName, upstreamIface);
} catch (RemoteException | ServiceSpecificException e) {