Merge "[SM17] Remove ratType field in MobileBytesTransfer(ByFgBg)" into rvc-dev am: 73d7775f76

Change-Id: I73a991bc0e206b98d46dbb6b4aa4e58c39317317
This commit is contained in:
Junyu Lai
2020-05-05 03:30:28 +00:00
committed by Automerger Merge Worker
2 changed files with 16 additions and 29 deletions

View File

@@ -4886,8 +4886,6 @@ message MobileBytesTransfer {
optional int64 tx_bytes = 4; optional int64 tx_bytes = 4;
optional int64 tx_packets = 5; optional int64 tx_packets = 5;
optional int32 rat_type = 6;
} }
/** /**
@@ -4910,8 +4908,6 @@ message MobileBytesTransferByFgBg {
optional int64 tx_bytes = 5; optional int64 tx_bytes = 5;
optional int64 tx_packets = 6; optional int64 tx_packets = 6;
optional int32 rat_type = 7;
} }
/** /**

View File

@@ -21,7 +21,7 @@ import static android.app.AppOpsManager.OP_FLAG_TRUSTED_PROXY;
import static android.app.usage.NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN; import static android.app.usage.NetworkStatsManager.FLAG_AUGMENT_WITH_SUBSCRIPTION_PLAN;
import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED; import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED;
import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS; import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
import static android.net.NetworkTemplate.getAllCollapsedRatTypes; import static android.net.NetworkTemplate.NETWORK_TYPE_ALL;
import static android.os.Debug.getIonHeapsSizeKb; import static android.os.Debug.getIonHeapsSizeKb;
import static android.os.Process.getUidForPid; import static android.os.Process.getUidForPid;
import static android.os.storage.VolumeInfo.TYPE_PRIVATE; import static android.os.storage.VolumeInfo.TYPE_PRIVATE;
@@ -726,27 +726,25 @@ public class StatsPullAtomService extends SystemService {
int atomTag, @NonNull List<StatsEvent> pulledData, boolean withFgbg) { int atomTag, @NonNull List<StatsEvent> pulledData, boolean withFgbg) {
final NetworkTemplate template = NetworkTemplate.buildTemplateWifiWildcard(); final NetworkTemplate template = NetworkTemplate.buildTemplateWifiWildcard();
final NetworkStats stats = getUidNetworkStatsSinceBoot(template, withFgbg); final NetworkStats stats = getUidNetworkStatsSinceBoot(template, withFgbg);
if (stats != null) {
addNetworkStats(atomTag, pulledData, stats, withFgbg, 0 /* ratType */); // Return with PULL_SKIP to indicate there is an error.
return StatsManager.PULL_SUCCESS; if (stats == null) return StatsManager.PULL_SKIP;
}
return StatsManager.PULL_SKIP; addNetworkStats(atomTag, pulledData, stats, withFgbg, 0 /* ratType */);
return StatsManager.PULL_SUCCESS;
} }
private int pullMobileBytesTransfer( private int pullMobileBytesTransfer(
int atomTag, @NonNull List<StatsEvent> pulledData, boolean withFgbg) { int atomTag, @NonNull List<StatsEvent> pulledData, boolean withFgbg) {
int ret = StatsManager.PULL_SKIP; final NetworkTemplate template =
for (final int ratType : getAllCollapsedRatTypes()) { NetworkTemplate.buildTemplateMobileWithRatType(null, NETWORK_TYPE_ALL);
final NetworkTemplate template = final NetworkStats stats = getUidNetworkStatsSinceBoot(template, withFgbg);
NetworkTemplate.buildTemplateMobileWithRatType(null, ratType);
final NetworkStats stats = getUidNetworkStatsSinceBoot(template, withFgbg); // Return with PULL_SKIP to indicate there is an error.
if (stats != null) { if (stats == null) return StatsManager.PULL_SKIP;
addNetworkStats(atomTag, pulledData, stats, withFgbg, ratType);
ret = StatsManager.PULL_SUCCESS; // If any of them is not null, then success. addNetworkStats(atomTag, pulledData, stats, withFgbg, NETWORK_TYPE_ALL);
} return StatsManager.PULL_SUCCESS;
}
// If there is no data return PULL_SKIP to avoid wasting performance adding empty stats.
return ret;
} }
private void addNetworkStats(int atomTag, @NonNull List<StatsEvent> ret, private void addNetworkStats(int atomTag, @NonNull List<StatsEvent> ret,
@@ -766,13 +764,6 @@ public class StatsPullAtomService extends SystemService {
e.writeLong(entry.rxPackets); e.writeLong(entry.rxPackets);
e.writeLong(entry.txBytes); e.writeLong(entry.txBytes);
e.writeLong(entry.txPackets); e.writeLong(entry.txPackets);
switch (atomTag) {
case FrameworkStatsLog.MOBILE_BYTES_TRANSFER:
case FrameworkStatsLog.MOBILE_BYTES_TRANSFER_BY_FG_BG:
e.writeInt(ratType);
break;
default:
}
ret.add(e.build()); ret.add(e.build());
} }
} }