Search in sources :

Example 1 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class StorageNotification method onVolumeEjecting.

private Notification onVolumeEjecting(VolumeInfo vol) {
    final DiskInfo disk = vol.getDisk();
    final CharSequence title = mContext.getString(R.string.ext_media_unmounting_notification_title, disk.getDescription());
    final CharSequence text = mContext.getString(R.string.ext_media_unmounting_notification_message, disk.getDescription());
    return buildNotificationBuilder(vol, title, text).setCategory(Notification.CATEGORY_PROGRESS).setPriority(Notification.PRIORITY_LOW).setOngoing(true).build();
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Example 2 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class StorageNotification method onVolumeUnmountable.

private Notification onVolumeUnmountable(VolumeInfo vol) {
    final DiskInfo disk = vol.getDisk();
    final CharSequence title = mContext.getString(R.string.ext_media_unmountable_notification_title, disk.getDescription());
    final CharSequence text = mContext.getString(R.string.ext_media_unmountable_notification_message, disk.getDescription());
    return buildNotificationBuilder(vol, title, text).setContentIntent(buildInitPendingIntent(vol)).setCategory(Notification.CATEGORY_ERROR).build();
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Example 3 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

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();
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Example 4 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

the class StorageNotification method start.

@Override
public void start() {
    mNotificationManager = mContext.getSystemService(NotificationManager.class);
    mStorageManager = mContext.getSystemService(StorageManager.class);
    mStorageManager.registerListener(mListener);
    mContext.registerReceiver(mSnoozeReceiver, new IntentFilter(ACTION_SNOOZE_VOLUME), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
    mContext.registerReceiver(mFinishReceiver, new IntentFilter(ACTION_FINISH_WIZARD), android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS, null);
    // Kick current state into place
    final List<DiskInfo> disks = mStorageManager.getDisks();
    for (DiskInfo disk : disks) {
        onDiskScannedInternal(disk, disk.volumeCount);
    }
    final List<VolumeInfo> vols = mStorageManager.getVolumes();
    for (VolumeInfo vol : vols) {
        onVolumeStateChangedInternal(vol);
    }
    mContext.getPackageManager().registerMoveCallback(mMoveCallback, new Handler());
    updateMissingPrivateVolumes();
}
Also used : IntentFilter(android.content.IntentFilter) NotificationManager(android.app.NotificationManager) StorageManager(android.os.storage.StorageManager) DiskInfo(android.os.storage.DiskInfo) Handler(android.os.Handler) VolumeInfo(android.os.storage.VolumeInfo)

Example 5 with DiskInfo

use of android.os.storage.DiskInfo in project platform_frameworks_base by android.

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();
}
Also used : DiskInfo(android.os.storage.DiskInfo)

Aggregations

DiskInfo (android.os.storage.DiskInfo)51 VolumeInfo (android.os.storage.VolumeInfo)16 VolumeRecord (android.os.storage.VolumeRecord)11 File (java.io.File)6 Notification (android.app.Notification)5 Action (android.app.Notification.Action)5 NotificationManager (android.app.NotificationManager)5 PendingIntent (android.app.PendingIntent)5 IntentFilter (android.content.IntentFilter)5 Point (android.graphics.Point)5 Handler (android.os.Handler)5 IBinder (android.os.IBinder)5 RemoteCallbackList (android.os.RemoteCallbackList)5 StorageManager (android.os.storage.StorageManager)5 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)5 FileNotFoundException (java.io.FileNotFoundException)5 ArrayList (java.util.ArrayList)5 LinkedList (java.util.LinkedList)5 List (java.util.List)5 Entry (java.util.Map.Entry)5