diff options
author | San Mehat <san@google.com> | 2010-01-29 05:34:01 -0800 |
---|---|---|
committer | San Mehat <san@google.com> | 2010-02-02 11:17:46 -0800 |
commit | ec7f7e6378f87cdc826a8b5d836fff26f44b0b09 (patch) | |
tree | 1395f01566dfeec8bfaa2d3b488ab60c7693c5f6 /core/java/com | |
parent | b339ac3d3e23713640aa9615dec84cff7ef727d6 (diff) | |
download | frameworks_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.java | 15 |
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; |