diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-04-18 01:12:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-18 01:12:25 +0000 |
commit | 6b875a7497181f6d22e5d693e27b8c0e8d0b727a (patch) | |
tree | 48e7ec066ce1eead0b1772197bc5698667759d0e /packages/SystemUI | |
parent | 6c589570c44752d96f35620de271ccae7d32502d (diff) | |
parent | 7e92ef3a1146102806fa0543ef12e09231c55639 (diff) | |
download | frameworks_base-6b875a7497181f6d22e5d693e27b8c0e8d0b727a.zip frameworks_base-6b875a7497181f6d22e5d693e27b8c0e8d0b727a.tar.gz frameworks_base-6b875a7497181f6d22e5d693e27b8c0e8d0b727a.tar.bz2 |
Merge "Volumes know parent disks; unsupported disks."
Diffstat (limited to 'packages/SystemUI')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 818f5ee..4a441c7 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -107,8 +107,8 @@ public class StorageNotification extends SystemUI { case VolumeInfo.STATE_UNMOUNTED: onVolumeUnmounted(vol); break; - case VolumeInfo.STATE_MOUNTING: - onVolumeMounting(vol); + case VolumeInfo.STATE_CHECKING: + onVolumeChecking(vol); break; case VolumeInfo.STATE_MOUNTED: onVolumeMounted(vol); @@ -116,8 +116,8 @@ public class StorageNotification extends SystemUI { case VolumeInfo.STATE_FORMATTING: onVolumeFormatting(vol); break; - case VolumeInfo.STATE_UNMOUNTING: - onVolumeUnmounting(vol); + case VolumeInfo.STATE_EJECTING: + onVolumeEjecting(vol); break; case VolumeInfo.STATE_UNMOUNTABLE: onVolumeUnmountable(vol); @@ -125,6 +125,9 @@ public class StorageNotification extends SystemUI { case VolumeInfo.STATE_REMOVED: onVolumeRemoved(vol); break; + case VolumeInfo.STATE_BAD_REMOVAL: + onVolumeBadRemoval(vol); + break; } } @@ -132,7 +135,7 @@ public class StorageNotification extends SystemUI { // Ignored } - private void onVolumeMounting(VolumeInfo vol) { + private void onVolumeChecking(VolumeInfo vol) { final DiskInfo disk = mStorageManager.findDiskById(vol.getDiskId()); final CharSequence title = mContext.getString( R.string.ext_media_checking_notification_title, disk.getDescription()); @@ -194,7 +197,7 @@ public class StorageNotification extends SystemUI { // Ignored } - private void onVolumeUnmounting(VolumeInfo vol) { + private void onVolumeEjecting(VolumeInfo vol) { final DiskInfo disk = mStorageManager.findDiskById(vol.getDiskId()); final CharSequence title = mContext.getString( R.string.ext_media_unmounting_notification_title, disk.getDescription()); @@ -247,6 +250,26 @@ public class StorageNotification extends SystemUI { mNotificationManager.notifyAsUser(vol.getId(), NOTIF_ID, notif, UserHandle.ALL); } + private void onVolumeBadRemoval(VolumeInfo vol) { + if (!vol.isPrimary()) { + // Ignore non-primary media + return; + } + + final DiskInfo disk = mStorageManager.findDiskById(vol.getDiskId()); + final CharSequence title = mContext.getString( + R.string.ext_media_badremoval_notification_title, disk.getDescription()); + final CharSequence text = mContext.getString( + R.string.ext_media_badremoval_notification_message, disk.getDescription()); + + final Notification notif = buildNotificationBuilder(title, text) + .setSmallIcon(R.drawable.stat_notify_sdcard) + .setCategory(Notification.CATEGORY_ERROR) + .build(); + + mNotificationManager.notifyAsUser(vol.getId(), NOTIF_ID, notif, UserHandle.ALL); + } + private Notification.Builder buildNotificationBuilder(CharSequence title, CharSequence text) { return new Notification.Builder(mContext) .setColor(mContext.getColor(R.color.system_notification_accent_color)) |