summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/usb
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2014-08-12 22:21:09 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-12 22:21:09 +0000
commit51886f3125c74ceab38c8c0239dfcb98fc10a9ad (patch)
tree7951af7b20c74a95c43251235477c4a0c8081c5f /packages/SystemUI/src/com/android/systemui/usb
parentec05f2cce4e20bdd0f4a2f49a63dacb0dd967d21 (diff)
parent840e932584b4d03f39ba17da57b92b1d1878b21d (diff)
downloadframeworks_base-51886f3125c74ceab38c8c0239dfcb98fc10a9ad.zip
frameworks_base-51886f3125c74ceab38c8c0239dfcb98fc10a9ad.tar.gz
frameworks_base-51886f3125c74ceab38c8c0239dfcb98fc10a9ad.tar.bz2
am 840e9325: am 2013cb1f: Merge "Prevent system_server shutdown when trying to format external storage"
* commit '840e932584b4d03f39ba17da57b92b1d1878b21d': Prevent system_server shutdown when trying to format external storage
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/usb')
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 481266b..dd4c34c 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -28,6 +28,7 @@ import android.os.HandlerThread;
import android.os.UserHandle;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
+import android.os.storage.StorageVolume;
import android.provider.Settings;
import android.util.Log;
@@ -198,6 +199,8 @@ public class StorageNotification extends SystemUI {
*/
Intent intent = new Intent();
intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class);
+ intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME,
+ getVolumeByPath(mStorageManager.getVolumeList(), path));
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
setMediaStorageNotification(
@@ -212,6 +215,8 @@ public class StorageNotification extends SystemUI {
*/
Intent intent = new Intent();
intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class);
+ intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME,
+ getVolumeByPath(mStorageManager.getVolumeList(), path));
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
setMediaStorageNotification(
@@ -247,6 +252,19 @@ public class StorageNotification extends SystemUI {
}
/**
+ * Get the corresponding StorageVolume object for a specific path.
+ */
+ private final StorageVolume getVolumeByPath(StorageVolume[] volumes, String path) {
+ for (StorageVolume volume : volumes) {
+ if (volume.getPath().equals(path)) {
+ return volume;
+ }
+ }
+ Log.w(TAG, "No storage found");
+ return null;
+ }
+
+ /**
* Update the state of the USB mass storage notification
*/
void updateUsbMassStorageNotification(boolean available) {