diff options
| author | Junyu Lai <junyulai@google.com> | 2022-01-17 17:37:19 +0000 |
|---|---|---|
| committer | Remi NGUYEN VAN <reminv@google.com> | 2022-02-07 11:45:17 +0900 |
| commit | 2b01633f812028c99a765d4382dc32f118178db1 (patch) | |
| tree | 4140cd596a34c48cf4e56349085dbe73e26f8a17 /framework-t/src | |
| parent | dd22838d57f63e6cf7896fced0a4009ea08091f9 (diff) | |
[MS62.1] Start NetworkStatsService from the module
NetworkStatsService is going to be moved into Connectivity mainlne
module and it will be not visible to SystemServiceResistry after
migration done. Thus:
1. Register service in NetworkStatsServiceInitialalizer, a separate
initializer is needed because the service needs to be created
before NetworkPolicyManagerService's initialization.
2. Call SystemReady at PHASE_ACTIVITY_MANAGER_READY phase where
it needs to be ready before StatsPullAtomService pulls at
PHASE_THIRD_PARTY_APPS_CAN_START.
3. Register manager in ConnectivityFrameworkInitializerTiramisu
instead of SystemServiceRegistery.
Test: atest FrameworksNetTests CtsNetTestCases NetworkUsageStatsTest
Bug: 204830222
Change-Id: I95020d816ed613ce3480a0720a5b71dcdc7fab72
Diffstat (limited to 'framework-t/src')
| -rw-r--r-- | framework-t/src/android/net/ConnectivityFrameworkInitializerTiramisu.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/framework-t/src/android/net/ConnectivityFrameworkInitializerTiramisu.java b/framework-t/src/android/net/ConnectivityFrameworkInitializerTiramisu.java index 577ac54666..9bffbfb27a 100644 --- a/framework-t/src/android/net/ConnectivityFrameworkInitializerTiramisu.java +++ b/framework-t/src/android/net/ConnectivityFrameworkInitializerTiramisu.java @@ -18,6 +18,7 @@ package android.net; import android.annotation.SystemApi; import android.app.SystemServiceRegistry; +import android.app.usage.NetworkStatsManager; import android.content.Context; import android.net.nsd.INsdManager; import android.net.nsd.NsdManager; @@ -57,5 +58,15 @@ public final class ConnectivityFrameworkInitializerTiramisu { return new IpSecManager(context, service); } ); + + SystemServiceRegistry.registerContextAwareService( + Context.NETWORK_STATS_SERVICE, + NetworkStatsManager.class, + (context, serviceBinder) -> { + INetworkStatsService service = + INetworkStatsService.Stub.asInterface(serviceBinder); + return new NetworkStatsManager(context, service); + } + ); } } |
