OSDN Git Service

SystemUI: Restrict persistent USB drive notifications to USB disks
authorAdrianDC <radian.dc@gmail.com>
Tue, 28 Jun 2016 14:20:28 +0000 (16:20 +0200)
committerSteve Kondik <steve@cyngn.com>
Tue, 13 Sep 2016 07:12:33 +0000 (00:12 -0700)
 * Without the addition of the isUsb check, a regular FAT32 MicroSD
    would have a persistent notification that is unwished

Change-Id: I396a861702674d0a6a70beb5206fb4c7374ec85d

packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java

index b9c4930..45ff3c2 100644 (file)
@@ -374,10 +374,13 @@ public class StorageNotification extends SystemUI {
                             mContext.getString(R.string.ext_media_unmount_action),
                             buildUnmountPendingIntent(vol)))
                     .setContentIntent(browseIntent)
-                    .setOngoing(mContext.getResources().getBoolean(
-                            R.bool.config_persistUsbDriveNotification))
                     .setCategory(Notification.CATEGORY_SYSTEM)
                     .setPriority(Notification.PRIORITY_LOW);
+            // USB disks notification can be persistent
+            if (disk.isUsb()) {
+                builder.setOngoing(mContext.getResources().getBoolean(
+                        R.bool.config_persistUsbDriveNotification));
+            }
             // Non-adoptable disks can't be snoozed.
             if (disk.isAdoptable()) {
                 builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));