Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31552,6 +31552,7 @@ package android.os.storage { method @Nullable public java.io.File getDirectory(); method @Nullable public String getMediaStoreVolumeName(); method public String getState(); method @Nullable public java.util.UUID getStorageUuid(); method @Nullable public String getUuid(); method public boolean isEmulated(); method public boolean isPrimary(); core/java/android/os/storage/StorageVolume.java +29 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.internal.util.Preconditions; import java.io.CharArrayWriter; import java.io.File; import java.util.Locale; import java.util.UUID; /** * Information about a shared/external storage volume for a specific user. Loading Loading @@ -98,6 +99,7 @@ public final class StorageVolume implements Parcelable { private final boolean mAllowMassStorage; private final long mMaxFileSize; private final UserHandle mOwner; private final UUID mUuid; private final String mFsUuid; private final String mState; Loading Loading @@ -133,7 +135,7 @@ public final class StorageVolume implements Parcelable { /** {@hide} */ public StorageVolume(String id, File path, File internalPath, String description, boolean primary, boolean removable, boolean emulated, boolean allowMassStorage, long maxFileSize, UserHandle owner, String fsUuid, String state) { long maxFileSize, UserHandle owner, UUID uuid, String fsUuid, String state) { mId = Preconditions.checkNotNull(id); mPath = Preconditions.checkNotNull(path); mInternalPath = Preconditions.checkNotNull(internalPath); Loading @@ -144,6 +146,7 @@ public final class StorageVolume implements Parcelable { mAllowMassStorage = allowMassStorage; mMaxFileSize = maxFileSize; mOwner = Preconditions.checkNotNull(owner); mUuid = uuid; mFsUuid = fsUuid; mState = Preconditions.checkNotNull(state); } Loading @@ -159,6 +162,11 @@ public final class StorageVolume implements Parcelable { mAllowMassStorage = in.readInt() != 0; mMaxFileSize = in.readLong(); mOwner = in.readParcelable(null); if (in.readInt() != 0) { mUuid = StorageManager.convert(in.readString()); } else { mUuid = null; } mFsUuid = in.readString8(); mState = in.readString8(); } Loading Loading @@ -287,6 +295,20 @@ public final class StorageVolume implements Parcelable { return mOwner; } /** * Gets the converted volume UUID. If a valid UUID is returned, it is compatible with other * APIs that make use of {@link UUID} like {@link StorageManager#allocateBytes} and * {@link android.content.pm.ApplicationInfo#storageUuid} * * @return the UUID for the volume or {@code null} for "portable" storage devices which haven't * been adopted. * * @see <a href="https://source.android.com/devices/storage/adoptable">Adoptable storage</a> */ public @Nullable UUID getStorageUuid() { return mUuid; } /** * Gets the volume UUID, if any. */ Loading Loading @@ -513,6 +535,12 @@ public final class StorageVolume implements Parcelable { parcel.writeInt(mAllowMassStorage ? 1 : 0); parcel.writeLong(mMaxFileSize); parcel.writeParcelable(mOwner, flags); if (mUuid != null) { parcel.writeInt(1); parcel.writeString8(StorageManager.convert(mUuid)); } else { parcel.writeInt(0); } parcel.writeString8(mFsUuid); parcel.writeString8(mState); } Loading core/java/android/os/storage/VolumeInfo.java +6 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import java.io.File; import java.util.Comparator; import java.util.Locale; import java.util.Objects; import java.util.UUID; /** * Information about a storage volume that may be mounted. A volume may be a Loading Loading @@ -401,6 +402,7 @@ public class VolumeInfo implements Parcelable { } String description = null; UUID uuid = null; String derivedFsUuid = fsUuid; long maxFileSize = 0; Loading @@ -410,7 +412,10 @@ public class VolumeInfo implements Parcelable { final VolumeInfo privateVol = storage.findPrivateForEmulated(this); if (privateVol != null) { description = storage.getBestVolumeDescription(privateVol); uuid = StorageManager.convert(privateVol.fsUuid); derivedFsUuid = privateVol.fsUuid; } else { uuid = StorageManager.UUID_DEFAULT; } if (isPrimaryEmulatedForUser(userId)) { Loading Loading @@ -439,7 +444,7 @@ public class VolumeInfo implements Parcelable { return new StorageVolume(id, userPath, internalPath, description, isPrimary(), removable, emulated, allowMassStorage, maxFileSize, new UserHandle(userId), derivedFsUuid, envState); uuid, derivedFsUuid, envState); } @UnsupportedAppUsage Loading core/java/android/os/storage/VolumeRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class VolumeRecord implements Parcelable { } return new StorageVolume(id, userPath, internalPath, description, primary, removable, emulated, allowMassStorage, maxFileSize, user, fsUuid, envState); emulated, allowMassStorage, maxFileSize, user, null /* uuid */, fsUuid, envState); } public void dump(IndentingPrintWriter pw) { Loading media/tests/MtpTests/src/android/mtp/MtpDatabaseTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ public class MtpDatabaseTest { StorageVolume mainStorage = new StorageVolume(MAIN_STORAGE_ID_STR, mMainStorageDir, mMainStorageDir, "Primary Storage", true, false, true, false, -1, UserHandle.CURRENT, "", ""); true, false, true, false, -1, UserHandle.CURRENT, null /* uuid */, "", ""); final StorageVolume primary = mainStorage; Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31552,6 +31552,7 @@ package android.os.storage { method @Nullable public java.io.File getDirectory(); method @Nullable public String getMediaStoreVolumeName(); method public String getState(); method @Nullable public java.util.UUID getStorageUuid(); method @Nullable public String getUuid(); method public boolean isEmulated(); method public boolean isPrimary();
core/java/android/os/storage/StorageVolume.java +29 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.internal.util.Preconditions; import java.io.CharArrayWriter; import java.io.File; import java.util.Locale; import java.util.UUID; /** * Information about a shared/external storage volume for a specific user. Loading Loading @@ -98,6 +99,7 @@ public final class StorageVolume implements Parcelable { private final boolean mAllowMassStorage; private final long mMaxFileSize; private final UserHandle mOwner; private final UUID mUuid; private final String mFsUuid; private final String mState; Loading Loading @@ -133,7 +135,7 @@ public final class StorageVolume implements Parcelable { /** {@hide} */ public StorageVolume(String id, File path, File internalPath, String description, boolean primary, boolean removable, boolean emulated, boolean allowMassStorage, long maxFileSize, UserHandle owner, String fsUuid, String state) { long maxFileSize, UserHandle owner, UUID uuid, String fsUuid, String state) { mId = Preconditions.checkNotNull(id); mPath = Preconditions.checkNotNull(path); mInternalPath = Preconditions.checkNotNull(internalPath); Loading @@ -144,6 +146,7 @@ public final class StorageVolume implements Parcelable { mAllowMassStorage = allowMassStorage; mMaxFileSize = maxFileSize; mOwner = Preconditions.checkNotNull(owner); mUuid = uuid; mFsUuid = fsUuid; mState = Preconditions.checkNotNull(state); } Loading @@ -159,6 +162,11 @@ public final class StorageVolume implements Parcelable { mAllowMassStorage = in.readInt() != 0; mMaxFileSize = in.readLong(); mOwner = in.readParcelable(null); if (in.readInt() != 0) { mUuid = StorageManager.convert(in.readString()); } else { mUuid = null; } mFsUuid = in.readString8(); mState = in.readString8(); } Loading Loading @@ -287,6 +295,20 @@ public final class StorageVolume implements Parcelable { return mOwner; } /** * Gets the converted volume UUID. If a valid UUID is returned, it is compatible with other * APIs that make use of {@link UUID} like {@link StorageManager#allocateBytes} and * {@link android.content.pm.ApplicationInfo#storageUuid} * * @return the UUID for the volume or {@code null} for "portable" storage devices which haven't * been adopted. * * @see <a href="https://source.android.com/devices/storage/adoptable">Adoptable storage</a> */ public @Nullable UUID getStorageUuid() { return mUuid; } /** * Gets the volume UUID, if any. */ Loading Loading @@ -513,6 +535,12 @@ public final class StorageVolume implements Parcelable { parcel.writeInt(mAllowMassStorage ? 1 : 0); parcel.writeLong(mMaxFileSize); parcel.writeParcelable(mOwner, flags); if (mUuid != null) { parcel.writeInt(1); parcel.writeString8(StorageManager.convert(mUuid)); } else { parcel.writeInt(0); } parcel.writeString8(mFsUuid); parcel.writeString8(mState); } Loading
core/java/android/os/storage/VolumeInfo.java +6 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import java.io.File; import java.util.Comparator; import java.util.Locale; import java.util.Objects; import java.util.UUID; /** * Information about a storage volume that may be mounted. A volume may be a Loading Loading @@ -401,6 +402,7 @@ public class VolumeInfo implements Parcelable { } String description = null; UUID uuid = null; String derivedFsUuid = fsUuid; long maxFileSize = 0; Loading @@ -410,7 +412,10 @@ public class VolumeInfo implements Parcelable { final VolumeInfo privateVol = storage.findPrivateForEmulated(this); if (privateVol != null) { description = storage.getBestVolumeDescription(privateVol); uuid = StorageManager.convert(privateVol.fsUuid); derivedFsUuid = privateVol.fsUuid; } else { uuid = StorageManager.UUID_DEFAULT; } if (isPrimaryEmulatedForUser(userId)) { Loading Loading @@ -439,7 +444,7 @@ public class VolumeInfo implements Parcelable { return new StorageVolume(id, userPath, internalPath, description, isPrimary(), removable, emulated, allowMassStorage, maxFileSize, new UserHandle(userId), derivedFsUuid, envState); uuid, derivedFsUuid, envState); } @UnsupportedAppUsage Loading
core/java/android/os/storage/VolumeRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class VolumeRecord implements Parcelable { } return new StorageVolume(id, userPath, internalPath, description, primary, removable, emulated, allowMassStorage, maxFileSize, user, fsUuid, envState); emulated, allowMassStorage, maxFileSize, user, null /* uuid */, fsUuid, envState); } public void dump(IndentingPrintWriter pw) { Loading
media/tests/MtpTests/src/android/mtp/MtpDatabaseTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ public class MtpDatabaseTest { StorageVolume mainStorage = new StorageVolume(MAIN_STORAGE_ID_STR, mMainStorageDir, mMainStorageDir, "Primary Storage", true, false, true, false, -1, UserHandle.CURRENT, "", ""); true, false, true, false, -1, UserHandle.CURRENT, null /* uuid */, "", ""); final StorageVolume primary = mainStorage; Loading