summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/java/com/android/server/MountService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 6de2effe388e..8d450337a13a 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -177,8 +177,12 @@ class MountService extends IMountService.Stub
String vs = getVolumeState(path);
if (enable && vs.equals(Environment.MEDIA_MOUNTED)) {
mUmsEnabling = enable; // Override for isUsbMassStorageEnabled()
- doUnmountVolume(path);
+ int rc = doUnmountVolume(path);
mUmsEnabling = false; // Clear override
+ if (rc != StorageResultCode.OperationSucceeded) {
+ Log.e(TAG, String.format("Failed to unmount before enabling UMS (%d)", rc));
+ return rc;
+ }
}
try {
@@ -517,7 +521,7 @@ class MountService extends IMountService.Stub
}
private int doUnmountVolume(String path) {
- if (getVolumeState(path).equals(Environment.MEDIA_MOUNTED)) {
+ if (!getVolumeState(path).equals(Environment.MEDIA_MOUNTED)) {
return VoldResponseCode.OpFailedVolNotMounted;
}