Snap for 6056566 from fd2fd2a8d0b0af30937a3acd1c6898b388d9d381 to rvc-release
Change-Id: If2936934c5981553a07f622381a9cc75351b380b
This commit is contained in:
@@ -114,7 +114,7 @@ public class NetworkIdentity implements Comparable<NetworkIdentity> {
|
||||
return builder.append("}").toString();
|
||||
}
|
||||
|
||||
public void writeToProto(ProtoOutputStream proto, long tag) {
|
||||
public void dumpDebug(ProtoOutputStream proto, long tag) {
|
||||
final long start = proto.start(tag);
|
||||
|
||||
proto.write(NetworkIdentityProto.TYPE, mType);
|
||||
|
||||
@@ -684,7 +684,7 @@ public class NetworkStatsHistory implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToProto(ProtoOutputStream proto, long tag) {
|
||||
public void dumpDebug(ProtoOutputStream proto, long tag) {
|
||||
final long start = proto.start(tag);
|
||||
|
||||
proto.write(NetworkStatsHistoryProto.BUCKET_DURATION_MS, bucketDuration);
|
||||
@@ -693,11 +693,11 @@ public class NetworkStatsHistory implements Parcelable {
|
||||
final long startBucket = proto.start(NetworkStatsHistoryProto.BUCKETS);
|
||||
|
||||
proto.write(NetworkStatsHistoryBucketProto.BUCKET_START_MS, bucketStart[i]);
|
||||
writeToProto(proto, NetworkStatsHistoryBucketProto.RX_BYTES, rxBytes, i);
|
||||
writeToProto(proto, NetworkStatsHistoryBucketProto.RX_PACKETS, rxPackets, i);
|
||||
writeToProto(proto, NetworkStatsHistoryBucketProto.TX_BYTES, txBytes, i);
|
||||
writeToProto(proto, NetworkStatsHistoryBucketProto.TX_PACKETS, txPackets, i);
|
||||
writeToProto(proto, NetworkStatsHistoryBucketProto.OPERATIONS, operations, i);
|
||||
dumpDebug(proto, NetworkStatsHistoryBucketProto.RX_BYTES, rxBytes, i);
|
||||
dumpDebug(proto, NetworkStatsHistoryBucketProto.RX_PACKETS, rxPackets, i);
|
||||
dumpDebug(proto, NetworkStatsHistoryBucketProto.TX_BYTES, txBytes, i);
|
||||
dumpDebug(proto, NetworkStatsHistoryBucketProto.TX_PACKETS, txPackets, i);
|
||||
dumpDebug(proto, NetworkStatsHistoryBucketProto.OPERATIONS, operations, i);
|
||||
|
||||
proto.end(startBucket);
|
||||
}
|
||||
@@ -705,7 +705,7 @@ public class NetworkStatsHistory implements Parcelable {
|
||||
proto.end(start);
|
||||
}
|
||||
|
||||
private static void writeToProto(ProtoOutputStream proto, long tag, long[] array, int index) {
|
||||
private static void dumpDebug(ProtoOutputStream proto, long tag, long[] array, int index) {
|
||||
if (array != null) {
|
||||
proto.write(tag, array[index]);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
@@ -595,8 +596,15 @@ public class TrafficStats {
|
||||
return total;
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public static long getTxPackets(String iface) {
|
||||
/**
|
||||
* Return the number of packets transmitted on the specified interface since
|
||||
* device boot. Statistics are measured at the network layer, so both TCP and
|
||||
* UDP usage are included.
|
||||
*
|
||||
* @param iface The name of the interface.
|
||||
* @return The number of transmitted packets.
|
||||
*/
|
||||
public static long getTxPackets(@NonNull String iface) {
|
||||
try {
|
||||
return getStatsService().getIfaceStats(iface, TYPE_TX_PACKETS);
|
||||
} catch (RemoteException e) {
|
||||
@@ -604,8 +612,15 @@ public class TrafficStats {
|
||||
}
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public static long getRxPackets(String iface) {
|
||||
/**
|
||||
* Return the number of packets received on the specified interface since
|
||||
* device boot. Statistics are measured at the network layer, so both TCP
|
||||
* and UDP usage are included.
|
||||
*
|
||||
* @param iface The name of the interface.
|
||||
* @return The number of received packets.
|
||||
*/
|
||||
public static long getRxPackets(@NonNull String iface) {
|
||||
try {
|
||||
return getStatsService().getIfaceStats(iface, TYPE_RX_PACKETS);
|
||||
} catch (RemoteException e) {
|
||||
|
||||
@@ -170,11 +170,11 @@ public class NetworkIdentitySet extends HashSet<NetworkIdentity> implements
|
||||
return ident.compareTo(anotherIdent);
|
||||
}
|
||||
|
||||
public void writeToProto(ProtoOutputStream proto, long tag) {
|
||||
public void dumpDebug(ProtoOutputStream proto, long tag) {
|
||||
final long start = proto.start(tag);
|
||||
|
||||
for (NetworkIdentity ident : this) {
|
||||
ident.writeToProto(proto, NetworkIdentitySetProto.IDENTITIES);
|
||||
ident.dumpDebug(proto, NetworkIdentitySetProto.IDENTITIES);
|
||||
}
|
||||
|
||||
proto.end(start);
|
||||
|
||||
@@ -687,7 +687,7 @@ public class NetworkStatsCollection implements FileRotator.Reader {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToProto(ProtoOutputStream proto, long tag) {
|
||||
public void dumpDebug(ProtoOutputStream proto, long tag) {
|
||||
final long start = proto.start(tag);
|
||||
|
||||
for (Key key : getSortedKeys()) {
|
||||
@@ -695,7 +695,7 @@ public class NetworkStatsCollection implements FileRotator.Reader {
|
||||
|
||||
// Key
|
||||
final long startKey = proto.start(NetworkStatsCollectionStatsProto.KEY);
|
||||
key.ident.writeToProto(proto, NetworkStatsCollectionKeyProto.IDENTITY);
|
||||
key.ident.dumpDebug(proto, NetworkStatsCollectionKeyProto.IDENTITY);
|
||||
proto.write(NetworkStatsCollectionKeyProto.UID, key.uid);
|
||||
proto.write(NetworkStatsCollectionKeyProto.SET, key.set);
|
||||
proto.write(NetworkStatsCollectionKeyProto.TAG, key.tag);
|
||||
@@ -703,7 +703,7 @@ public class NetworkStatsCollection implements FileRotator.Reader {
|
||||
|
||||
// Value
|
||||
final NetworkStatsHistory history = mStats.get(key);
|
||||
history.writeToProto(proto, NetworkStatsCollectionStatsProto.HISTORY);
|
||||
history.dumpDebug(proto, NetworkStatsCollectionStatsProto.HISTORY);
|
||||
proto.end(startStats);
|
||||
}
|
||||
|
||||
|
||||
@@ -470,12 +470,12 @@ public class NetworkStatsRecorder {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToProtoLocked(ProtoOutputStream proto, long tag) {
|
||||
public void dumpDebugLocked(ProtoOutputStream proto, long tag) {
|
||||
final long start = proto.start(tag);
|
||||
if (mPending != null) {
|
||||
proto.write(NetworkStatsRecorderProto.PENDING_TOTAL_BYTES, mPending.getTotalBytes());
|
||||
}
|
||||
getOrLoadCompleteLocked().writeToProto(proto, NetworkStatsRecorderProto.COMPLETE_HISTORY);
|
||||
getOrLoadCompleteLocked().dumpDebug(proto, NetworkStatsRecorderProto.COMPLETE_HISTORY);
|
||||
proto.end(start);
|
||||
}
|
||||
|
||||
|
||||
@@ -1609,10 +1609,10 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
|
||||
dumpInterfaces(proto, NetworkStatsServiceDumpProto.ACTIVE_INTERFACES, mActiveIfaces);
|
||||
dumpInterfaces(proto, NetworkStatsServiceDumpProto.ACTIVE_UID_INTERFACES, mActiveUidIfaces);
|
||||
mDevRecorder.writeToProtoLocked(proto, NetworkStatsServiceDumpProto.DEV_STATS);
|
||||
mXtRecorder.writeToProtoLocked(proto, NetworkStatsServiceDumpProto.XT_STATS);
|
||||
mUidRecorder.writeToProtoLocked(proto, NetworkStatsServiceDumpProto.UID_STATS);
|
||||
mUidTagRecorder.writeToProtoLocked(proto, NetworkStatsServiceDumpProto.UID_TAG_STATS);
|
||||
mDevRecorder.dumpDebugLocked(proto, NetworkStatsServiceDumpProto.DEV_STATS);
|
||||
mXtRecorder.dumpDebugLocked(proto, NetworkStatsServiceDumpProto.XT_STATS);
|
||||
mUidRecorder.dumpDebugLocked(proto, NetworkStatsServiceDumpProto.UID_STATS);
|
||||
mUidTagRecorder.dumpDebugLocked(proto, NetworkStatsServiceDumpProto.UID_TAG_STATS);
|
||||
|
||||
proto.flush();
|
||||
}
|
||||
@@ -1623,7 +1623,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
final long start = proto.start(tag);
|
||||
|
||||
proto.write(NetworkInterfaceProto.INTERFACE, ifaces.keyAt(i));
|
||||
ifaces.valueAt(i).writeToProto(proto, NetworkInterfaceProto.IDENTITIES);
|
||||
ifaces.valueAt(i).dumpDebug(proto, NetworkInterfaceProto.IDENTITIES);
|
||||
|
||||
proto.end(start);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user