Merge "If a Disk goes away, remove the notifications that asks the user to format it." into nyc-dev
am: 75a19a6
* commit '75a19a6fcac7b410e2ff98d11c23071ac2f6b2a1':
If a Disk goes away, remove the notifications that asks the user to format it.
Change-Id: Id8ed9cfc7c6d6f2ef9d6338a165db4c2b619720f
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.usb;
|
package com.android.systemui.usb;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.Notification.Action;
|
import android.app.Notification.Action;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@@ -97,6 +98,11 @@ public class StorageNotification extends SystemUI {
|
|||||||
public void onDiskScanned(DiskInfo disk, int volumeCount) {
|
public void onDiskScanned(DiskInfo disk, int volumeCount) {
|
||||||
onDiskScannedInternal(disk, volumeCount);
|
onDiskScannedInternal(disk, volumeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDiskDestroyed(DiskInfo disk) {
|
||||||
|
onDiskDestroyedInternal(disk);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final BroadcastReceiver mSnoozeReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mSnoozeReceiver = new BroadcastReceiver() {
|
||||||
@@ -238,6 +244,15 @@ public class StorageNotification extends SystemUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all notifications for a disk when it goes away.
|
||||||
|
*
|
||||||
|
* @param disk The disk that went away.
|
||||||
|
*/
|
||||||
|
private void onDiskDestroyedInternal(@NonNull DiskInfo disk) {
|
||||||
|
mNotificationManager.cancelAsUser(disk.getId(), DISK_ID, UserHandle.ALL);
|
||||||
|
}
|
||||||
|
|
||||||
private void onVolumeStateChangedInternal(VolumeInfo vol) {
|
private void onVolumeStateChangedInternal(VolumeInfo vol) {
|
||||||
switch (vol.getType()) {
|
switch (vol.getType()) {
|
||||||
case VolumeInfo.TYPE_PRIVATE:
|
case VolumeInfo.TYPE_PRIVATE:
|
||||||
|
|||||||
Reference in New Issue
Block a user