[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
This commit is contained in:
committed by
Remi NGUYEN VAN
parent
e839e63d21
commit
937076ef12
@@ -54,7 +54,6 @@ import android.hardware.display.DisplayManagerInternal;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.ConnectivityModuleConnector;
|
||||
import android.net.NetworkStackClient;
|
||||
import android.net.TrafficStats;
|
||||
import android.os.BaseBundle;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
@@ -143,7 +142,6 @@ import com.android.server.media.MediaRouterService;
|
||||
import com.android.server.media.metrics.MediaMetricsManagerService;
|
||||
import com.android.server.media.projection.MediaProjectionManagerService;
|
||||
import com.android.server.net.NetworkPolicyManagerService;
|
||||
import com.android.server.net.NetworkStatsService;
|
||||
import com.android.server.net.watchlist.NetworkWatchlistService;
|
||||
import com.android.server.notification.NotificationManagerService;
|
||||
import com.android.server.oemlock.OemLockService;
|
||||
@@ -397,6 +395,8 @@ public final class SystemServer implements Dumpable {
|
||||
"com.android.server.media.MediaResourceMonitorService";
|
||||
private static final String CONNECTIVITY_SERVICE_INITIALIZER_CLASS =
|
||||
"com.android.server.ConnectivityServiceInitializer";
|
||||
private static final String NETWORK_STATS_SERVICE_INITIALIZER_CLASS =
|
||||
"com.android.server.NetworkStatsServiceInitializer";
|
||||
private static final String IP_CONNECTIVITY_METRICS_CLASS =
|
||||
"com.android.server.connectivity.IpConnectivityMetrics";
|
||||
private static final String MEDIA_COMMUNICATION_SERVICE_CLASS =
|
||||
@@ -1395,7 +1395,6 @@ public final class SystemServer implements Dumpable {
|
||||
NetworkManagementService networkManagement = null;
|
||||
VpnManagerService vpnManager = null;
|
||||
VcnManagementService vcnManagement = null;
|
||||
NetworkStatsService networkStats = null;
|
||||
NetworkPolicyManagerService networkPolicy = null;
|
||||
WindowManagerService wm = null;
|
||||
SerialService serial = null;
|
||||
@@ -1917,13 +1916,10 @@ public final class SystemServer implements Dumpable {
|
||||
t.traceEnd();
|
||||
|
||||
t.traceBegin("StartNetworkStatsService");
|
||||
try {
|
||||
networkStats = NetworkStatsService.create(context);
|
||||
ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats);
|
||||
TrafficStats.init(context);
|
||||
} catch (Throwable e) {
|
||||
reportWtf("starting NetworkStats Service", e);
|
||||
}
|
||||
// This has to be called before NetworkPolicyManager because NetworkPolicyManager
|
||||
// needs to take NetworkStatsService to initialize.
|
||||
mSystemServiceManager.startServiceFromJar(NETWORK_STATS_SERVICE_INITIALIZER_CLASS,
|
||||
CONNECTIVITY_SERVICE_APEX_PATH);
|
||||
t.traceEnd();
|
||||
|
||||
t.traceBegin("StartNetworkPolicyManagerService");
|
||||
@@ -2775,7 +2771,6 @@ public final class SystemServer implements Dumpable {
|
||||
|
||||
// These are needed to propagate to the runnable below.
|
||||
final NetworkManagementService networkManagementF = networkManagement;
|
||||
final NetworkStatsService networkStatsF = networkStats;
|
||||
final NetworkPolicyManagerService networkPolicyF = networkPolicy;
|
||||
final CountryDetectorService countryDetectorF = countryDetector;
|
||||
final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater;
|
||||
@@ -2874,15 +2869,6 @@ public final class SystemServer implements Dumpable {
|
||||
.networkScoreAndNetworkManagementServiceReady();
|
||||
}
|
||||
t.traceEnd();
|
||||
t.traceBegin("MakeNetworkStatsServiceReady");
|
||||
try {
|
||||
if (networkStatsF != null) {
|
||||
networkStatsF.systemReady();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
reportWtf("making Network Stats Service ready", e);
|
||||
}
|
||||
t.traceEnd();
|
||||
t.traceBegin("MakeConnectivityServiceReady");
|
||||
try {
|
||||
if (connectivityF != null) {
|
||||
|
||||
Reference in New Issue
Block a user