Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | |
| 17 | package android.os.storage; |
| 18 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
| 20 | import android.annotation.Nullable; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 21 | import android.content.Context; |
| 22 | import android.content.Intent; |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 23 | import android.content.res.Resources; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 24 | import android.mtp.MtpStorage; |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 25 | import android.net.Uri; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 26 | import android.os.Environment; |
| 27 | import android.os.Parcel; |
| 28 | import android.os.Parcelable; |
| 29 | import android.os.UserHandle; |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 30 | import android.provider.DocumentsContract; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 31 | import android.text.TextUtils; |
| 32 | import android.util.ArrayMap; |
| 33 | import android.util.DebugUtils; |
| 34 | import android.util.SparseArray; |
| 35 | |
| 36 | import com.android.internal.util.IndentingPrintWriter; |
| 37 | import com.android.internal.util.Preconditions; |
| 38 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 39 | import java.io.CharArrayWriter; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 40 | import java.io.File; |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 41 | import java.util.Comparator; |
| 42 | import java.util.Objects; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Information about a storage volume that may be mounted. A volume may be a |
| 46 | * partition on a physical {@link DiskInfo}, an emulated volume above some other |
| 47 | * storage medium, or a standalone container like an ASEC or OBB. |
| 48 | * |
| 49 | * @hide |
| 50 | */ |
| 51 | public class VolumeInfo implements Parcelable { |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 52 | public static final String EXTRA_VOLUME_ID = "android.os.storage.extra.VOLUME_ID"; |
| 53 | |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 54 | /** Stub volume representing internal private storage */ |
| 55 | public static final String ID_PRIVATE_INTERNAL = "private"; |
Jeff Sharkey | b2b9ab8 | 2015-04-05 21:10:42 -0700 | [diff] [blame] | 56 | /** Real volume representing internal emulated storage */ |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 57 | public static final String ID_EMULATED_INTERNAL = "emulated"; |
| 58 | |
| 59 | public static final int TYPE_PUBLIC = 0; |
| 60 | public static final int TYPE_PRIVATE = 1; |
| 61 | public static final int TYPE_EMULATED = 2; |
| 62 | public static final int TYPE_ASEC = 3; |
| 63 | public static final int TYPE_OBB = 4; |
| 64 | |
| 65 | public static final int STATE_UNMOUNTED = 0; |
| 66 | public static final int STATE_MOUNTING = 1; |
| 67 | public static final int STATE_MOUNTED = 2; |
| 68 | public static final int STATE_FORMATTING = 3; |
| 69 | public static final int STATE_UNMOUNTING = 4; |
Jeff Sharkey | 16c9c24 | 2015-04-04 21:37:20 -0700 | [diff] [blame] | 70 | public static final int STATE_UNMOUNTABLE = 5; |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 71 | public static final int STATE_REMOVED = 6; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 72 | |
| 73 | public static final int FLAG_PRIMARY = 1 << 0; |
| 74 | public static final int FLAG_VISIBLE = 1 << 1; |
| 75 | |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 76 | public static final int USER_FLAG_INITED = 1 << 0; |
| 77 | public static final int USER_FLAG_SNOOZED = 1 << 1; |
| 78 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 79 | private static SparseArray<String> sStateToEnvironment = new SparseArray<>(); |
| 80 | private static ArrayMap<String, String> sEnvironmentToBroadcast = new ArrayMap<>(); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 81 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 82 | private static final Comparator<VolumeInfo> |
| 83 | sDescriptionComparator = new Comparator<VolumeInfo>() { |
| 84 | @Override |
| 85 | public int compare(VolumeInfo lhs, VolumeInfo rhs) { |
| 86 | if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(lhs.getId())) { |
| 87 | return -1; |
| 88 | } else if (lhs.getDescription() == null) { |
| 89 | return 1; |
| 90 | } else if (rhs.getDescription() == null) { |
| 91 | return -1; |
| 92 | } else { |
| 93 | return lhs.getDescription().compareTo(rhs.getDescription()); |
| 94 | } |
| 95 | } |
| 96 | }; |
| 97 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 98 | static { |
| 99 | sStateToEnvironment.put(VolumeInfo.STATE_UNMOUNTED, Environment.MEDIA_UNMOUNTED); |
| 100 | sStateToEnvironment.put(VolumeInfo.STATE_MOUNTING, Environment.MEDIA_CHECKING); |
| 101 | sStateToEnvironment.put(VolumeInfo.STATE_MOUNTED, Environment.MEDIA_MOUNTED); |
| 102 | sStateToEnvironment.put(VolumeInfo.STATE_FORMATTING, Environment.MEDIA_UNMOUNTED); |
| 103 | sStateToEnvironment.put(VolumeInfo.STATE_UNMOUNTING, Environment.MEDIA_EJECTING); |
Jeff Sharkey | 16c9c24 | 2015-04-04 21:37:20 -0700 | [diff] [blame] | 104 | sStateToEnvironment.put(VolumeInfo.STATE_UNMOUNTABLE, Environment.MEDIA_UNMOUNTABLE); |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 105 | sStateToEnvironment.put(VolumeInfo.STATE_REMOVED, Environment.MEDIA_REMOVED); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 106 | |
| 107 | sEnvironmentToBroadcast.put(Environment.MEDIA_UNMOUNTED, Intent.ACTION_MEDIA_UNMOUNTED); |
| 108 | sEnvironmentToBroadcast.put(Environment.MEDIA_CHECKING, Intent.ACTION_MEDIA_CHECKING); |
| 109 | sEnvironmentToBroadcast.put(Environment.MEDIA_MOUNTED, Intent.ACTION_MEDIA_MOUNTED); |
| 110 | sEnvironmentToBroadcast.put(Environment.MEDIA_EJECTING, Intent.ACTION_MEDIA_EJECT); |
Jeff Sharkey | 16c9c24 | 2015-04-04 21:37:20 -0700 | [diff] [blame] | 111 | sEnvironmentToBroadcast.put(Environment.MEDIA_UNMOUNTABLE, Intent.ACTION_MEDIA_UNMOUNTABLE); |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 112 | sEnvironmentToBroadcast.put(Environment.MEDIA_REMOVED, Intent.ACTION_MEDIA_REMOVED); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | /** vold state */ |
| 116 | public final String id; |
| 117 | public final int type; |
| 118 | public int flags = 0; |
| 119 | public int userId = -1; |
| 120 | public int state = STATE_UNMOUNTED; |
| 121 | public String fsType; |
| 122 | public String fsUuid; |
| 123 | public String fsLabel; |
| 124 | public String path; |
| 125 | |
| 126 | /** Framework state */ |
| 127 | public final int mtpIndex; |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 128 | public String diskId; |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 129 | public String nickname; |
| 130 | public int userFlags = 0; |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 131 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 132 | public VolumeInfo(String id, int type, int mtpIndex) { |
| 133 | this.id = Preconditions.checkNotNull(id); |
| 134 | this.type = type; |
| 135 | this.mtpIndex = mtpIndex; |
| 136 | } |
| 137 | |
| 138 | public VolumeInfo(Parcel parcel) { |
| 139 | id = parcel.readString(); |
| 140 | type = parcel.readInt(); |
| 141 | flags = parcel.readInt(); |
| 142 | userId = parcel.readInt(); |
| 143 | state = parcel.readInt(); |
| 144 | fsType = parcel.readString(); |
| 145 | fsUuid = parcel.readString(); |
| 146 | fsLabel = parcel.readString(); |
| 147 | path = parcel.readString(); |
| 148 | mtpIndex = parcel.readInt(); |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 149 | diskId = parcel.readString(); |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 150 | nickname = parcel.readString(); |
| 151 | userFlags = parcel.readInt(); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 154 | public static @NonNull String getEnvironmentForState(int state) { |
| 155 | final String envState = sStateToEnvironment.get(state); |
| 156 | if (envState != null) { |
| 157 | return envState; |
| 158 | } else { |
| 159 | return Environment.MEDIA_UNKNOWN; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | public static @Nullable String getBroadcastForEnvironment(String envState) { |
| 164 | return sEnvironmentToBroadcast.get(envState); |
| 165 | } |
| 166 | |
| 167 | public static @Nullable String getBroadcastForState(int state) { |
| 168 | return getBroadcastForEnvironment(getEnvironmentForState(state)); |
| 169 | } |
| 170 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 171 | public static @NonNull Comparator<VolumeInfo> getDescriptionComparator() { |
| 172 | return sDescriptionComparator; |
| 173 | } |
| 174 | |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 175 | public @NonNull String getId() { |
| 176 | return id; |
| 177 | } |
| 178 | |
| 179 | public @Nullable String getDiskId() { |
| 180 | return diskId; |
| 181 | } |
| 182 | |
| 183 | public int getType() { |
| 184 | return type; |
| 185 | } |
| 186 | |
| 187 | public int getState() { |
| 188 | return state; |
| 189 | } |
| 190 | |
| 191 | public @Nullable String getFsUuid() { |
| 192 | return fsUuid; |
| 193 | } |
| 194 | |
| 195 | public @Nullable String getNickname() { |
| 196 | return nickname; |
| 197 | } |
| 198 | |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 199 | public @Nullable String getDescription() { |
| 200 | if (ID_PRIVATE_INTERNAL.equals(id)) { |
| 201 | return Resources.getSystem().getString(com.android.internal.R.string.storage_internal); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 202 | } else if (!TextUtils.isEmpty(nickname)) { |
| 203 | return nickname; |
| 204 | } else if (!TextUtils.isEmpty(fsLabel)) { |
| 205 | return fsLabel; |
| 206 | } else { |
| 207 | return null; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | public boolean isPrimary() { |
| 212 | return (flags & FLAG_PRIMARY) != 0; |
| 213 | } |
| 214 | |
| 215 | public boolean isVisible() { |
| 216 | return (flags & FLAG_VISIBLE) != 0; |
| 217 | } |
| 218 | |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 219 | public boolean isInited() { |
| 220 | return (userFlags & USER_FLAG_INITED) != 0; |
| 221 | } |
| 222 | |
| 223 | public boolean isSnoozed() { |
| 224 | return (userFlags & USER_FLAG_SNOOZED) != 0; |
| 225 | } |
| 226 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 227 | public boolean isVisibleToUser(int userId) { |
| 228 | if (type == TYPE_PUBLIC && userId == this.userId) { |
| 229 | return isVisible(); |
| 230 | } else if (type == TYPE_EMULATED) { |
| 231 | return isVisible(); |
| 232 | } else { |
| 233 | return false; |
| 234 | } |
| 235 | } |
| 236 | |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 237 | public File getPath() { |
| 238 | return new File(path); |
| 239 | } |
| 240 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 241 | public File getPathForUser(int userId) { |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 242 | if (path == null) { |
| 243 | return null; |
| 244 | } else if (type == TYPE_PUBLIC && userId == this.userId) { |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 245 | return new File(path); |
| 246 | } else if (type == TYPE_EMULATED) { |
| 247 | return new File(path, Integer.toString(userId)); |
| 248 | } else { |
| 249 | return null; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | public StorageVolume buildStorageVolume(Context context, int userId) { |
| 254 | final boolean removable; |
| 255 | final boolean emulated; |
| 256 | final boolean allowMassStorage = false; |
| 257 | final int mtpStorageId = MtpStorage.getStorageIdForIndex(mtpIndex); |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 258 | final String envState = getEnvironmentForState(state); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 259 | |
| 260 | File userPath = getPathForUser(userId); |
| 261 | if (userPath == null) { |
| 262 | userPath = new File("/dev/null"); |
| 263 | } |
| 264 | |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 265 | String description = getDescription(); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 266 | if (description == null) { |
| 267 | description = context.getString(android.R.string.unknownName); |
| 268 | } |
| 269 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 270 | long mtpReserveSize = 0; |
| 271 | long maxFileSize = 0; |
| 272 | |
| 273 | if (type == TYPE_EMULATED) { |
| 274 | emulated = true; |
| 275 | mtpReserveSize = StorageManager.from(context).getStorageLowBytes(userPath); |
| 276 | |
| 277 | if (ID_EMULATED_INTERNAL.equals(id)) { |
| 278 | removable = false; |
| 279 | } else { |
| 280 | removable = true; |
| 281 | } |
| 282 | |
| 283 | } else if (type == TYPE_PUBLIC) { |
| 284 | emulated = false; |
| 285 | removable = true; |
| 286 | |
| 287 | if ("vfat".equals(fsType)) { |
| 288 | maxFileSize = 4294967295L; |
| 289 | } |
| 290 | |
| 291 | } else { |
| 292 | throw new IllegalStateException("Unexpected volume type " + type); |
| 293 | } |
| 294 | |
| 295 | return new StorageVolume(id, mtpStorageId, userPath, description, isPrimary(), removable, |
| 296 | emulated, mtpReserveSize, allowMassStorage, maxFileSize, new UserHandle(userId), |
| 297 | fsUuid, envState); |
| 298 | } |
| 299 | |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 300 | // TODO: avoid this layering violation |
| 301 | private static final String DOCUMENT_AUTHORITY = "com.android.externalstorage.documents"; |
| 302 | private static final String DOCUMENT_ROOT_PRIMARY_EMULATED = "primary"; |
| 303 | |
| 304 | /** |
| 305 | * Build an intent to browse the contents of this volume. Only valid for |
| 306 | * {@link #TYPE_EMULATED} or {@link #TYPE_PUBLIC}. |
| 307 | */ |
| 308 | public Intent buildBrowseIntent() { |
| 309 | final Uri uri; |
| 310 | if (type == VolumeInfo.TYPE_PUBLIC) { |
| 311 | uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY, fsUuid); |
| 312 | } else if (VolumeInfo.ID_EMULATED_INTERNAL.equals(id)) { |
| 313 | uri = DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY, |
| 314 | DOCUMENT_ROOT_PRIMARY_EMULATED); |
| 315 | } else if (type == VolumeInfo.TYPE_EMULATED) { |
| 316 | // TODO: build intent once supported |
| 317 | uri = null; |
| 318 | } else { |
| 319 | throw new IllegalArgumentException(); |
| 320 | } |
| 321 | |
| 322 | final Intent intent = new Intent(DocumentsContract.ACTION_BROWSE_DOCUMENT_ROOT); |
| 323 | intent.addCategory(Intent.CATEGORY_DEFAULT); |
| 324 | intent.setData(uri); |
| 325 | return intent; |
| 326 | } |
| 327 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 328 | @Override |
| 329 | public String toString() { |
| 330 | final CharArrayWriter writer = new CharArrayWriter(); |
| 331 | dump(new IndentingPrintWriter(writer, " ", 80)); |
| 332 | return writer.toString(); |
| 333 | } |
| 334 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 335 | public void dump(IndentingPrintWriter pw) { |
| 336 | pw.println("VolumeInfo:"); |
| 337 | pw.increaseIndent(); |
| 338 | pw.printPair("id", id); |
| 339 | pw.printPair("type", DebugUtils.valueToString(getClass(), "TYPE_", type)); |
| 340 | pw.printPair("flags", DebugUtils.flagsToString(getClass(), "FLAG_", flags)); |
| 341 | pw.printPair("userId", userId); |
| 342 | pw.printPair("state", DebugUtils.valueToString(getClass(), "STATE_", state)); |
| 343 | pw.println(); |
| 344 | pw.printPair("fsType", fsType); |
| 345 | pw.printPair("fsUuid", fsUuid); |
| 346 | pw.printPair("fsLabel", fsLabel); |
| 347 | pw.println(); |
| 348 | pw.printPair("path", path); |
| 349 | pw.printPair("mtpIndex", mtpIndex); |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 350 | pw.printPair("diskId", diskId); |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 351 | pw.printPair("nickname", nickname); |
| 352 | pw.printPair("userFlags", DebugUtils.flagsToString(getClass(), "USER_FLAG_", userFlags)); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 353 | pw.decreaseIndent(); |
| 354 | pw.println(); |
| 355 | } |
| 356 | |
Jeff Sharkey | 7151a9a | 2015-04-04 15:22:37 -0700 | [diff] [blame] | 357 | @Override |
| 358 | public VolumeInfo clone() { |
| 359 | final Parcel temp = Parcel.obtain(); |
| 360 | try { |
| 361 | writeToParcel(temp, 0); |
| 362 | temp.setDataPosition(0); |
| 363 | return CREATOR.createFromParcel(temp); |
| 364 | } finally { |
| 365 | temp.recycle(); |
| 366 | } |
| 367 | } |
| 368 | |
Jeff Sharkey | e2d45be | 2015-04-15 17:14:12 -0700 | [diff] [blame] | 369 | @Override |
| 370 | public boolean equals(Object o) { |
| 371 | if (o instanceof VolumeInfo) { |
| 372 | return Objects.equals(id, ((VolumeInfo) o).id); |
| 373 | } else { |
| 374 | return false; |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | @Override |
| 379 | public int hashCode() { |
| 380 | return id.hashCode(); |
| 381 | } |
| 382 | |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 383 | public static final Creator<VolumeInfo> CREATOR = new Creator<VolumeInfo>() { |
| 384 | @Override |
| 385 | public VolumeInfo createFromParcel(Parcel in) { |
| 386 | return new VolumeInfo(in); |
| 387 | } |
| 388 | |
| 389 | @Override |
| 390 | public VolumeInfo[] newArray(int size) { |
| 391 | return new VolumeInfo[size]; |
| 392 | } |
| 393 | }; |
| 394 | |
| 395 | @Override |
| 396 | public int describeContents() { |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | @Override |
| 401 | public void writeToParcel(Parcel parcel, int flags) { |
| 402 | parcel.writeString(id); |
| 403 | parcel.writeInt(type); |
Jeff Sharkey | 59d577a | 2015-04-11 21:27:21 -0700 | [diff] [blame] | 404 | parcel.writeInt(this.flags); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 405 | parcel.writeInt(userId); |
| 406 | parcel.writeInt(state); |
| 407 | parcel.writeString(fsType); |
| 408 | parcel.writeString(fsUuid); |
| 409 | parcel.writeString(fsLabel); |
| 410 | parcel.writeString(path); |
| 411 | parcel.writeInt(mtpIndex); |
Jeff Sharkey | 56bd312 | 2015-04-14 10:30:34 -0700 | [diff] [blame] | 412 | parcel.writeString(diskId); |
Jeff Sharkey | d95d3bf | 2015-04-14 21:39:44 -0700 | [diff] [blame] | 413 | parcel.writeString(nickname); |
| 414 | parcel.writeInt(userFlags); |
Jeff Sharkey | 1b8ef7e | 2015-04-03 17:14:45 -0700 | [diff] [blame] | 415 | } |
| 416 | } |