From 17da5a691c72fb3dbab37ce1ae1ed3a376e90c32 Mon Sep 17 00:00:00 2001 From: San Mehat Date: Wed, 3 Feb 2010 14:39:20 -0800 Subject: [PATCH 1/2] StorageManager: Check for a null MountService Signed-off-by: San Mehat --- core/java/android/storage/StorageManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/storage/StorageManager.java b/core/java/android/storage/StorageManager.java index dd8bd63699821..924d169525ca0 100644 --- a/core/java/android/storage/StorageManager.java +++ b/core/java/android/storage/StorageManager.java @@ -254,6 +254,10 @@ public class StorageManager */ public StorageManager(Looper tgtLooper) throws RemoteException { mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount")); + if (mMountService == null) { + Log.e(TAG, "Unable to connect to mount service! - is it running yet?"); + return; + } mTgtLooper = tgtLooper; mBinderListener = new MountServiceBinderListener(); mMountService.registerListener(mBinderListener); From 1bf3f8be7c01aa77afc114e0728cb041e95640b1 Mon Sep 17 00:00:00 2001 From: San Mehat Date: Wed, 3 Feb 2010 14:43:09 -0800 Subject: [PATCH 2/2] SystemServer: Move MountService startup before NotificationManagerService Signed-off-by: San Mehat --- .../java/com/android/server/SystemServer.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index ee1cc8defa5d5..6e9c21bde0b06 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -272,6 +272,17 @@ class ServerThread extends Thread { Log.e(TAG, "Failure starting Accessibility Manager", e); } + try { + /* + * NotificationManagerService is dependant on MountService, + * (for media / usb notifications) so we must start MountService first. + */ + Log.i(TAG, "Mount Service"); + ServiceManager.addService("mount", new MountService(context)); + } catch (Throwable e) { + Log.e(TAG, "Failure starting Mount Service", e); + } + try { Log.i(TAG, "Notification Manager"); notification = new NotificationManagerService(context, statusBar, lights); @@ -280,14 +291,6 @@ class ServerThread extends Thread { Log.e(TAG, "Failure starting Notification Manager", e); } - try { - // MountService must start after NotificationManagerService - Log.i(TAG, "Mount Service"); - ServiceManager.addService("mount", new MountService(context)); - } catch (Throwable e) { - Log.e(TAG, "Failure starting Mount Service", e); - } - try { Log.i(TAG, "Device Storage Monitor"); ServiceManager.addService(DeviceStorageMonitorService.SERVICE,