| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.mtp; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
import android.os.storage.StorageVolume; |
| 21 |
|
| 22 |
import java.util.function.Supplier; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public class MtpStorage { |
| 32 |
private final int mStorageId; |
| 33 |
private final String mPath; |
| 34 |
private final String mDescription; |
| 35 |
private final boolean mRemovable; |
| 36 |
private final long mMaxFileSize; |
| 37 |
private final String mVolumeName; |
| 38 |
private final Supplier<Boolean> mIsHostWindows; |
| 39 |
|
| 40 |
public MtpStorage(StorageVolume volume, int storageId, Supplier<Boolean> isHostWindows) { |
| 41 |
mStorageId = storageId; |
| 42 |
mPath = volume.getPath(); |
| 43 |
mDescription = volume.getDescription(null); |
| 44 |
mRemovable = volume.isRemovable(); |
| 45 |
mMaxFileSize = volume.getMaxFileSize(); |
| 46 |
mVolumeName = volume.getMediaStoreVolumeName(); |
| 47 |
mIsHostWindows = isHostWindows; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
@UnsupportedAppUsage |
| 56 |
public final int getStorageId() { |
| 57 |
return mStorageId; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
@UnsupportedAppUsage |
| 66 |
public final String getPath() { |
| 67 |
return mPath; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public final String getDescription() { |
| 76 |
return mDescription; |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public final boolean isRemovable() { |
| 85 |
return mRemovable; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
public long getMaxFileSize() { |
| 94 |
return mMaxFileSize; |
| 95 |
} |
| 96 |
|
| 97 |
public String getVolumeName() { |
| 98 |
return mVolumeName; |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
public boolean isHostWindows() { |
| 107 |
return mIsHostWindows.get(); |
| 108 |
} |
| 109 |
} |