use of android.os.storage.DiskInfo in project android_frameworks_base by DirtyUnicorns.
the class StorageNotification method onVolumeMounted.
private Notification onVolumeMounted(VolumeInfo vol) {
final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
final DiskInfo disk = vol.getDisk();
// used to allow snoozing non-adoptable disks too.)
if (rec.isSnoozed() && disk.isAdoptable()) {
return null;
}
if (disk.isAdoptable() && !rec.isInited()) {
final CharSequence title = disk.getDescription();
final CharSequence text = mContext.getString(R.string.ext_media_new_notification_message, disk.getDescription());
final PendingIntent initIntent = buildInitPendingIntent(vol);
return buildNotificationBuilder(vol, title, text).addAction(new Action(R.drawable.ic_settings_24dp, mContext.getString(R.string.ext_media_init_action), initIntent)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(initIntent).setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())).setCategory(Notification.CATEGORY_SYSTEM).build();
} else {
final CharSequence title = disk.getDescription();
final CharSequence text = mContext.getString(R.string.ext_media_ready_notification_message, disk.getDescription());
final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
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)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(browseIntent).setCategory(Notification.CATEGORY_SYSTEM).setPriority(Notification.PRIORITY_LOW);
// Non-adoptable disks can't be snoozed.
if (disk.isAdoptable()) {
builder.setDeleteIntent(buildSnoozeIntent(vol.getFsUuid()));
}
return builder.build();
}
}
use of android.os.storage.DiskInfo in project android_frameworks_base by DirtyUnicorns.
the class StorageNotification method onVolumeRemoved.
private Notification onVolumeRemoved(VolumeInfo vol) {
if (!vol.isPrimary()) {
// Ignore non-primary media
return null;
}
final DiskInfo disk = vol.getDisk();
final CharSequence title = mContext.getString(R.string.ext_media_nomedia_notification_title, disk.getDescription());
final CharSequence text = mContext.getString(R.string.ext_media_nomedia_notification_message, disk.getDescription());
return buildNotificationBuilder(vol, title, text).setCategory(Notification.CATEGORY_ERROR).build();
}
use of android.os.storage.DiskInfo in project android_frameworks_base by ResurrectionRemix.
the class StorageNotification method onVolumeMounted.
private Notification onVolumeMounted(VolumeInfo vol) {
final VolumeRecord rec = mStorageManager.findRecordByUuid(vol.getFsUuid());
final DiskInfo disk = vol.getDisk();
// used to allow snoozing non-adoptable disks too.)
if (rec.isSnoozed() && disk.isAdoptable()) {
return null;
}
if (disk.isAdoptable() && !rec.isInited()) {
final CharSequence title = disk.getDescription();
final CharSequence text = mContext.getString(R.string.ext_media_new_notification_message, disk.getDescription());
final PendingIntent initIntent = buildInitPendingIntent(vol);
return buildNotificationBuilder(vol, title, text).addAction(new Action(R.drawable.ic_settings_24dp, mContext.getString(R.string.ext_media_init_action), initIntent)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(initIntent).setDeleteIntent(buildSnoozeIntent(vol.getFsUuid())).setCategory(Notification.CATEGORY_SYSTEM).build();
} else {
final CharSequence title = disk.getDescription();
final CharSequence text = mContext.getString(R.string.ext_media_ready_notification_message, disk.getDescription());
final PendingIntent browseIntent = buildBrowsePendingIntent(vol);
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)).addAction(new Action(R.drawable.ic_eject_24dp, mContext.getString(R.string.ext_media_unmount_action), buildUnmountPendingIntent(vol))).setContentIntent(browseIntent).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()));
}
return builder.build();
}
}
use of android.os.storage.DiskInfo in project android_frameworks_base by ResurrectionRemix.
the class StorageNotification method onVolumeBadRemoval.
private Notification onVolumeBadRemoval(VolumeInfo vol) {
if (!vol.isPrimary()) {
// Ignore non-primary media
return null;
}
final DiskInfo disk = vol.getDisk();
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());
return buildNotificationBuilder(vol, title, text).setCategory(Notification.CATEGORY_ERROR).build();
}
use of android.os.storage.DiskInfo in project android_frameworks_base by ResurrectionRemix.
the class StorageNotification method onVolumeChecking.
private Notification onVolumeChecking(VolumeInfo vol) {
final DiskInfo disk = vol.getDisk();
final CharSequence title = mContext.getString(R.string.ext_media_checking_notification_title, disk.getDescription());
final CharSequence text = mContext.getString(R.string.ext_media_checking_notification_message, disk.getDescription());
return buildNotificationBuilder(vol, title, text).setCategory(Notification.CATEGORY_PROGRESS).setPriority(Notification.PRIORITY_LOW).setOngoing(true).build();
}
Aggregations