blob: d860c7d8ad2e27149ac7e21a9bd558474007d8cd [file] [log] [blame]
Mike Lockwood2f6a3882011-05-09 19:08:06 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os.storage;
18
Felipe Leme04a5d402016-02-08 16:44:06 -080019import android.annotation.NonNull;
20import android.annotation.Nullable;
Fabrice Di Meglio13fe2a52012-05-18 18:08:58 -070021import android.content.Context;
Felipe Leme04a5d402016-02-08 16:44:06 -080022import android.content.Intent;
Jeff Sharkey48877892015-03-18 11:27:19 -070023import android.net.TrafficStats;
Felipe Leme04a5d402016-02-08 16:44:06 -080024import android.net.Uri;
25import android.os.Environment;
Mike Lockwood2f6a3882011-05-09 19:08:06 -070026import android.os.Parcel;
27import android.os.Parcelable;
Jeff Sharkeyb049e212012-09-07 23:16:01 -070028import android.os.UserHandle;
Felipe Leme04a5d402016-02-08 16:44:06 -080029import android.provider.DocumentsContract;
Jeff Sharkeyb049e212012-09-07 23:16:01 -070030
Jeff Sharkey5aca2b82013-10-16 16:21:54 -070031import com.android.internal.util.IndentingPrintWriter;
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -070032import com.android.internal.util.Preconditions;
Jeff Sharkey5aca2b82013-10-16 16:21:54 -070033
34import java.io.CharArrayWriter;
Jeff Sharkeyb049e212012-09-07 23:16:01 -070035import java.io.File;
Mike Lockwood2f6a3882011-05-09 19:08:06 -070036
37/**
Felipe Leme04a5d402016-02-08 16:44:06 -080038 * Information about a shared/external storage volume for a specific user.
Jeff Sharkeyb049e212012-09-07 23:16:01 -070039 *
Felipe Leme04a5d402016-02-08 16:44:06 -080040 * <p>
41 * A device always has one (and one only) primary storage volume, but it could have extra volumes,
42 * like SD cards and USB drives. This object represents the logical view of a storage
43 * volume for a specific user: different users might have different views for the same physical
44 * volume (for example, if the volume is a built-in emulated storage).
45 *
46 * <p>
47 * The storage volume is not necessarily mounted, applications should use {@link #getState()} to
48 * verify its state.
49 *
50 * <p>
51 * Applications willing to read or write to this storage volume needs to get a permission from the
52 * user first, which can be achieved in the following ways:
53 *
54 * <ul>
55 * <li>To get access to standard directories (like the {@link Environment#DIRECTORY_PICTURES}), they
56 * can use the {@link #createAccessIntent(String)}. This is the recommend way, since it provides a
57 * simpler API and narrows the access to the given directory (and its descendants).
Felipe Leme53fcc752016-02-17 14:45:52 -080058 * <li>To get access to any directory (and its descendants), they can use the Storage Acess
59 * Framework APIs (such as {@link Intent#ACTION_OPEN_DOCUMENT} and
60 * {@link Intent#ACTION_OPEN_DOCUMENT_TREE}, although these APIs do not guarantee the user will
61 * select this specific volume.
Felipe Leme04a5d402016-02-08 16:44:06 -080062 * <li>To get read and write access to the primary storage volume, applications can declare the
63 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} and
64 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permissions respectively, with the
65 * latter including the former. This approach is discouraged, since users may be hesitant to grant
66 * broad access to all files contained on a storage device.
67 * </ul>
68 *
69 * <p>It can be obtained through {@link StorageManager#getVolumeList()} and
70 * {@link StorageManager#getPrimaryVolume()} and also as an extra in some broadcasts
71 * (see {@link #EXTRA_STORAGE_VOLUME}).
72 *
73 * <p>
74 * See {@link Environment#getExternalStorageDirectory()} for more info about shared/external
75 * storage semantics.
Mike Lockwood2f6a3882011-05-09 19:08:06 -070076 */
Felipe Leme04a5d402016-02-08 16:44:06 -080077// NOTE: This is a legacy specialization of VolumeInfo which describes the volume for a specific
78// user, but is now part of the public API.
Mike Lockwood2f6a3882011-05-09 19:08:06 -070079public class StorageVolume implements Parcelable {
80
Jeff Sharkey48877892015-03-18 11:27:19 -070081 private final String mId;
82 private final int mStorageId;
Jeff Sharkeyb049e212012-09-07 23:16:01 -070083 private final File mPath;
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -070084 private final String mDescription;
Jeff Sharkey9545dc022012-09-06 22:46:30 -070085 private final boolean mPrimary;
Mike Lockwood2f6a3882011-05-09 19:08:06 -070086 private final boolean mRemovable;
87 private final boolean mEmulated;
Jeff Sharkey48877892015-03-18 11:27:19 -070088 private final long mMtpReserveSize;
Mike Lockwood8e8b2802011-06-07 08:03:33 -070089 private final boolean mAllowMassStorage;
Mike Lockwood7a59dd22011-07-11 09:18:03 -040090 private final long mMaxFileSize;
Jeff Sharkeyb049e212012-09-07 23:16:01 -070091 private final UserHandle mOwner;
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -070092 private final String mFsUuid;
Jeff Sharkey48877892015-03-18 11:27:19 -070093 private final String mState;
Jeff Sharkey5aca2b82013-10-16 16:21:54 -070094
Felipe Leme04a5d402016-02-08 16:44:06 -080095 /**
96 * Name of the {@link Parcelable} extra in the {@link Intent#ACTION_MEDIA_REMOVED},
97 * {@link Intent#ACTION_MEDIA_UNMOUNTED}, {@link Intent#ACTION_MEDIA_CHECKING},
98 * {@link Intent#ACTION_MEDIA_NOFS}, {@link Intent#ACTION_MEDIA_MOUNTED},
99 * {@link Intent#ACTION_MEDIA_SHARED}, {@link Intent#ACTION_MEDIA_BAD_REMOVAL},
100 * {@link Intent#ACTION_MEDIA_UNMOUNTABLE}, and {@link Intent#ACTION_MEDIA_EJECT} broadcast that
101 * contains a {@link StorageVolume}.
102 */
103 // Also sent on ACTION_MEDIA_UNSHARED, which is @hide
104 public static final String EXTRA_STORAGE_VOLUME = "android.os.storage.extra.STORAGE_VOLUME";
Mike Lockwooda5250c92011-05-23 13:44:04 -0400105
Felipe Leme34a9d522016-02-17 10:12:04 -0800106 /**
107 * Name of the String extra used by {@link #createAccessIntent(String) createAccessIntent}.
108 *
109 * @hide
110 */
111 public static final String EXTRA_DIRECTORY_NAME = "android.os.storage.extra.DIRECTORY_NAME";
112
113 /**
114 * Name of the intent used by {@link #createAccessIntent(String) createAccessIntent}.
115 */
116 private static final String ACTION_OPEN_EXTERNAL_DIRECTORY =
117 "android.os.storage.action.OPEN_EXTERNAL_DIRECTORY";
118
Felipe Leme04a5d402016-02-08 16:44:06 -0800119 /** {@hide} */
Jeff Sharkey5af1835d2015-07-07 17:26:59 -0700120 public static final int STORAGE_ID_INVALID = 0x00000000;
Felipe Leme04a5d402016-02-08 16:44:06 -0800121 /** {@hide} */
Jeff Sharkey5af1835d2015-07-07 17:26:59 -0700122 public static final int STORAGE_ID_PRIMARY = 0x00010001;
123
Felipe Leme04a5d402016-02-08 16:44:06 -0800124 /** {@hide} */
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700125 public StorageVolume(String id, int storageId, File path, String description, boolean primary,
Jeff Sharkey48877892015-03-18 11:27:19 -0700126 boolean removable, boolean emulated, long mtpReserveSize, boolean allowMassStorage,
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700127 long maxFileSize, UserHandle owner, String fsUuid, String state) {
128 mId = Preconditions.checkNotNull(id);
Jeff Sharkey48877892015-03-18 11:27:19 -0700129 mStorageId = storageId;
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700130 mPath = Preconditions.checkNotNull(path);
131 mDescription = Preconditions.checkNotNull(description);
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700132 mPrimary = primary;
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700133 mRemovable = removable;
134 mEmulated = emulated;
Jeff Sharkey48877892015-03-18 11:27:19 -0700135 mMtpReserveSize = mtpReserveSize;
Mike Lockwood8e8b2802011-06-07 08:03:33 -0700136 mAllowMassStorage = allowMassStorage;
Mike Lockwood7a59dd22011-07-11 09:18:03 -0400137 mMaxFileSize = maxFileSize;
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700138 mOwner = Preconditions.checkNotNull(owner);
139 mFsUuid = fsUuid;
140 mState = Preconditions.checkNotNull(state);
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700141 }
142
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700143 private StorageVolume(Parcel in) {
Jeff Sharkey48877892015-03-18 11:27:19 -0700144 mId = in.readString();
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700145 mStorageId = in.readInt();
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700146 mPath = new File(in.readString());
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700147 mDescription = in.readString();
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700148 mPrimary = in.readInt() != 0;
149 mRemovable = in.readInt() != 0;
150 mEmulated = in.readInt() != 0;
Jeff Sharkey48877892015-03-18 11:27:19 -0700151 mMtpReserveSize = in.readLong();
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700152 mAllowMassStorage = in.readInt() != 0;
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700153 mMaxFileSize = in.readLong();
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700154 mOwner = in.readParcelable(null);
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700155 mFsUuid = in.readString();
Jeff Sharkey1f706c62013-10-17 10:52:17 -0700156 mState = in.readString();
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700157 }
158
Felipe Leme04a5d402016-02-08 16:44:06 -0800159 /** {@hide} */
Jeff Sharkey48877892015-03-18 11:27:19 -0700160 public String getId() {
161 return mId;
Mike Lockwoodfbfe5552011-05-17 17:19:37 -0400162 }
163
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700164 /**
165 * Returns the mount path for the volume.
166 *
167 * @return the mount path
Felipe Leme04a5d402016-02-08 16:44:06 -0800168 * @hide
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700169 */
170 public String getPath() {
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700171 return mPath.toString();
172 }
173
Felipe Leme04a5d402016-02-08 16:44:06 -0800174 /** {@hide} */
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700175 public File getPathFile() {
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700176 return mPath;
177 }
178
179 /**
Felipe Leme04a5d402016-02-08 16:44:06 -0800180 * Returns a user-visible description of the volume.
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700181 *
182 * @return the volume description
183 */
Fabrice Di Meglio13fe2a52012-05-18 18:08:58 -0700184 public String getDescription(Context context) {
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700185 return mDescription;
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700186 }
187
Felipe Leme04a5d402016-02-08 16:44:06 -0800188 /**
189 * Returns true if the volume is the primary shared/external storage, which is the volume
190 * backed by {@link Environment#getExternalStorageDirectory()}.
191 */
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700192 public boolean isPrimary() {
193 return mPrimary;
194 }
195
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700196 /**
197 * Returns true if the volume is removable.
198 *
199 * @return is removable
200 */
201 public boolean isRemovable() {
202 return mRemovable;
203 }
204
205 /**
206 * Returns true if the volume is emulated.
207 *
208 * @return is removable
209 */
210 public boolean isEmulated() {
211 return mEmulated;
212 }
213
214 /**
Mike Lockwoodfbfe5552011-05-17 17:19:37 -0400215 * Returns the MTP storage ID for the volume.
216 * this is also used for the storage_id column in the media provider.
217 *
218 * @return MTP storage ID
Felipe Leme04a5d402016-02-08 16:44:06 -0800219 * @hide
Mike Lockwoodfbfe5552011-05-17 17:19:37 -0400220 */
221 public int getStorageId() {
222 return mStorageId;
223 }
224
225 /**
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700226 * Number of megabytes of space to leave unallocated by MTP.
227 * MTP will subtract this value from the free space it reports back
228 * to the host via GetStorageInfo, and will not allow new files to
229 * be added via MTP if there is less than this amount left free in the storage.
230 * If MTP has dedicated storage this value should be zero, but if MTP is
231 * sharing storage with the rest of the system, set this to a positive value
232 * to ensure that MTP activity does not result in the storage being
233 * too close to full.
234 *
235 * @return MTP reserve space
Felipe Leme04a5d402016-02-08 16:44:06 -0800236 * @hide
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700237 */
238 public int getMtpReserveSpace() {
Jeff Sharkey48877892015-03-18 11:27:19 -0700239 return (int) (mMtpReserveSize / TrafficStats.MB_IN_BYTES);
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700240 }
241
Mike Lockwood8e8b2802011-06-07 08:03:33 -0700242 /**
243 * Returns true if this volume can be shared via USB mass storage.
244 *
245 * @return whether mass storage is allowed
Felipe Leme04a5d402016-02-08 16:44:06 -0800246 * @hide
Mike Lockwood8e8b2802011-06-07 08:03:33 -0700247 */
248 public boolean allowMassStorage() {
249 return mAllowMassStorage;
250 }
251
Mike Lockwood7a59dd22011-07-11 09:18:03 -0400252 /**
253 * Returns maximum file size for the volume, or zero if it is unbounded.
254 *
255 * @return maximum file size
Felipe Leme04a5d402016-02-08 16:44:06 -0800256 * @hide
Mike Lockwood7a59dd22011-07-11 09:18:03 -0400257 */
258 public long getMaxFileSize() {
259 return mMaxFileSize;
260 }
261
Felipe Leme04a5d402016-02-08 16:44:06 -0800262 /** {@hide} */
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700263 public UserHandle getOwner() {
264 return mOwner;
265 }
266
Felipe Leme04a5d402016-02-08 16:44:06 -0800267 /**
268 * Gets the volume UUID, if any.
269 */
270 public @Nullable String getUuid() {
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700271 return mFsUuid;
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700272 }
273
274 /**
275 * Parse and return volume UUID as FAT volume ID, or return -1 if unable to
276 * parse or UUID is unknown.
Felipe Leme04a5d402016-02-08 16:44:06 -0800277 * @hide
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700278 */
279 public int getFatVolumeId() {
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700280 if (mFsUuid == null || mFsUuid.length() != 9) {
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700281 return -1;
282 }
283 try {
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700284 return (int) Long.parseLong(mFsUuid.replace("-", ""), 16);
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700285 } catch (NumberFormatException e) {
286 return -1;
287 }
288 }
289
Felipe Leme04a5d402016-02-08 16:44:06 -0800290 /** {@hide} */
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700291 public String getUserLabel() {
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700292 return mDescription;
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700293 }
294
Felipe Leme04a5d402016-02-08 16:44:06 -0800295 /**
296 * Returns the current state of the volume.
297 *
298 * @return one of {@link Environment#MEDIA_UNKNOWN}, {@link Environment#MEDIA_REMOVED},
299 * {@link Environment#MEDIA_UNMOUNTED}, {@link Environment#MEDIA_CHECKING},
300 * {@link Environment#MEDIA_NOFS}, {@link Environment#MEDIA_MOUNTED},
301 * {@link Environment#MEDIA_MOUNTED_READ_ONLY}, {@link Environment#MEDIA_SHARED},
302 * {@link Environment#MEDIA_BAD_REMOVAL}, or {@link Environment#MEDIA_UNMOUNTABLE}.
303 */
Jeff Sharkey1f706c62013-10-17 10:52:17 -0700304 public String getState() {
305 return mState;
306 }
307
Felipe Leme04a5d402016-02-08 16:44:06 -0800308 /**
309 * Builds an intent to give access to a standard storage directory after obtaining the user's
310 * approval.
311 * <p>
312 * When invoked, the system will ask the user to grant access to the requested directory (and
313 * its descendants). The result of the request will be returned to the activity through the
314 * {@code onActivityResult} method.
315 * <p>
316 * To gain access to descendants (child, grandchild, etc) documents, use
317 * {@link DocumentsContract#buildDocumentUriUsingTree(Uri, String)}, or
318 * {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)} with the returned URI.
319 *
320 * <b>If your application only needs to store internal data, consider using
321 * {@link Context#getExternalFilesDirs(String) Context.getExternalFilesDirs},
322 * {@link Context#getExternalCacheDirs()}, or
323 * {@link Context#getExternalMediaDirs()}, which require no permissions to read or write.
324 *
325 * @param directoryName must be one of
326 * {@link Environment#DIRECTORY_MUSIC}, {@link Environment#DIRECTORY_PODCASTS},
327 * {@link Environment#DIRECTORY_RINGTONES}, {@link Environment#DIRECTORY_ALARMS},
328 * {@link Environment#DIRECTORY_NOTIFICATIONS}, {@link Environment#DIRECTORY_PICTURES},
329 * {@link Environment#DIRECTORY_MOVIES}, {@link Environment#DIRECTORY_DOWNLOADS},
330 * {@link Environment#DIRECTORY_DCIM}, or {@link Environment#DIRECTORY_DOCUMENTS}
331 *
332 * @see DocumentsContract
333 */
334 public Intent createAccessIntent(@NonNull String directoryName) {
Felipe Leme34a9d522016-02-17 10:12:04 -0800335 final Intent intent = new Intent(ACTION_OPEN_EXTERNAL_DIRECTORY);
336 intent.putExtra(EXTRA_STORAGE_VOLUME, this);
337 intent.putExtra(EXTRA_DIRECTORY_NAME, directoryName);
Felipe Leme04a5d402016-02-08 16:44:06 -0800338 return intent;
339 }
340
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700341 @Override
342 public boolean equals(Object obj) {
343 if (obj instanceof StorageVolume && mPath != null) {
344 StorageVolume volume = (StorageVolume)obj;
345 return (mPath.equals(volume.mPath));
346 }
347 return false;
348 }
349
350 @Override
351 public int hashCode() {
352 return mPath.hashCode();
353 }
354
355 @Override
356 public String toString() {
Felipe Leme04a5d402016-02-08 16:44:06 -0800357 final StringBuilder buffer = new StringBuilder("StorageVolume: ").append(mDescription);
358 if (mFsUuid != null) {
359 buffer.append(" (").append(mFsUuid).append(")");
360 }
361 return buffer.toString();
362 }
363
364 /** {@hide} */
365 // TODO(b/26742218): find out where toString() is called internally and replace these calls by
366 // dump().
367 public String dump() {
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700368 final CharArrayWriter writer = new CharArrayWriter();
369 dump(new IndentingPrintWriter(writer, " ", 80));
370 return writer.toString();
371 }
372
Felipe Leme04a5d402016-02-08 16:44:06 -0800373 /** {@hide} */
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700374 public void dump(IndentingPrintWriter pw) {
375 pw.println("StorageVolume:");
376 pw.increaseIndent();
Jeff Sharkey48877892015-03-18 11:27:19 -0700377 pw.printPair("mId", mId);
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700378 pw.printPair("mStorageId", mStorageId);
379 pw.printPair("mPath", mPath);
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700380 pw.printPair("mDescription", mDescription);
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700381 pw.printPair("mPrimary", mPrimary);
382 pw.printPair("mRemovable", mRemovable);
383 pw.printPair("mEmulated", mEmulated);
Jeff Sharkey48877892015-03-18 11:27:19 -0700384 pw.printPair("mMtpReserveSize", mMtpReserveSize);
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700385 pw.printPair("mAllowMassStorage", mAllowMassStorage);
386 pw.printPair("mMaxFileSize", mMaxFileSize);
387 pw.printPair("mOwner", mOwner);
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700388 pw.printPair("mFsUuid", mFsUuid);
Jeff Sharkey1f706c62013-10-17 10:52:17 -0700389 pw.printPair("mState", mState);
Jeff Sharkey5aca2b82013-10-16 16:21:54 -0700390 pw.decreaseIndent();
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700391 }
392
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700393 public static final Creator<StorageVolume> CREATOR = new Creator<StorageVolume>() {
394 @Override
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700395 public StorageVolume createFromParcel(Parcel in) {
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700396 return new StorageVolume(in);
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700397 }
398
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700399 @Override
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700400 public StorageVolume[] newArray(int size) {
401 return new StorageVolume[size];
402 }
403 };
404
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700405 @Override
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700406 public int describeContents() {
407 return 0;
408 }
409
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700410 @Override
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700411 public void writeToParcel(Parcel parcel, int flags) {
Jeff Sharkey48877892015-03-18 11:27:19 -0700412 parcel.writeString(mId);
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700413 parcel.writeInt(mStorageId);
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700414 parcel.writeString(mPath.toString());
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700415 parcel.writeString(mDescription);
Jeff Sharkey9545dc022012-09-06 22:46:30 -0700416 parcel.writeInt(mPrimary ? 1 : 0);
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700417 parcel.writeInt(mRemovable ? 1 : 0);
418 parcel.writeInt(mEmulated ? 1 : 0);
Jeff Sharkey48877892015-03-18 11:27:19 -0700419 parcel.writeLong(mMtpReserveSize);
Mike Lockwood8e8b2802011-06-07 08:03:33 -0700420 parcel.writeInt(mAllowMassStorage ? 1 : 0);
Mike Lockwood7a59dd22011-07-11 09:18:03 -0400421 parcel.writeLong(mMaxFileSize);
Jeff Sharkeyb049e212012-09-07 23:16:01 -0700422 parcel.writeParcelable(mOwner, flags);
Jeff Sharkey1b8ef7e2015-04-03 17:14:45 -0700423 parcel.writeString(mFsUuid);
Jeff Sharkey1f706c62013-10-17 10:52:17 -0700424 parcel.writeString(mState);
Mike Lockwood2f6a3882011-05-09 19:08:06 -0700425 }
426}