diff options
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
| -rw-r--r-- | services/java/com/android/server/SystemServer.java | 92 |
1 files changed, 69 insertions, 23 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 3ae62ad..25bee92 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -108,6 +108,7 @@ class ServerThread extends Thread { String factoryTestStr = SystemProperties.get("ro.factorytest"); int factoryTest = "".equals(factoryTestStr) ? SystemServer.FACTORY_TEST_OFF : Integer.parseInt(factoryTestStr); + final boolean headless = "1".equals(SystemProperties.get("ro.config.headless", "0")); LightsService lights = null; PowerManagerService power = null; @@ -126,10 +127,12 @@ class ServerThread extends Thread { BluetoothA2dpService bluetoothA2dp = null; DockObserver dock = null; UsbService usb = null; + SerialService serial = null; UiModeManagerService uiMode = null; RecognitionManagerService recognition = null; ThrottleService throttle = null; NetworkTimeUpdateService networkTimeUpdater = null; + CommonTimeManagementService commonTimeMgmtService = null; // Critical services... try { @@ -231,10 +234,13 @@ class ServerThread extends Thread { bluetooth = new BluetoothService(context); ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, bluetooth); bluetooth.initAfterRegistration(); - bluetoothA2dp = new BluetoothA2dpService(context, bluetooth); - ServiceManager.addService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE, - bluetoothA2dp); - bluetooth.initAfterA2dpRegistration(); + + if (!"0".equals(SystemProperties.get("system_init.startaudioservice"))) { + bluetoothA2dp = new BluetoothA2dpService(context, bluetooth); + ServiceManager.addService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE, + bluetoothA2dp); + bluetooth.initAfterA2dpRegistration(); + } int airplaneModeOn = Settings.System.getInt(mContentResolver, Settings.System.AIRPLANE_MODE_ON, 0); @@ -397,14 +403,24 @@ class ServerThread extends Thread { } try { - /* - * NotificationManagerService is dependant on MountService, - * (for media / usb notifications) so we must start MountService first. - */ - Slog.i(TAG, "Mount Service"); - ServiceManager.addService("mount", new MountService(context)); + Slog.i(TAG, "UpdateLock Service"); + ServiceManager.addService(Context.UPDATE_LOCK_SERVICE, + new UpdateLockService(context)); } catch (Throwable e) { - reportWtf("starting Mount Service", e); + reportWtf("starting UpdateLockService", e); + } + + if (!"0".equals(SystemProperties.get("system_init.startmountservice"))) { + try { + /* + * NotificationManagerService is dependant on MountService, + * (for media / usb notifications) so we must start MountService first. + */ + Slog.i(TAG, "Mount Service"); + ServiceManager.addService("mount", new MountService(context)); + } catch (Throwable e) { + reportWtf("starting Mount Service", e); + } } try { @@ -456,19 +472,26 @@ class ServerThread extends Thread { reportWtf("starting DropBoxManagerService", e); } - try { - Slog.i(TAG, "Wallpaper Service"); - wallpaper = new WallpaperManagerService(context); - ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper); - } catch (Throwable e) { - reportWtf("starting Wallpaper Service", e); + if (context.getResources().getBoolean( + com.android.internal.R.bool.config_enableWallpaperService)) { + try { + Slog.i(TAG, "Wallpaper Service"); + if (!headless) { + wallpaper = new WallpaperManagerService(context); + ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper); + } + } catch (Throwable e) { + reportWtf("starting Wallpaper Service", e); + } } - try { - Slog.i(TAG, "Audio Service"); - ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); - } catch (Throwable e) { - reportWtf("starting Audio Service", e); + if (!"0".equals(SystemProperties.get("system_init.startaudioservice"))) { + try { + Slog.i(TAG, "Audio Service"); + ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); + } catch (Throwable e) { + reportWtf("starting Audio Service", e); + } } try { @@ -497,6 +520,15 @@ class ServerThread extends Thread { } try { + Slog.i(TAG, "Serial Service"); + // Serial port support + serial = new SerialService(context); + ServiceManager.addService(Context.SERIAL_SERVICE, serial); + } catch (Throwable e) { + Slog.e(TAG, "Failure starting SerialService", e); + } + + try { Slog.i(TAG, "UI Mode Manager Service"); // Listen for UI mode changes uiMode = new UiModeManagerService(context); @@ -552,6 +584,14 @@ class ServerThread extends Thread { } catch (Throwable e) { reportWtf("starting NetworkTimeUpdate service", e); } + + try { + Slog.i(TAG, "CommonTimeManagementService"); + commonTimeMgmtService = new CommonTimeManagementService(context); + ServiceManager.addService("commontime_management", commonTimeMgmtService); + } catch (Throwable e) { + reportWtf("starting CommonTimeManagementService service", e); + } } // Before things start rolling, be sure we have decided whether @@ -630,6 +670,7 @@ class ServerThread extends Thread { final LocationManagerService locationF = location; final CountryDetectorService countryDetectorF = countryDetector; final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater; + final CommonTimeManagementService commonTimeMgmtServiceF = commonTimeMgmtService; final TextServicesManagerService textServiceManagerServiceF = tsms; final StatusBarManagerService statusBarF = statusBar; @@ -642,7 +683,7 @@ class ServerThread extends Thread { public void run() { Slog.i(TAG, "Making services ready"); - startSystemUi(contextF); + if (!headless) startSystemUi(contextF); try { if (batteryF != null) batteryF.systemReady(); } catch (Throwable e) { @@ -729,6 +770,11 @@ class ServerThread extends Thread { reportWtf("making Network Time Service ready", e); } try { + if (commonTimeMgmtServiceF != null) commonTimeMgmtServiceF.systemReady(); + } catch (Throwable e) { + reportWtf("making Common time management service ready", e); + } + try { if (textServiceManagerServiceF != null) textServiceManagerServiceF.systemReady(); } catch (Throwable e) { reportWtf("making Text Services Manager Service ready", e); |
