diff options
Diffstat (limited to 'core/java/android/os/storage/DiskInfo.java')
-rw-r--r-- | core/java/android/os/storage/DiskInfo.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/core/java/android/os/storage/DiskInfo.java b/core/java/android/os/storage/DiskInfo.java index 4704b67..dc96640 100644 --- a/core/java/android/os/storage/DiskInfo.java +++ b/core/java/android/os/storage/DiskInfo.java @@ -16,6 +16,7 @@ package android.os.storage; +import android.annotation.NonNull; import android.content.res.Resources; import android.os.Parcel; import android.os.Parcelable; @@ -33,6 +34,8 @@ import java.io.CharArrayWriter; * @hide */ public class DiskInfo implements Parcelable { + public static final String EXTRA_DISK_ID = "android.os.storage.extra.DISK_ID"; + public static final int FLAG_ADOPTABLE = 1 << 0; public static final int FLAG_DEFAULT_PRIMARY = 1 << 1; public static final int FLAG_SD = 1 << 2; @@ -42,7 +45,7 @@ public class DiskInfo implements Parcelable { public final int flags; public long size; public String label; - public String[] volumes; + public String[] volumeIds; public DiskInfo(String id, int flags) { this.id = Preconditions.checkNotNull(id); @@ -54,7 +57,11 @@ public class DiskInfo implements Parcelable { flags = parcel.readInt(); size = parcel.readLong(); label = parcel.readString(); - volumes = parcel.readStringArray(); + volumeIds = parcel.readStringArray(); + } + + public @NonNull String getId() { + return id; } public String getDescription() { @@ -68,6 +75,18 @@ public class DiskInfo implements Parcelable { } } + public boolean isSd() { + return (flags & FLAG_SD) != 0; + } + + public boolean isUsb() { + return (flags & FLAG_USB) != 0; + } + + public boolean isAdoptable() { + return (flags & FLAG_ADOPTABLE) != 0; + } + @Override public String toString() { final CharArrayWriter writer = new CharArrayWriter(); @@ -82,7 +101,7 @@ public class DiskInfo implements Parcelable { pw.printPair("flags", DebugUtils.flagsToString(getClass(), "FLAG_", flags)); pw.printPair("size", size); pw.printPair("label", label); - pw.printPair("volumes", volumes); + pw.printPair("volumeIds", volumeIds); pw.decreaseIndent(); pw.println(); } @@ -122,6 +141,6 @@ public class DiskInfo implements Parcelable { parcel.writeInt(this.flags); parcel.writeLong(size); parcel.writeString(label); - parcel.writeStringArray(volumes); + parcel.writeStringArray(volumeIds); } } |