summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-29 05:34:01 -0800
committerSan Mehat <san@google.com>2010-02-02 11:17:46 -0800
commitec7f7e6378f87cdc826a8b5d836fff26f44b0b09 (patch)
tree1395f01566dfeec8bfaa2d3b488ab60c7693c5f6 /core/java/com
parentb339ac3d3e23713640aa9615dec84cff7ef727d6 (diff)
downloadframeworks_base-ec7f7e6378f87cdc826a8b5d836fff26f44b0b09.zip
frameworks_base-ec7f7e6378f87cdc826a8b5d836fff26f44b0b09.tar.gz
frameworks_base-ec7f7e6378f87cdc826a8b5d836fff26f44b0b09.tar.bz2
UsbStorageActivity: Refactor for new MountService API
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/app/UsbStorageActivity.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/java/com/android/internal/app/UsbStorageActivity.java b/core/java/com/android/internal/app/UsbStorageActivity.java
index 37ea352..34ae2b4 100644
--- a/core/java/com/android/internal/app/UsbStorageActivity.java
+++ b/core/java/com/android/internal/app/UsbStorageActivity.java
@@ -24,7 +24,9 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
+import android.os.Environment;
import android.os.IMountService;
+import android.os.MountServiceResultCode;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -116,7 +118,8 @@ public class UsbStorageActivity extends Activity {
IMountService mountService = IMountService.Stub.asInterface(ServiceManager
.getService("mount"));
if (mountService != null) {
- umsOn = mountService.getMassStorageEnabled();
+ umsOn = mountService.getVolumeShared(
+ Environment.getExternalStorageDirectory().getPath(), "ums");
}
} catch (android.os.RemoteException exc) {
// pass
@@ -140,10 +143,13 @@ public class UsbStorageActivity extends Activity {
}
try {
- mountService.setMassStorageEnabled(true);
+ if (mountService.shareVolume(
+ Environment.getExternalStorageDirectory().getPath(), "ums") !=
+ MountServiceResultCode.OperationSucceeded) {
+ showSharingError();
+ }
} catch (RemoteException e) {
showSharingError();
- return;
}
}
@@ -156,7 +162,8 @@ public class UsbStorageActivity extends Activity {
}
try {
- mountService.setMassStorageEnabled(false);
+ mountService.unshareVolume(
+ Environment.getExternalStorageDirectory().getPath(), "ums");
} catch (RemoteException e) {
showStoppingError();
return;