summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-15 10:13:59 -0800
committerSan Mehat <san@google.com>2010-01-16 06:11:27 -0800
commit5fbf4094f5857ab15801c65a260a5c4b6866d655 (patch)
tree16ff4a03f8a332156610d3e6809515e18825ebf2
parentff58b5770514521ebdd48f500d8dc121a42d7eb2 (diff)
downloadframeworks_base-5fbf4094f5857ab15801c65a260a5c4b6866d655.zip
frameworks_base-5fbf4094f5857ab15801c65a260a5c4b6866d655.tar.gz
frameworks_base-5fbf4094f5857ab15801c65a260a5c4b6866d655.tar.bz2
MountService: Suppress media removed notification when enabling UMS
Signed-off-by: San Mehat <san@google.com>
-rw-r--r--services/java/com/android/server/MountService.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index c8a6915..d54c4d9 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -127,6 +127,7 @@ class MountService extends IMountService.Stub
private boolean mUmsConnected = false;
private boolean mUmsEnabled = false;
+ private boolean mUmsEnabling = false;
private String mLegacyState = Environment.MEDIA_REMOVED;
@@ -332,13 +333,16 @@ class MountService extends IMountService.Stub
String vp = Environment.getExternalStorageDirectory().getPath();
String vs = getVolumeState(vp);
+ mUmsEnabling = enable;
if (enable && vs.equals(Environment.MEDIA_MOUNTED)) {
unmountVolume(vp);
+ mUmsEnabling = false;
updateUsbMassStorageNotification(true, false);
}
setShareMethodEnabled(vp, "ums", enable);
mUmsEnabled = enable;
+ mUmsEnabling = false;
if (!enable) {
mountVolume(vp);
if (mPromptUms) {
@@ -594,10 +598,14 @@ class MountService extends IMountService.Stub
} else if (newState == VolumeState.NoMedia) {
// NoMedia is handled via Disk Remove events
} else if (newState == VolumeState.Idle) {
- // Don't notify if we're in BAD_REMOVAL, NOFS, or UNMOUNTABLE
+ /*
+ * Don't notify if we're in BAD_REMOVAL, NOFS, UNMOUNTABLE, or
+ * if we're in the process of enabling UMS
+ */
if (!vs.equals(Environment.MEDIA_BAD_REMOVAL) &&
!vs.equals(Environment.MEDIA_NOFS) &&
- !vs.equals(Environment.MEDIA_UNMOUNTABLE)) {
+ !vs.equals(Environment.MEDIA_UNMOUNTABLE) &&
+ !mUmsEnabling) {
notifyMediaUnmounted(mountPoint);
}
} else if (newState == VolumeState.Pending) {