Allocate well-known tag for app store updates.
This way an app store can shift blame for update-related network traffic onto the app that is being updated. Using a well-known tag makes it easy for developers to identify that they didn't explicitly request the traffic at runtime, similar to how backup/restore traffic is handled. Bug: 38282350 Test: builds, boots Change-Id: I003dd7c9615d4ab318250f1e44fa5d195ac94d23
This commit is contained in:
@@ -109,25 +109,26 @@ public class TrafficStats {
|
|||||||
*/
|
*/
|
||||||
public static final int TAG_SYSTEM_RESTORE = 0xFFFFFF04;
|
public static final int TAG_SYSTEM_RESTORE = 0xFFFFFF04;
|
||||||
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_DHCP = 0xFFFFFF05;
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_NTP = 0xFFFFFF06;
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_PROBE = 0xFFFFFF07;
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_NEIGHBOR = 0xFFFFFF08;
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_GPS = 0xFFFFFF09;
|
|
||||||
/** @hide */
|
|
||||||
public static final int TAG_SYSTEM_PAC = 0xFFFFFF0A;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sockets that are strictly local on device; never hits network.
|
* Default tag value for code or resources downloaded by an app store on
|
||||||
|
* behalf of the app, such as app updates.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int TAG_SYSTEM_LOCAL = 0xFFFFFFAA;
|
public static final int TAG_SYSTEM_CODE = 0xFFFFFF05;
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public static final int TAG_SYSTEM_DHCP = 0xFFFFFF40;
|
||||||
|
/** @hide */
|
||||||
|
public static final int TAG_SYSTEM_NTP = 0xFFFFFF41;
|
||||||
|
/** @hide */
|
||||||
|
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;
|
||||||
|
|
||||||
private static INetworkStatsService sStatsService;
|
private static INetworkStatsService sStatsService;
|
||||||
|
|
||||||
@@ -209,6 +210,19 @@ public class TrafficStats {
|
|||||||
setThreadStatsTag(TAG_SYSTEM_RESTORE);
|
setThreadStatsTag(TAG_SYSTEM_RESTORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set active tag to use when accounting {@link Socket} traffic originating
|
||||||
|
* from the current thread. The tag used internally is well-defined to
|
||||||
|
* distinguish all code-related traffic, such as updates performed by an app
|
||||||
|
* store.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public static void setThreadStatsTagCode() {
|
||||||
|
setThreadStatsTag(TAG_SYSTEM_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the active tag used when accounting {@link Socket} traffic originating
|
* Get the active tag used when accounting {@link Socket} traffic originating
|
||||||
* from the current thread. Only one active tag per thread is supported.
|
* from the current thread. Only one active tag per thread is supported.
|
||||||
|
|||||||
Reference in New Issue
Block a user