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

Commit e7ef0a61 authored by Chalard Jean's avatar Chalard Jean Committed by Android (Google) Code Review
Browse files

Merge "Move TrafficStats tags for the network stack constants" into qt-dev

parents 3a7a3391 6a76b7e2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -920,6 +920,7 @@ filegroup {
        "core/java/com/android/internal/util/RingBufferIndices.java",
        "core/java/com/android/internal/util/State.java",
        "core/java/com/android/internal/util/StateMachine.java",
        "core/java/com/android/internal/util/TrafficStatsConstants.java",
        "core/java/com/android/internal/util/WakeupMessage.java",
        "core/java/android/net/shared/*.java",
    ]
+6 −3
Original line number Diff line number Diff line
@@ -4225,9 +4225,12 @@ package android.net {
    method public static void setThreadStatsTagApp();
    method public static void setThreadStatsTagBackup();
    method public static void setThreadStatsTagRestore();
    field public static final int TAG_SYSTEM_DHCP = -192; // 0xffffff40
    field public static final int TAG_SYSTEM_DHCP_SERVER = -186; // 0xffffff46
    field public static final int TAG_SYSTEM_PROBE = -190; // 0xffffff42
    field public static final int TAG_NETWORK_STACK_IMPERSONATION_RANGE_END = -113; // 0xffffff8f
    field public static final int TAG_NETWORK_STACK_IMPERSONATION_RANGE_START = -128; // 0xffffff80
    field public static final int TAG_NETWORK_STACK_RANGE_END = -257; // 0xfffffeff
    field public static final int TAG_NETWORK_STACK_RANGE_START = -768; // 0xfffffd00
    field public static final int TAG_SYSTEM_IMPERSONATION_RANGE_END = -241; // 0xffffff0f
    field public static final int TAG_SYSTEM_IMPERSONATION_RANGE_START = -256; // 0xffffff00
  }
  public abstract class Uri implements java.lang.Comparable<android.net.Uri> android.os.Parcelable {
+0 −3
Original line number Diff line number Diff line
@@ -1459,9 +1459,6 @@ package android.net {
    method public static long getLoopbackRxPackets();
    method public static long getLoopbackTxBytes();
    method public static long getLoopbackTxPackets();
    field public static final int TAG_SYSTEM_DHCP = -192; // 0xffffff40
    field public static final int TAG_SYSTEM_DHCP_SERVER = -186; // 0xffffff46
    field public static final int TAG_SYSTEM_PROBE = -190; // 0xffffff42
  }

}
+4 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.annotation.UnsupportedAppUsage;
import android.os.SystemClock;
import android.util.Log;

import com.android.internal.util.TrafficStatsConstants;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
@@ -99,7 +101,8 @@ public class SntpClient {

    public boolean requestTime(InetAddress address, int port, int timeout, Network network) {
        DatagramSocket socket = null;
        final int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_NTP);
        final int oldTag = TrafficStats.getAndSetThreadStatsTag(
                TrafficStatsConstants.TAG_SYSTEM_NTP);
        try {
            socket = new DatagramSocket();
            network.bindSocket(socket);
+37 −18
Original line number Diff line number Diff line
@@ -89,6 +89,42 @@ public class TrafficStats {
     */
    public static final int UID_TETHERING = -5;

    /**
     * Tag values in this range are reserved for the network stack. The network stack is
     * running as UID {@link android.os.Process.NETWORK_STACK_UID} when in the mainline
     * module separate process, and as the system UID otherwise.
     */
    /** @hide */
    @SystemApi
    public static final int TAG_NETWORK_STACK_RANGE_START = 0xFFFFFD00;
    /** @hide */
    @SystemApi
    public static final int TAG_NETWORK_STACK_RANGE_END = 0xFFFFFEFF;

    /**
     * Tags between 0xFFFFFF00 and 0xFFFFFFFF are reserved and used internally by system services
     * like DownloadManager when performing traffic on behalf of an application.
     */
    // Please note there is no enforcement of these constants, so do not rely on them to
    // determine that the caller is a system caller.
    /** @hide */
    @SystemApi
    public static final int TAG_SYSTEM_IMPERSONATION_RANGE_START = 0xFFFFFF00;
    /** @hide */
    @SystemApi
    public static final int TAG_SYSTEM_IMPERSONATION_RANGE_END = 0xFFFFFF0F;

    /**
     * Tag values between these ranges are reserved for the network stack to do traffic
     * on behalf of applications. It is a subrange of the range above.
     */
    /** @hide */
    @SystemApi
    public static final int TAG_NETWORK_STACK_IMPERSONATION_RANGE_START = 0xFFFFFF80;
    /** @hide */
    @SystemApi
    public static final int TAG_NETWORK_STACK_IMPERSONATION_RANGE_END = 0xFFFFFF8F;

    /**
     * Default tag value for {@link DownloadManager} traffic.
     *
@@ -127,26 +163,9 @@ public class TrafficStats {
     */
    public static final int TAG_SYSTEM_APP = 0xFFFFFF05;

    // TODO : remove this constant when Wifi code is updated
    /** @hide */
    @SystemApi
    @TestApi
    public static final int TAG_SYSTEM_DHCP = 0xFFFFFF40;
    /** @hide */
    public static final int TAG_SYSTEM_NTP = 0xFFFFFF41;
    /** @hide */
    @SystemApi
    @TestApi
    public static final int TAG_SYSTEM_PROBE = 0xFFFFFF42;
    /** @hide */
    public static final int TAG_SYSTEM_NEIGHBOR = 0xFFFFFF43;
    /** @hide */
    public static final int TAG_SYSTEM_GPS = 0xFFFFFF44;
    /** @hide */
    public static final int TAG_SYSTEM_PAC = 0xFFFFFF45;
    /** @hide */
    @SystemApi
    @TestApi
    public static final int TAG_SYSTEM_DHCP_SERVER = 0xFFFFFF46;

    private static INetworkStatsService sStatsService;

Loading