Methods Summary |
---|
public boolean | allowMassStorage()Returns true if this volume can be shared via USB mass storage.
return mAllowMassStorage;
|
public int | describeContents()
return 0;
|
public void | dump(com.android.internal.util.IndentingPrintWriter pw)
pw.println("StorageVolume:");
pw.increaseIndent();
pw.printPair("mStorageId", mStorageId);
pw.printPair("mPath", mPath);
pw.printPair("mDescriptionId", mDescriptionId);
pw.printPair("mPrimary", mPrimary);
pw.printPair("mRemovable", mRemovable);
pw.printPair("mEmulated", mEmulated);
pw.printPair("mMtpReserveSpace", mMtpReserveSpace);
pw.printPair("mAllowMassStorage", mAllowMassStorage);
pw.printPair("mMaxFileSize", mMaxFileSize);
pw.printPair("mOwner", mOwner);
pw.printPair("mUuid", mUuid);
pw.printPair("mUserLabel", mUserLabel);
pw.printPair("mState", mState);
pw.decreaseIndent();
|
public boolean | equals(java.lang.Object obj)
if (obj instanceof StorageVolume && mPath != null) {
StorageVolume volume = (StorageVolume)obj;
return (mPath.equals(volume.mPath));
}
return false;
|
public static android.os.storage.StorageVolume | fromTemplate(android.os.storage.StorageVolume template, java.io.File path, android.os.UserHandle owner)
return new StorageVolume(path, template.mDescriptionId, template.mPrimary,
template.mRemovable, template.mEmulated, template.mMtpReserveSpace,
template.mAllowMassStorage, template.mMaxFileSize, owner);
|
public java.lang.String | getDescription(android.content.Context context)Returns a user visible description of the volume.
return context.getResources().getString(mDescriptionId);
|
public int | getDescriptionId()
return mDescriptionId;
|
public int | getFatVolumeId()Parse and return volume UUID as FAT volume ID, or return -1 if unable to
parse or UUID is unknown.
if (mUuid == null || mUuid.length() != 9) {
return -1;
}
try {
return (int)Long.parseLong(mUuid.replace("-", ""), 16);
} catch (NumberFormatException e) {
return -1;
}
|
public long | getMaxFileSize()Returns maximum file size for the volume, or zero if it is unbounded.
return mMaxFileSize;
|
public int | getMtpReserveSpace()Number of megabytes of space to leave unallocated by MTP.
MTP will subtract this value from the free space it reports back
to the host via GetStorageInfo, and will not allow new files to
be added via MTP if there is less than this amount left free in the storage.
If MTP has dedicated storage this value should be zero, but if MTP is
sharing storage with the rest of the system, set this to a positive value
to ensure that MTP activity does not result in the storage being
too close to full.
return mMtpReserveSpace;
|
public android.os.UserHandle | getOwner()
return mOwner;
|
public java.lang.String | getPath()Returns the mount path for the volume.
return mPath.toString();
|
public java.io.File | getPathFile()
return mPath;
|
public java.lang.String | getState()
return mState;
|
public int | getStorageId()Returns the MTP storage ID for the volume.
this is also used for the storage_id column in the media provider.
return mStorageId;
|
public java.lang.String | getUserLabel()
return mUserLabel;
|
public java.lang.String | getUuid()
return mUuid;
|
public int | hashCode()
return mPath.hashCode();
|
public boolean | isEmulated()Returns true if the volume is emulated.
return mEmulated;
|
public boolean | isPrimary()
return mPrimary;
|
public boolean | isRemovable()Returns true if the volume is removable.
return mRemovable;
|
public void | setState(java.lang.String state)
mState = state;
|
public void | setStorageId(int index)Do not call this unless you are MountService
// storage ID is 0x00010001 for primary storage,
// then 0x00020001, 0x00030001, etc. for secondary storages
mStorageId = ((index + 1) << 16) + 1;
|
public void | setUserLabel(java.lang.String userLabel)
mUserLabel = userLabel;
|
public void | setUuid(java.lang.String uuid)
mUuid = uuid;
|
public java.lang.String | toString()
final CharArrayWriter writer = new CharArrayWriter();
dump(new IndentingPrintWriter(writer, " ", 80));
return writer.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeInt(mStorageId);
parcel.writeString(mPath.toString());
parcel.writeInt(mDescriptionId);
parcel.writeInt(mPrimary ? 1 : 0);
parcel.writeInt(mRemovable ? 1 : 0);
parcel.writeInt(mEmulated ? 1 : 0);
parcel.writeInt(mMtpReserveSpace);
parcel.writeInt(mAllowMassStorage ? 1 : 0);
parcel.writeLong(mMaxFileSize);
parcel.writeParcelable(mOwner, flags);
parcel.writeString(mUuid);
parcel.writeString(mUserLabel);
parcel.writeString(mState);
|