diff options
author | San Mehat <san@google.com> | 2010-02-18 19:40:04 -0800 |
---|---|---|
committer | San Mehat <san@google.com> | 2010-02-19 06:51:58 -0800 |
commit | fafb041b47c1c5f6a4c253768295ed3aeb7ad412 (patch) | |
tree | 7f3b001a5c6336d6bff264253841b7d4168d8d8a /services/java/com/android/server/MountService.java | |
parent | 8a032a3b29e7708e468e2078ff88a39e083db1da (diff) | |
download | frameworks_base-fafb041b47c1c5f6a4c253768295ed3aeb7ad412.zip frameworks_base-fafb041b47c1c5f6a4c253768295ed3aeb7ad412.tar.gz frameworks_base-fafb041b47c1c5f6a4c253768295ed3aeb7ad412.tar.bz2 |
MountService: Move boot-time mount to a thread - avoids ANR at boot
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'services/java/com/android/server/MountService.java')
-rw-r--r-- | services/java/com/android/server/MountService.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index d6e23fb..2a78806 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -150,13 +150,23 @@ class MountService extends IMountService.Stub notifyVolumeStateChange(null, "/sdcard", VolumeState.NoMedia, VolumeState.Mounted); return; } - String path = Environment.getExternalStorageDirectory().getPath(); - if (getVolumeState(path).equals(Environment.MEDIA_UNMOUNTED)) { - int rc = doMountVolume(path); - if (rc != StorageResultCode.OperationSucceeded) { - Log.e(TAG, String.format("Boot-time mount failed (%d)", rc)); + new Thread() { + public void run() { + try { + String path = Environment.getExternalStorageDirectory().getPath(); + if (getVolumeState( + Environment.getExternalStorageDirectory().getPath()).equals( + Environment.MEDIA_UNMOUNTED)) { + int rc = doMountVolume(path); + if (rc != StorageResultCode.OperationSucceeded) { + Log.e(TAG, String.format("Boot-time mount failed (%d)", rc)); + } + } + } catch (Exception ex) { + Log.e(TAG, "Boot-time mount exception", ex); + } } - } + }.start(); } } }; |