summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-05-19 14:42:38 -0700
committerJeff Sharkey <jsharkey@android.com>2015-05-19 14:57:22 -0700
commitf5a6bd7538a6800c2a43ace5ad67d65b1f8f697a (patch)
tree9c57f22fd4c22adac7914a0dcacfa25dca7e6969 /packages/SystemUI/src
parentdb6dab359c0ab6e5ef3d2702c717e6f5908b8e3b (diff)
downloadframeworks_base-f5a6bd7538a6800c2a43ace5ad67d65b1f8f697a.zip
frameworks_base-f5a6bd7538a6800c2a43ace5ad67d65b1f8f697a.tar.gz
frameworks_base-f5a6bd7538a6800c2a43ace5ad67d65b1f8f697a.tar.bz2
Push initial disk state, handle empty media.
Stash volume count from last scan, and use it to push initial storage notifications state when listener is first attached. Also omit disks with invalid size, which usually means they're an empty slot with no media. Bug: 20503551 Change-Id: I75097035aebaad70ba32437179a863f6a0910aa5
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 23813d1..ad21555 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -148,6 +148,11 @@ public class StorageNotification extends SystemUI {
android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
// Kick current state into place
+ final List<DiskInfo> disks = mStorageManager.getDisks();
+ for (DiskInfo disk : disks) {
+ onDiskScannedInternal(disk, disk.volumeCount);
+ }
+
final List<VolumeInfo> vols = mStorageManager.getVolumes();
for (VolumeInfo vol : vols) {
onVolumeStateChangedInternal(vol);
@@ -194,7 +199,7 @@ public class StorageNotification extends SystemUI {
}
private void onDiskScannedInternal(DiskInfo disk, int volumeCount) {
- if (volumeCount == 0) {
+ if (volumeCount == 0 && disk.size > 0) {
// No supported volumes found, give user option to format
final CharSequence title = mContext.getString(
R.string.ext_media_unmountable_notification_title, disk.getDescription());