Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 690e1d05 authored by junyulai's avatar junyulai Committed by Automerger Merge Worker
Browse files

[SP23] Address misc API review comment about NetworkStats am: 90a118d4

Change-Id: I3a4376eaeec34329e32a84d699a481a67e7d6528
parents af679c10 90a118d4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -6416,7 +6416,6 @@ package android.net {
    field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkStats> CREATOR;
    field public static final int DEFAULT_NETWORK_NO = 0; // 0x0
    field public static final int DEFAULT_NETWORK_YES = 1; // 0x1
    field @Nullable public static final String IFACE_ALL;
    field public static final String IFACE_VT = "vt_data0";
    field public static final int METERED_NO = 0; // 0x0
    field public static final int METERED_YES = 1; // 0x1
+41 −4
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.os.Process.CLAT_UID;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
@@ -58,9 +57,12 @@ import java.util.function.Predicate;
public final class NetworkStats implements Parcelable {
    private static final String TAG = "NetworkStats";

    /** {@link #iface} value when interface details unavailable. */
    @SuppressLint("CompileTimeConstant")
    /**
     * {@link #iface} value when interface details unavailable.
     * @hide
     */
    @Nullable public static final String IFACE_ALL = null;

    /**
     * Virtual network interface for video telephony. This is for VT data usage counting
     * purpose.
@@ -248,7 +250,13 @@ public final class NetworkStats implements Parcelable {
    @UnsupportedAppUsage
    private long[] operations;

    /** @hide */
    /**
     * Basic element of network statistics. Contains the number of packets and number of bytes
     * transferred on both directions in a given set of conditions. See
     * {@link Entry#Entry(String, int, int, int, int, int, int, long, long, long, long, long)}.
     *
     * @hide
     */
    @SystemApi
    public static class Entry {
        /** @hide */
@@ -319,6 +327,35 @@ public final class NetworkStats implements Parcelable {
                    rxBytes, rxPackets, txBytes, txPackets, operations);
        }

        /**
         * Construct a {@link Entry} object by giving statistics of packet and byte transferred on
         * both direction, and associated with a set of given conditions.
         *
         * @param iface interface name of this {@link Entry}. Or null if not specified.
         * @param uid uid of this {@link Entry}. {@link #UID_TETHERING} if this {@link Entry} is
         *            for tethering. Or {@link #UID_ALL} if this {@link NetworkStats} is only
         *            counting iface stats.
         * @param set usage state of this {@link Entry}. Should be one of the following
         *            values: {@link #SET_DEFAULT}, {@link #SET_FOREGROUND}.
         * @param tag tag of this {@link Entry}.
         * @param metered metered state of this {@link Entry}. Should be one of the following
         *                values: {link #METERED_YES}, {link #METERED_NO}.
         * @param roaming roaming state of this {@link Entry}. Should be one of the following
         *                values: {link #ROAMING_YES}, {link #ROAMING_NO}.
         * @param defaultNetwork default network status of this {@link Entry}. Should be one
         *                       of the following values: {link #DEFAULT_NETWORK_YES},
         *                       {link #DEFAULT_NETWORK_NO}.
         * @param rxBytes Number of bytes received for this {@link Entry}. Statistics should
         *                represent the contents of IP packets, including IP headers.
         * @param rxPackets Number of packets received for this {@link Entry}. Statistics should
         *                  represent the contents of IP packets, including IP headers.
         * @param txBytes Number of bytes transmitted for this {@link Entry}. Statistics should
         *                represent the contents of IP packets, including IP headers.
         * @param txPackets Number of bytes transmitted for this {@link Entry}. Statistics should
         *                  represent the contents of IP packets, including IP headers.
         * @param operations count of network operations performed for this {@link Entry}. This can
         *                   be used to derive bytes-per-operation.
         */
        public Entry(@Nullable String iface, int uid, @State int set, int tag,
                @Meteredness int metered, @Roaming int roaming, @DefaultNetwork int defaultNetwork,
                long rxBytes, long rxPackets, long txBytes, long txPackets, long operations) {