diff options
Diffstat (limited to 'services/java')
| -rw-r--r-- | services/java/com/android/server/SystemServer.java | 120 |
1 files changed, 55 insertions, 65 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index f984d4b..8c653e2 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -26,16 +26,11 @@ import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; -import android.content.pm.IPackageManager; import android.content.pm.PackageManager; import android.content.res.Configuration; -import android.media.AudioService; -import android.media.tv.TvInputManager; import android.os.Build; import android.os.Environment; import android.os.FactoryTest; -import android.os.Handler; -import android.os.IBinder; import android.os.IPowerManager; import android.os.Looper; import android.os.RemoteException; @@ -44,22 +39,20 @@ import android.os.StrictMode; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; -import android.service.dreams.DreamService; +import android.os.storage.IMountService; import android.util.DisplayMetrics; import android.util.EventLog; -import android.util.Log; import android.util.Slog; import android.view.WindowManager; import android.webkit.WebViewFactory; import com.android.internal.R; import com.android.internal.os.BinderInternal; -import com.android.internal.os.Zygote; import com.android.internal.os.SamplingProfilerIntegration; import com.android.server.accessibility.AccessibilityManagerService; import com.android.server.accounts.AccountManagerService; import com.android.server.am.ActivityManagerService; -import com.android.server.am.BatteryStatsService; +import com.android.server.audio.AudioService; import com.android.server.clipboard.ClipboardService; import com.android.server.content.ContentService; import com.android.server.devicepolicy.DevicePolicyManagerService; @@ -69,7 +62,6 @@ import com.android.server.fingerprint.FingerprintService; import com.android.server.hdmi.HdmiControlService; import com.android.server.input.InputManagerService; import com.android.server.job.JobSchedulerService; -import com.android.server.lights.LightsManager; import com.android.server.lights.LightsService; import com.android.server.media.MediaRouterService; import com.android.server.media.MediaSessionService; @@ -83,6 +75,7 @@ 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.DeviceIdleController; import com.android.server.power.PowerManagerService; import com.android.server.power.ShutdownThread; import com.android.server.restrictions.RestrictionsManagerService; @@ -131,6 +124,8 @@ public final class SystemServer { "com.android.server.print.PrintManagerService"; private static final String USB_SERVICE_CLASS = "com.android.server.usb.UsbService$Lifecycle"; + private static final String MIDI_SERVICE_CLASS = + "com.android.server.midi.MidiService$Lifecycle"; private static final String WIFI_SERVICE_CLASS = "com.android.server.wifi.WifiService"; private static final String WIFI_P2P_SERVICE_CLASS = @@ -139,6 +134,8 @@ public final class SystemServer { "com.android.server.ethernet.EthernetService"; private static final String JOB_SCHEDULER_SERVICE_CLASS = "com.android.server.job.JobSchedulerService"; + private static final String MOUNT_SERVICE_CLASS = + "com.android.server.MountService$Lifecycle"; private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst"; private final int mFactoryTestMode; @@ -392,7 +389,7 @@ public final class SystemServer { ContentService contentService = null; VibratorService vibrator = null; IAlarmManager alarm = null; - MountService mountService = null; + IMountService mountService = null; NetworkManagementService networkManagement = null; NetworkStatsService networkStats = null; NetworkPolicyManagerService networkPolicy = null; @@ -413,9 +410,7 @@ public final class SystemServer { EntropyMixer entropyMixer = null; boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false); - boolean disableMedia = SystemProperties.getBoolean("config.disable_media", false); boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false); - boolean disableTelephony = SystemProperties.getBoolean("config.disable_telephony", false); boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false); boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false); boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false); @@ -527,23 +522,20 @@ public final class SystemServer { // Bring up services needed for UI. if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) { - //if (!disableNonCoreServices) { // TODO: View depends on these; mock them? - if (true) { - try { - Slog.i(TAG, "Input Method Service"); - imm = new InputMethodManagerService(context, wm); - ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm); - } catch (Throwable e) { - reportWtf("starting Input Manager Service", e); - } + try { + Slog.i(TAG, "Input Method Service"); + imm = new InputMethodManagerService(context, wm); + ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm); + } catch (Throwable e) { + reportWtf("starting Input Manager Service", e); + } - try { - Slog.i(TAG, "Accessibility Manager"); - ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, - new AccessibilityManagerService(context)); - } catch (Throwable e) { - reportWtf("starting Accessibility Manager", e); - } + try { + Slog.i(TAG, "Accessibility Manager"); + ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, + new AccessibilityManagerService(context)); + } catch (Throwable e) { + reportWtf("starting Accessibility Manager", e); } } @@ -561,9 +553,9 @@ public final class SystemServer { * NotificationManagerService is dependant on MountService, * (for media / usb notifications) so we must start MountService first. */ - Slog.i(TAG, "Mount Service"); - mountService = new MountService(context); - ServiceManager.addService("mount", mountService); + mSystemServiceManager.startService(MOUNT_SERVICE_CLASS); + mountService = IMountService.Stub.asInterface( + ServiceManager.getService("mount")); } catch (Throwable e) { reportWtf("starting Mount Service", e); } @@ -682,7 +674,8 @@ public final class SystemServer { mSystemServiceManager.startService("com.android.server.wifi.RttService"); - if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET)) { + if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) || + mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) { mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS); } @@ -723,7 +716,10 @@ public final class SystemServer { * first before continuing. */ if (mountService != null && !mOnlyCore) { - mountService.waitForAsecScan(); + try { + mountService.waitForAsecScan(); + } catch (RemoteException ignored) { + } } try { @@ -794,32 +790,33 @@ public final class SystemServer { } } - if (!disableMedia && !"0".equals(SystemProperties.get("system_init.startaudioservice"))) { - try { - Slog.i(TAG, "Audio Service"); - audioService = new AudioService(context); - ServiceManager.addService(Context.AUDIO_SERVICE, audioService); - } catch (Throwable e) { - reportWtf("starting Audio Service", e); - } + try { + Slog.i(TAG, "Audio Service"); + audioService = new AudioService(context); + ServiceManager.addService(Context.AUDIO_SERVICE, audioService); + } catch (Throwable e) { + reportWtf("starting Audio Service", e); } if (!disableNonCoreServices) { mSystemServiceManager.startService(DockObserver.class); } - if (!disableMedia) { - try { - Slog.i(TAG, "Wired Accessory Manager"); - // Listen for wired headset changes - inputManager.setWiredAccessoryCallbacks( - new WiredAccessoryManager(context, inputManager)); - } catch (Throwable e) { - reportWtf("starting WiredAccessoryManager", e); - } + try { + Slog.i(TAG, "Wired Accessory Manager"); + // Listen for wired headset changes + inputManager.setWiredAccessoryCallbacks( + new WiredAccessoryManager(context, inputManager)); + } catch (Throwable e) { + reportWtf("starting WiredAccessoryManager", e); } if (!disableNonCoreServices) { + if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MIDI)) { + // Start MIDI Manager service + mSystemServiceManager.startService(MIDI_SERVICE_CLASS); + } + if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST) || mPackageManager.hasSystemFeature( PackageManager.FEATURE_USB_ACCESSORY)) { @@ -883,14 +880,12 @@ public final class SystemServer { } } - if (!disableMedia) { - try { - Slog.i(TAG, "CommonTimeManagementService"); - commonTimeMgmtService = new CommonTimeManagementService(context); - ServiceManager.addService("commontime_management", commonTimeMgmtService); - } catch (Throwable e) { - reportWtf("starting CommonTimeManagementService service", e); - } + try { + Slog.i(TAG, "CommonTimeManagementService"); + commonTimeMgmtService = new CommonTimeManagementService(context); + ServiceManager.addService("commontime_management", commonTimeMgmtService); + } catch (Throwable e) { + reportWtf("starting CommonTimeManagementService service", e); } if (!disableNetwork) { @@ -960,6 +955,7 @@ public final class SystemServer { if (!disableNonCoreServices) { mSystemServiceManager.startService(MediaProjectionManagerService.class); + mSystemServiceManager.startService(DeviceIdleController.class); } // Before things start rolling, be sure we have decided whether @@ -1038,7 +1034,6 @@ public final class SystemServer { } // These are needed to propagate to the runnable below. - final MountService mountServiceF = mountService; final NetworkManagementService networkManagementF = networkManagement; final NetworkStatsService networkStatsF = networkStats; final NetworkPolicyManagerService networkPolicyF = networkPolicy; @@ -1086,11 +1081,6 @@ public final class SystemServer { reportWtf("starting System UI", e); } try { - if (mountServiceF != null) mountServiceF.systemReady(); - } catch (Throwable e) { - reportWtf("making Mount Service ready", e); - } - try { if (networkScoreF != null) networkScoreF.systemReady(); } catch (Throwable e) { reportWtf("making Network Score Service ready", e); |
