Merge "Fix network usage stats on 464xlat tethered." am: 83088dcd8e

am: aa20932ff1

Change-Id: I016722f3a0ae2ae0a1d48bfacc4fe07ee3578ef7
This commit is contained in:
Remi NGUYEN VAN
2018-03-29 07:46:34 +00:00
committed by android-build-merger
3 changed files with 92 additions and 51 deletions

View File

@@ -148,7 +148,6 @@ import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/**
* Collect and persist detailed network statistics, and provide this data to
@@ -768,7 +767,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
public NetworkStats getDetailedUidStats(String[] requiredIfaces) {
try {
final String[] ifacesToQuery =
NetworkStatsFactory.augmentWithStackedInterfacesLocked(requiredIfaces);
NetworkStatsFactory.augmentWithStackedInterfaces(requiredIfaces);
return getNetworkStatsUidDetail(ifacesToQuery);
} catch (RemoteException e) {
Log.wtf(TAG, "Error compiling UID stats", e);
@@ -1526,12 +1525,14 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
private NetworkStats getNetworkStatsUidDetail(String[] ifaces)
throws RemoteException {
// TODO: remove 464xlat adjustments from NetworkStatsFactory and apply all at once here.
final NetworkStats uidSnapshot = mNetworkManager.getNetworkStatsUidDetail(UID_ALL,
ifaces);
// fold tethering stats and operations into uid snapshot
final NetworkStats tetherSnapshot = getNetworkStatsTethering(STATS_PER_UID);
tetherSnapshot.filter(UID_ALL, ifaces, TAG_ALL);
NetworkStatsFactory.apply464xlatAdjustments(uidSnapshot, tetherSnapshot);
uidSnapshot.combineAllValues(tetherSnapshot);
final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
@@ -1541,13 +1542,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
final NetworkStats vtStats = telephonyManager.getVtDataUsage(STATS_PER_UID);
if (vtStats != null) {
vtStats.filter(UID_ALL, ifaces, TAG_ALL);
NetworkStatsFactory.apply464xlatAdjustments(uidSnapshot, vtStats);
uidSnapshot.combineAllValues(vtStats);
}
uidSnapshot.combineAllValues(mUidOperations);
// TODO: apply tethering & VC 464xlat adjustments here
return uidSnapshot;
}