diff options
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
| -rw-r--r-- | services/java/com/android/server/SystemServer.java | 143 |
1 files changed, 126 insertions, 17 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index da91746..18ece5b 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -29,7 +29,8 @@ import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.media.AudioService; -import android.net.wifi.p2p.WifiP2pService; +import android.media.tv.TvInputManager; +import android.os.Build; import android.os.Environment; import android.os.FactoryTest; import android.os.Handler; @@ -62,27 +63,33 @@ import com.android.server.content.ContentService; import com.android.server.devicepolicy.DevicePolicyManagerService; import com.android.server.display.DisplayManagerService; import com.android.server.dreams.DreamManagerService; +import com.android.server.hdmi.HdmiControlService; import com.android.server.input.InputManagerService; import com.android.server.lights.LightsManager; import com.android.server.lights.LightsService; import com.android.server.media.MediaRouterService; +import com.android.server.media.MediaSessionService; import com.android.server.net.NetworkPolicyManagerService; import com.android.server.net.NetworkStatsService; import com.android.server.notification.NotificationManagerService; import com.android.server.os.SchedulingPolicyService; import com.android.server.pm.BackgroundDexOptService; import com.android.server.pm.Installer; +import com.android.server.pm.LauncherAppsService; import com.android.server.pm.PackageManagerService; import com.android.server.pm.UserManagerService; import com.android.server.power.PowerManagerService; import com.android.server.power.ShutdownThread; +import com.android.server.restrictions.RestrictionsManagerService; import com.android.server.search.SearchManagerService; import com.android.server.statusbar.StatusBarManagerService; import com.android.server.storage.DeviceStorageMonitorService; +import com.android.server.task.TaskManagerService; +import com.android.server.trust.TrustManagerService; +import com.android.server.tv.TvInputManagerService; import com.android.server.twilight.TwilightService; import com.android.server.usb.UsbService; import com.android.server.wallpaper.WallpaperManagerService; -import com.android.server.wifi.WifiService; import com.android.server.wm.WindowManagerService; import dalvik.system.VMRuntime; @@ -111,12 +118,24 @@ public final class SystemServer { "com.android.server.backup.BackupManagerService$Lifecycle"; private static final String APPWIDGET_SERVICE_CLASS = "com.android.server.appwidget.AppWidgetService"; + private static final String VOICE_RECOGNITION_MANAGER_SERVICE_CLASS = + "com.android.server.voiceinteraction.VoiceInteractionManagerService"; private static final String PRINT_MANAGER_SERVICE_CLASS = "com.android.server.print.PrintManagerService"; private static final String USB_SERVICE_CLASS = "com.android.server.usb.UsbService$Lifecycle"; + private static final String WIFI_SERVICE_CLASS = + "com.android.server.wifi.WifiService"; + private static final String WIFI_PASSPOINT_SERVICE_CLASS = + "com.android.server.wifi.passpoint.WifiPasspointService"; + private static final String WIFI_P2P_SERVICE_CLASS = + "com.android.server.wifi.p2p.WifiP2pService"; private static final String HDMI_CEC_SERVICE_CLASS = "com.android.server.hdmi.HdmiCecService"; + private static final String ETHERNET_SERVICE_CLASS = + "com.android.server.ethernet.EthernetService"; + private static final String TASK_SERVICE_CLASS = + "com.android.server.task.TaskManagerService"; private final int mFactoryTestMode; private Timer mProfilerSnapshotTimer; @@ -189,6 +208,10 @@ public final class SystemServer { // as efficient as possible with its memory usage. VMRuntime.getRuntime().setTargetHeapUtilization(0.8f); + // Some devices rely on runtime fingerprint generation, so make sure + // we've defined it before booting further. + Build.ensureFingerprintProperty(); + // Within the system server, it is an error to access Environment paths without // explicitly specifying a user. Environment.setUserRequired(true); @@ -263,7 +286,7 @@ public final class SystemServer { private void createSystemContext() { ActivityThread activityThread = ActivityThread.systemMain(); mSystemContext = activityThread.getSystemContext(); - mSystemContext.setTheme(android.R.style.Theme_Holo); + mSystemContext.setTheme(android.R.style.Theme_DeviceDefault_Light_DarkActionBar); } private void startBootstrapServices() { @@ -281,6 +304,7 @@ public final class SystemServer { // Activity manager runs the show. mActivityManagerService = mSystemServiceManager.startService( ActivityManagerService.Lifecycle.class).getService(); + mActivityManagerService.setSystemServiceManager(mSystemServiceManager); } private void startCoreServices() { @@ -302,8 +326,7 @@ public final class SystemServer { NetworkStatsService networkStats = null; NetworkPolicyManagerService networkPolicy = null; ConnectivityService connectivity = null; - WifiP2pService wifiP2p = null; - WifiService wifi = null; + NetworkScoreService networkScore = null; NsdService serviceDiscovery= null; IPackageManager pm = null; WindowManagerService wm = null; @@ -316,6 +339,7 @@ public final class SystemServer { InputManagerService inputManager = null; TelephonyRegistry telephonyRegistry = null; ConsumerIrService consumerIr = null; + AudioService audioService = null; boolean onlyCore = false; boolean firstBoot = false; @@ -587,6 +611,14 @@ public final class SystemServer { if (!disableNetwork) { try { + Slog.i(TAG, "Network Score Service"); + networkScore = new NetworkScoreService(context); + ServiceManager.addService(Context.NETWORK_SCORE_SERVICE, networkScore); + } catch (Throwable e) { + reportWtf("starting Network Score Service", e); + } + + try { Slog.i(TAG, "NetworkStats Service"); networkStats = new NetworkStatsService(context, networkManagement, alarm); ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats); @@ -605,32 +637,46 @@ public final class SystemServer { reportWtf("starting NetworkPolicy Service", e); } - try { - Slog.i(TAG, "Wi-Fi P2pService"); - wifiP2p = new WifiP2pService(context); - ServiceManager.addService(Context.WIFI_P2P_SERVICE, wifiP2p); + try { + mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS); } catch (Throwable e) { reportWtf("starting Wi-Fi P2pService", e); } - try { - Slog.i(TAG, "Wi-Fi Service"); - wifi = new WifiService(context); - ServiceManager.addService(Context.WIFI_SERVICE, wifi); + try { + mSystemServiceManager.startService(WIFI_PASSPOINT_SERVICE_CLASS); + } catch (Throwable e) { + reportWtf("starting Wi-Fi PasspointService", e); + } + + try { + mSystemServiceManager.startService(WIFI_SERVICE_CLASS); } catch (Throwable e) { reportWtf("starting Wi-Fi Service", e); } try { + Slog.i(TAG, "Wi-Fi Scanning Service"); + mSystemServiceManager.startService( + "com.android.server.wifi.WifiScanningService"); + + } catch (Throwable e) { + reportWtf("starting Wi-Fi Scanning Service", e); + } + + try { + mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS); + } catch (Throwable e) { + reportWtf("starting Ethernet Service", e); + } + + try { Slog.i(TAG, "Connectivity Service"); connectivity = new ConnectivityService( context, networkManagement, networkStats, networkPolicy); ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); networkStats.bindConnectivityManager(connectivity); networkPolicy.bindConnectivityManager(connectivity); - - wifiP2p.connectivityServiceReady(); - wifi.checkAndStartWifi(); } catch (Throwable e) { reportWtf("starting Connectivity Service", e); } @@ -735,7 +781,8 @@ public final class SystemServer { if (!disableMedia && !"0".equals(SystemProperties.get("system_init.startaudioservice"))) { try { Slog.i(TAG, "Audio Service"); - ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); + audioService = new AudioService(context); + ServiceManager.addService(Context.AUDIO_SERVICE, audioService); } catch (Throwable e) { reportWtf("starting Audio Service", e); } @@ -781,6 +828,8 @@ public final class SystemServer { mSystemServiceManager.startService(UiModeManagerService.class); + mSystemServiceManager.startService(TaskManagerService.class); + if (!disableNonCoreServices) { try { if (pm.hasSystemFeature(PackageManager.FEATURE_BACKUP)) { @@ -804,6 +853,15 @@ public final class SystemServer { } catch (Throwable e) { reportWtf("starting Recognition Service", e); } + + try { + if (pm.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS)) { + Slog.i(TAG, "Voice Recognition Service"); + mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS); + } + } catch (Throwable e) { + reportWtf("starting Voice Recognition Service", e); + } } try { @@ -884,11 +942,36 @@ public final class SystemServer { } try { + mSystemServiceManager.startService(RestrictionsManagerService.class); + } catch (Throwable e) { + reportWtf("starting RestrictionsManagerService", e); + } + + try { + mSystemServiceManager.startService(MediaSessionService.class); + } catch (Throwable e) { + reportWtf("starting MediaSessionService", e); + } + + try { mSystemServiceManager.startService(HDMI_CEC_SERVICE_CLASS); } catch (Throwable e) { reportWtf("starting HdmiCec Service", e); } + try { + mSystemServiceManager.startService(HdmiControlService.class); + } catch (Throwable e) { + reportWtf("starting HdmiControlService", e); + } + + try { + Slog.i(TAG, "TvInputManagerService"); + mSystemServiceManager.startService(TvInputManagerService.class); + } catch (Throwable e) { + reportWtf("starting TvInputManagerService", e); + } + if (!disableNonCoreServices) { try { Slog.i(TAG, "Media Router Service"); @@ -899,12 +982,26 @@ public final class SystemServer { } try { + Slog.i(TAG, "Trust Manager"); + mSystemServiceManager.startService(TrustManagerService.class); + } catch (Throwable e) { + Slog.e(TAG, "Failure starting TrustManagerService", e); + } + + try { Slog.i(TAG, "BackgroundDexOptService"); new BackgroundDexOptService(context); } catch (Throwable e) { reportWtf("starting BackgroundDexOptService", e); } } + + try { + Slog.i(TAG, "LauncherAppsService"); + mSystemServiceManager.startService(LauncherAppsService.class); + } catch (Throwable t) { + reportWtf("starting LauncherAppsService", t); + } } // Before things start rolling, be sure we have decided whether @@ -986,6 +1083,7 @@ public final class SystemServer { final NetworkStatsService networkStatsF = networkStats; final NetworkPolicyManagerService networkPolicyF = networkPolicy; final ConnectivityService connectivityF = connectivity; + final NetworkScoreService networkScoreF = networkScore; final WallpaperManagerService wallpaperF = wallpaper; final InputMethodManagerService immF = imm; final RecognitionManagerService recognitionF = recognition; @@ -999,6 +1097,7 @@ public final class SystemServer { final InputManagerService inputManagerF = inputManager; final TelephonyRegistry telephonyRegistryF = telephonyRegistry; final MediaRouterService mediaRouterF = mediaRouter; + final AudioService audioServiceF = audioService; // We now tell the activity manager it is okay to run third party // code. It will call back into us once it has gotten to the state @@ -1033,6 +1132,11 @@ public final class SystemServer { reportWtf("making Battery Service ready", e); } try { + if (networkScoreF != null) networkScoreF.systemReady(); + } catch (Throwable e) { + reportWtf("making Network Score Service ready", e); + } + try { if (networkManagementF != null) networkManagementF.systemReady(); } catch (Throwable e) { reportWtf("making Network Managment Service ready", e); @@ -1057,6 +1161,11 @@ public final class SystemServer { } catch (Throwable e) { reportWtf("making Recognition Service ready", e); } + try { + if (audioServiceF != null) audioServiceF.systemReady(); + } catch (Throwable e) { + reportWtf("Notifying AudioService running", e); + } Watchdog.getInstance().start(); // It is now okay to let the various system services start their |
