am 891230b5: Merge "Push initial disk state, handle empty media." into mnc-dev
* commit '891230b59e36f8220885d6c1f5c9be98370ee2ca': Push initial disk state, handle empty media.
This commit is contained in:
@@ -50,6 +50,8 @@ public class DiskInfo implements Parcelable {
|
||||
public final int flags;
|
||||
public long size;
|
||||
public String label;
|
||||
/** Hacky; don't rely on this count */
|
||||
public int volumeCount;
|
||||
|
||||
public DiskInfo(String id, int flags) {
|
||||
this.id = Preconditions.checkNotNull(id);
|
||||
@@ -61,6 +63,7 @@ public class DiskInfo implements Parcelable {
|
||||
flags = parcel.readInt();
|
||||
size = parcel.readLong();
|
||||
label = parcel.readString();
|
||||
volumeCount = parcel.readInt();
|
||||
}
|
||||
|
||||
public @NonNull String getId() {
|
||||
@@ -181,5 +184,6 @@ public class DiskInfo implements Parcelable {
|
||||
parcel.writeInt(this.flags);
|
||||
parcel.writeLong(size);
|
||||
parcel.writeString(label);
|
||||
parcel.writeInt(volumeCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,11 @@ public class StorageNotification extends SystemUI {
|
||||
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);
|
||||
@@ -194,7 +199,7 @@ public class StorageNotification extends SystemUI {
|
||||
}
|
||||
|
||||
private void onDiskScannedInternal(DiskInfo disk, int volumeCount) {
|
||||
if (volumeCount == 0) {
|
||||
if (volumeCount == 0 && disk.size > 0) {
|
||||
// No supported volumes found, give user option to format
|
||||
final CharSequence title = mContext.getString(
|
||||
R.string.ext_media_unmountable_notification_title, disk.getDescription());
|
||||
|
||||
@@ -973,6 +973,7 @@ class MountService extends IMountService.Stub
|
||||
}
|
||||
}
|
||||
|
||||
disk.volumeCount = volumeCount;
|
||||
mCallbacks.notifyDiskScanned(disk, volumeCount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user