Loading core/java/android/net/INetworkStatsSession.aidl +11 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,17 @@ interface INetworkStatsSession { @UnsupportedAppUsage NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields); /** Return network layer usage summary per UID for traffic that matches template. */ /** * Return network layer usage summary per UID for traffic that matches template. * * <p>The resulting {@code NetworkStats#getElapsedRealtime()} contains time delta between * {@code start} and {@code end}. * * @param template - a predicate to filter netstats. * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param includeTags - includes data usage tags if true. */ @UnsupportedAppUsage NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags); /** Return historical network layer stats for specific UID traffic that matches template. */ Loading core/java/android/net/NetworkStats.java +3 −1 Original line number Diff line number Diff line Loading @@ -220,8 +220,10 @@ public final class NetworkStats implements Parcelable { // TODO: move fields to "mVariable" notation /** * {@link SystemClock#elapsedRealtime()} timestamp when this data was * {@link SystemClock#elapsedRealtime()} timestamp in milliseconds when this data was * generated. * It's a timestamps delta when {@link #subtract()}, * {@code INetworkStatsSession#getSummaryForAllUid()} methods are used. */ private long elapsedRealtime; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) Loading core/java/android/net/NetworkStatsHistory.java +12 −0 Original line number Diff line number Diff line Loading @@ -526,6 +526,13 @@ public class NetworkStatsHistory implements Parcelable { /** * Return interpolated data usage across the requested range. Interpolates * across buckets, so values may be rounded slightly. * * <p>If the active bucket is not completed yet, it returns the proportional value of it * based on its duration and the {@code end} param. * * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param recycle - entry instance for performance, could be null. */ @UnsupportedAppUsage public Entry getValues(long start, long end, Entry recycle) { Loading @@ -535,6 +542,11 @@ public class NetworkStatsHistory implements Parcelable { /** * Return interpolated data usage across the requested range. Interpolates * across buckets, so values may be rounded slightly. * * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param now - current timestamp in milliseconds since the epoch (wall clock). * @param recycle - entry instance for performance, could be null. */ @UnsupportedAppUsage public Entry getValues(long start, long end, long now, Entry recycle) { Loading services/core/java/com/android/server/net/NetworkStatsCollection.java +9 −4 Original line number Diff line number Diff line Loading @@ -59,16 +59,15 @@ import com.android.internal.util.FastDataOutput; import com.android.internal.util.FileRotator; import com.android.internal.util.IndentingPrintWriter; import libcore.io.IoUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; import libcore.io.IoUtils; import java.io.BufferedInputStream; import java.io.DataInput; import java.io.DataInputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; Loading Loading @@ -335,7 +334,13 @@ public class NetworkStatsCollection implements FileRotator.Reader, FileRotator.W /** * Summarize all {@link NetworkStatsHistory} in this collection which match * the requested parameters. * the requested parameters across the requested range. * * @param template - a predicate for filtering netstats. * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param accessLevel - caller access level. * @param callerUid - caller UID. */ public NetworkStats getSummary(NetworkTemplate template, long start, long end, @NetworkStatsAccess.Level int accessLevel, int callerUid) { Loading Loading
core/java/android/net/INetworkStatsSession.aidl +11 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,17 @@ interface INetworkStatsSession { @UnsupportedAppUsage NetworkStatsHistory getHistoryForNetwork(in NetworkTemplate template, int fields); /** Return network layer usage summary per UID for traffic that matches template. */ /** * Return network layer usage summary per UID for traffic that matches template. * * <p>The resulting {@code NetworkStats#getElapsedRealtime()} contains time delta between * {@code start} and {@code end}. * * @param template - a predicate to filter netstats. * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param includeTags - includes data usage tags if true. */ @UnsupportedAppUsage NetworkStats getSummaryForAllUid(in NetworkTemplate template, long start, long end, boolean includeTags); /** Return historical network layer stats for specific UID traffic that matches template. */ Loading
core/java/android/net/NetworkStats.java +3 −1 Original line number Diff line number Diff line Loading @@ -220,8 +220,10 @@ public final class NetworkStats implements Parcelable { // TODO: move fields to "mVariable" notation /** * {@link SystemClock#elapsedRealtime()} timestamp when this data was * {@link SystemClock#elapsedRealtime()} timestamp in milliseconds when this data was * generated. * It's a timestamps delta when {@link #subtract()}, * {@code INetworkStatsSession#getSummaryForAllUid()} methods are used. */ private long elapsedRealtime; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) Loading
core/java/android/net/NetworkStatsHistory.java +12 −0 Original line number Diff line number Diff line Loading @@ -526,6 +526,13 @@ public class NetworkStatsHistory implements Parcelable { /** * Return interpolated data usage across the requested range. Interpolates * across buckets, so values may be rounded slightly. * * <p>If the active bucket is not completed yet, it returns the proportional value of it * based on its duration and the {@code end} param. * * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param recycle - entry instance for performance, could be null. */ @UnsupportedAppUsage public Entry getValues(long start, long end, Entry recycle) { Loading @@ -535,6 +542,11 @@ public class NetworkStatsHistory implements Parcelable { /** * Return interpolated data usage across the requested range. Interpolates * across buckets, so values may be rounded slightly. * * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param now - current timestamp in milliseconds since the epoch (wall clock). * @param recycle - entry instance for performance, could be null. */ @UnsupportedAppUsage public Entry getValues(long start, long end, long now, Entry recycle) { Loading
services/core/java/com/android/server/net/NetworkStatsCollection.java +9 −4 Original line number Diff line number Diff line Loading @@ -59,16 +59,15 @@ import com.android.internal.util.FastDataOutput; import com.android.internal.util.FileRotator; import com.android.internal.util.IndentingPrintWriter; import libcore.io.IoUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; import libcore.io.IoUtils; import java.io.BufferedInputStream; import java.io.DataInput; import java.io.DataInputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; Loading Loading @@ -335,7 +334,13 @@ public class NetworkStatsCollection implements FileRotator.Reader, FileRotator.W /** * Summarize all {@link NetworkStatsHistory} in this collection which match * the requested parameters. * the requested parameters across the requested range. * * @param template - a predicate for filtering netstats. * @param start - start of the range, timestamp in milliseconds since the epoch. * @param end - end of the range, timestamp in milliseconds since the epoch. * @param accessLevel - caller access level. * @param callerUid - caller UID. */ public NetworkStats getSummary(NetworkTemplate template, long start, long end, @NetworkStatsAccess.Level int accessLevel, int callerUid) { Loading