[MS61] Remove NetworkManagementSocketTagger#install dependency

Expose TrafficStats#attachSocketTagger and use it instead.

Test: atest TrafficStatsTest
Bug: 204830222
CTS-Coverage-Bug: 214979748
Change-Id: I1748d349b499053ad08bd62202325fa759ad8da5
This commit is contained in:
Junyu Lai
2022-01-17 17:05:30 +00:00
committed by junyulai
parent 6f39e805a1
commit 8efe3482f3

View File

@@ -16,6 +16,8 @@
package android.net;
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
@@ -213,6 +215,18 @@ public class TrafficStats {
sStatsService = statsManager.getBinder();
}
/**
* Attach the socket tagger implementation to the current process, to
* get notified when a socket's {@link FileDescriptor} is assigned to
* a thread. See {@link SocketTagger#set(SocketTagger)}.
*
* @hide
*/
@SystemApi(client = MODULE_LIBRARIES)
public static void attachSocketTagger() {
NetworkManagementSocketTagger.install();
}
/**
* Set active tag to use when accounting {@link Socket} traffic originating
* from the current thread. Only one active tag per thread is supported.