| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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.mtp; |
| 18 | |
| Daichi Hirono | 0639fe0 | 2016-07-07 17:36:26 +0900 | [diff] [blame] | 19 | import android.annotation.NonNull; |
| 20 | |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 21 | /** |
| 22 | * This class encapsulates information about a storage unit on an MTP device. |
| 23 | * This corresponds to the StorageInfo Dataset described in |
| 24 | * section 5.2.2 of the MTP specification. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 25 | */ |
| 26 | public final class MtpStorageInfo { |
| 27 | |
| 28 | private int mStorageId; |
| 29 | private long mMaxCapacity; |
| 30 | private long mFreeSpace; |
| 31 | private String mDescription; |
| 32 | private String mVolumeIdentifier; |
| 33 | |
| 34 | // only instantiated via JNI |
| 35 | private MtpStorageInfo() { |
| 36 | } |
| 37 | |
| 38 | /** |
| Mike Lockwood | 11dd5ae | 2011-04-01 14:00:08 -0400 | [diff] [blame] | 39 | * Returns the storage ID for the storage unit. |
| 40 | * The storage ID uniquely identifies the storage unit on the MTP device. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 41 | * |
| 42 | * @return the storage ID |
| 43 | */ |
| 44 | public final int getStorageId() { |
| 45 | return mStorageId; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the maximum storage capacity for the storage unit in bytes |
| 50 | * |
| 51 | * @return the maximum capacity |
| 52 | */ |
| 53 | public final long getMaxCapacity() { |
| 54 | return mMaxCapacity; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the amount of free space in the storage unit in bytes |
| 59 | * |
| 60 | * @return the amount of free space |
| 61 | */ |
| 62 | public final long getFreeSpace() { |
| 63 | return mFreeSpace; |
| 64 | } |
| 65 | |
| 66 | /** |
| Mike Lockwood | 11dd5ae | 2011-04-01 14:00:08 -0400 | [diff] [blame] | 67 | * Returns the description string for the storage unit. |
| 68 | * This is typically displayed to the user in the user interface on the |
| 69 | * MTP host. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 70 | * |
| 71 | * @return the storage unit description |
| 72 | */ |
| Daichi Hirono | 0639fe0 | 2016-07-07 17:36:26 +0900 | [diff] [blame] | 73 | public final @NonNull String getDescription() { |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 74 | return mDescription; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the volume identifier for the storage unit |
| 79 | * |
| 80 | * @return the storage volume identifier |
| 81 | */ |
| Daichi Hirono | 0639fe0 | 2016-07-07 17:36:26 +0900 | [diff] [blame] | 82 | public final @NonNull String getVolumeIdentifier() { |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 83 | return mVolumeIdentifier; |
| 84 | } |
| 85 | } |