diff options
author | Makoto Onuki <omakoto@google.com> | 2015-06-29 16:56:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-29 16:56:09 +0000 |
commit | cadf3969c313bd0e354157eef9e0bcc552cb0c8a (patch) | |
tree | bbd82d67ba7b62eee237b005e90a43267d0db753 | |
parent | b05e2286a9c4517480aca398fcc2e0ee55dfb6ed (diff) | |
parent | b138cb2c0df9e35d2f7683d529a67f8d8b64133c (diff) | |
download | frameworks_base-cadf3969c313bd0e354157eef9e0bcc552cb0c8a.zip frameworks_base-cadf3969c313bd0e354157eef9e0bcc552cb0c8a.tar.gz frameworks_base-cadf3969c313bd0e354157eef9e0bcc552cb0c8a.tar.bz2 |
Merge "Notification for non-adopotable disks shouldn't be snoozed" into mnc-dev
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index d360875..92cfaa1 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -318,11 +318,14 @@ public class StorageNotification extends SystemUI { private Notification onVolumeMounted(VolumeInfo vol) { final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid()); + final DiskInfo disk = vol.getDisk(); - // Don't annoy when user dismissed in past - if (rec.isSnoozed()) return null; + // Don't annoy when user dismissed in past. (But make sure the disk is adoptable; we + // used to allow snoozing non-adoptable disks too.) + if (rec.isSnoozed() && disk.isAdoptable()) { + return null; + } - final DiskInfo disk = vol.getDisk(); if (disk.isAdoptable() && !rec.isInited()) { final CharSequence title = disk.getDescription(); final CharSequence text = mContext.getString( @@ -346,7 +349,7 @@ public class StorageNotification extends SystemUI { R.string.ext_media_ready_notification_message, disk.getDescription()); final PendingIntent browseIntent = buildBrowsePendingIntent(vol); - return buildNotificationBuilder(vol, title, text) + final Notification.Builder builder = buildNotificationBuilder(vol, title, text) .addAction(new Action(R.drawable.ic_folder_24dp, mContext.getString(R.string.ext_media_browse_action), browseIntent)) @@ -354,10 +357,14 @@ public class StorageNotification extends SystemUI { mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))) .setContentIntent(browseIntent) - .setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())) .setCategory(Notification.CATEGORY_SYSTEM) - .setPriority(Notification.PRIORITY_LOW) - .build(); + .setPriority(Notification.PRIORITY_LOW); + // Non-adoptable disks can't be snoozed. + if (disk.isAdoptable()) { + builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())); + } + + return builder.build(); } } |