diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index cdb622cda110c..fbf512c843bbe 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -16,6 +16,7 @@ package android.os.storage; +import android.os.Environment; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -534,6 +535,7 @@ public class StorageManager * @hide */ public String getVolumeState(String mountPoint) { + if (mMountService == null) return Environment.MEDIA_REMOVED; try { return mMountService.getVolumeState(mountPoint); } catch (RemoteException e) { @@ -547,6 +549,7 @@ public class StorageManager * @hide */ public StorageVolume[] getVolumeList() { + if (mMountService == null) return new StorageVolume[0]; try { Parcelable[] list = mMountService.getVolumeList(); if (list == null) return new StorageVolume[0]; diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 31b8f1fb3bf6a..1c6c35590dc89 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -348,15 +348,17 @@ class ServerThread extends Thread { Slog.e(TAG, "Failure starting Accessibility Manager", e); } - 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) { - Slog.e(TAG, "Failure starting Mount Service", 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) { + Slog.e(TAG, "Failure starting Mount Service", e); + } } try { @@ -418,11 +420,13 @@ class ServerThread extends Thread { Slog.e(TAG, "Failure starting Wallpaper Service", e); } - try { - Slog.i(TAG, "Audio Service"); - ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); - } catch (Throwable e) { - Slog.e(TAG, "Failure 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) { + Slog.e(TAG, "Failure starting Audio Service", e); + } } try {