MountService: Don't update the storage status when we're unmounted
Signed-off-by: San Mehat <san@google.com>
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 85a2e0b..efc7839 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -553,7 +553,7 @@
if (st == VolumeState.NoMedia) {
state = Environment.MEDIA_REMOVED;
} else if (st == VolumeState.Idle) {
- state = Environment.MEDIA_UNMOUNTED;
+ state = null;
try {
mountVolume(path);
} catch (Exception ex) {
@@ -569,7 +569,9 @@
throw new Exception(String.format("Unexpected state %d", st));
}
}
- updatePublicVolumeState(path, state);
+ if (state != null) {
+ updatePublicVolumeState(path, state);
+ }
} catch (Exception e) {
Log.e(TAG, "Error processing initial volume state", e);
updatePublicVolumeState(path, Environment.MEDIA_REMOVED);