Make TrafficStats uid attribution @SystemApi
Anything that runs as a singleton may need to attribute traffic to various client apps; in particular, backup transports need to do this. Apropos of which, introduce a @SystemApi method specifically for that purpose, setThreadStatsTagBackup(). Bug 16661321 Change-Id: Id5d22e28bdc68edb53f2a1fdba80b144fcbc61d2
This commit is contained in:
committed by
Christopher Tate
parent
fba15596cb
commit
5a1878d6ca
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
|
import android.annotation.SystemApi;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
import android.app.backup.BackupManager;
|
import android.app.backup.BackupManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -126,6 +127,16 @@ public class TrafficStats {
|
|||||||
NetworkManagementSocketTagger.setThreadSocketStatsTag(tag);
|
NetworkManagementSocketTagger.setThreadSocketStatsTag(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System API for backup-related support components to tag network traffic
|
||||||
|
* appropriately.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi
|
||||||
|
public static void setThreadStatsTagBackup() {
|
||||||
|
setThreadStatsTag(TAG_SYSTEM_BACKUP);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@@ -160,11 +171,13 @@ public class TrafficStats {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
public static void setThreadStatsUid(int uid) {
|
public static void setThreadStatsUid(int uid) {
|
||||||
NetworkManagementSocketTagger.setThreadSocketStatsUid(uid);
|
NetworkManagementSocketTagger.setThreadSocketStatsUid(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
@SystemApi
|
||||||
public static void clearThreadStatsUid() {
|
public static void clearThreadStatsUid() {
|
||||||
NetworkManagementSocketTagger.setThreadSocketStatsUid(-1);
|
NetworkManagementSocketTagger.setThreadSocketStatsUid(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user