summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-06-07 12:44:52 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-07 12:44:52 -0700
commit65abc4531f1222ffa04350a3afc6d61fcc77b2a3 (patch)
tree933c9e581180dac18434f1573e3a8b88984d1bdd /core
parentffccff0864a39f59b7ec378c4cf69737a01b8599 (diff)
parent8e8b280bd19fa6cb69bb19e1d90cf03a47ba2d72 (diff)
downloadframeworks_base-65abc4531f1222ffa04350a3afc6d61fcc77b2a3.zip
frameworks_base-65abc4531f1222ffa04350a3afc6d61fcc77b2a3.tar.gz
frameworks_base-65abc4531f1222ffa04350a3afc6d61fcc77b2a3.tar.bz2
Merge "StorageVolume: Add allowMassStorage flag"
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/storage/StorageVolume.java24
-rwxr-xr-xcore/res/res/values/attrs.xml2
2 files changed, 21 insertions, 5 deletions
diff --git a/core/java/android/os/storage/StorageVolume.java b/core/java/android/os/storage/StorageVolume.java
index bc4208a..792e4c1 100644
--- a/core/java/android/os/storage/StorageVolume.java
+++ b/core/java/android/os/storage/StorageVolume.java
@@ -32,6 +32,7 @@ public class StorageVolume implements Parcelable {
private final boolean mRemovable;
private final boolean mEmulated;
private final int mMtpReserveSpace;
+ private final boolean mAllowMassStorage;
private int mStorageId;
// StorageVolume extra for ACTION_MEDIA_REMOVED, ACTION_MEDIA_UNMOUNTED, ACTION_MEDIA_CHECKING,
@@ -39,23 +40,25 @@ public class StorageVolume implements Parcelable {
// ACTION_MEDIA_BAD_REMOVAL, ACTION_MEDIA_UNMOUNTABLE and ACTION_MEDIA_EJECT broadcasts.
public static final String EXTRA_STORAGE_VOLUME = "storage_volume";
- public StorageVolume(String path, String description,
- boolean removable, boolean emulated, int mtpReserveSpace) {
+ public StorageVolume(String path, String description, boolean removable,
+ boolean emulated, int mtpReserveSpace, boolean allowMassStorage) {
mPath = path;
mDescription = description;
mRemovable = removable;
mEmulated = emulated;
mMtpReserveSpace = mtpReserveSpace;
+ mAllowMassStorage = allowMassStorage;
}
// for parcelling only
- private StorageVolume(String path, String description,
- boolean removable, boolean emulated, int mtpReserveSpace, int storageId) {
+ private StorageVolume(String path, String description, boolean removable,
+ boolean emulated, int mtpReserveSpace, int storageId, boolean allowMassStorage) {
mPath = path;
mDescription = description;
mRemovable = removable;
mEmulated = emulated;
mMtpReserveSpace = mtpReserveSpace;
+ mAllowMassStorage = allowMassStorage;
mStorageId = storageId;
}
@@ -130,6 +133,15 @@ public class StorageVolume implements Parcelable {
return mMtpReserveSpace;
}
+ /**
+ * Returns true if this volume can be shared via USB mass storage.
+ *
+ * @return whether mass storage is allowed
+ */
+ public boolean allowMassStorage() {
+ return mAllowMassStorage;
+ }
+
@Override
public boolean equals(Object obj) {
if (obj instanceof StorageVolume && mPath != null) {
@@ -158,9 +170,10 @@ public class StorageVolume implements Parcelable {
int emulated = in.readInt();
int storageId = in.readInt();
int mtpReserveSpace = in.readInt();
+ int allowMassStorage = in.readInt();
return new StorageVolume(path, description,
removable == 1, emulated == 1,
- mtpReserveSpace, storageId);
+ mtpReserveSpace, storageId, allowMassStorage == 1);
}
public StorageVolume[] newArray(int size) {
@@ -179,5 +192,6 @@ public class StorageVolume implements Parcelable {
parcel.writeInt(mEmulated ? 1 : 0);
parcel.writeInt(mStorageId);
parcel.writeInt(mMtpReserveSpace);
+ parcel.writeInt(mAllowMassStorage ? 1 : 0);
}
}
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 9c55627..94a9063 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -5156,6 +5156,8 @@
<!-- number of megabytes of storage MTP should reserve for free storage
(used for emulated storage that is shared with system's data partition) -->
<attr name="mtpReserve" format="integer" />
+ <!-- true if the storage can be shared via USB mass storage -->
+ <attr name="allowMassStorage" format="boolean" />
</declare-styleable>
</resources>