Watch network subtype, tethering teardown, empty.
Watch for changes to telephony network subtype, and update iface mapping to persist stats under correct type. Update network stats before removing tethering NAT rules. Skip recording that would create empty historical buckets. Query UID stats before iface stats to always skew positive when counters are actively rolling forward. Bug: 5360042, 5359860, 5335674, 5334448 Change-Id: I8aa37b568e8ffb70647218aa1aff5195d3e44d5a
This commit is contained in:
@@ -35,6 +35,7 @@ import android.net.EthernetDataTracker;
|
||||
import android.net.IConnectivityManager;
|
||||
import android.net.INetworkPolicyListener;
|
||||
import android.net.INetworkPolicyManager;
|
||||
import android.net.INetworkStatsService;
|
||||
import android.net.LinkAddress;
|
||||
import android.net.LinkProperties;
|
||||
import android.net.LinkProperties.CompareResult;
|
||||
@@ -306,8 +307,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
// the set of network types that can only be enabled by system/sig apps
|
||||
List mProtectedNetworks;
|
||||
|
||||
public ConnectivityService(
|
||||
Context context, INetworkManagementService netd, INetworkPolicyManager policyManager) {
|
||||
public ConnectivityService(Context context, INetworkManagementService netd,
|
||||
INetworkStatsService statsService, INetworkPolicyManager policyManager) {
|
||||
if (DBG) log("ConnectivityService starting up");
|
||||
|
||||
HandlerThread handlerThread = new HandlerThread("ConnectivityServiceThread");
|
||||
@@ -496,7 +497,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
|
||||
INetworkManagementService nmService = INetworkManagementService.Stub.asInterface(b);
|
||||
|
||||
mTethering = new Tethering(mContext, nmService, mHandler.getLooper());
|
||||
mTethering = new Tethering(mContext, nmService, statsService, mHandler.getLooper());
|
||||
mTetheringConfigValid = ((mTethering.getTetherableUsbRegexs().length != 0 ||
|
||||
mTethering.getTetherableWifiRegexs().length != 0 ||
|
||||
mTethering.getTetherableBluetoothRegexs().length != 0) &&
|
||||
|
||||
@@ -776,6 +776,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
|
||||
private void expectNetworkStatsPoll() throws Exception {
|
||||
mNetManager.setGlobalAlert(anyLong());
|
||||
expectLastCall().anyTimes();
|
||||
expect(mConnManager.getTetheredIfacePairs()).andReturn(null).anyTimes();
|
||||
}
|
||||
|
||||
private void assertStatsFilesExist(boolean exist) {
|
||||
|
||||
Reference in New Issue
Block a user