IStorageManager.aidl revision 31d0b7043d9077ad8a0ebfbd6ff2f98621e6f413
1/** 2 * Copyright (c) 2016, 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 19import android.content.pm.IPackageMoveObserver; 20import android.os.ParcelFileDescriptor; 21import android.os.storage.DiskInfo; 22import android.os.storage.IStorageEventListener; 23import android.os.storage.IStorageShutdownObserver; 24import android.os.storage.IObbActionListener; 25import android.os.storage.StorageVolume; 26import android.os.storage.VolumeInfo; 27import android.os.storage.VolumeRecord; 28 29/** 30 * WARNING! Update IMountService.h and IMountService.cpp if you change this 31 * file. In particular, the transaction ids below must match the 32 * _TRANSACTION enum in IMountService.cpp 33 * 34 * @hide - Applications should use android.os.storage.StorageManager to access 35 * storage functions. 36 */ 37interface IStorageManager { 38 /** 39 * Registers an IStorageEventListener for receiving async notifications. 40 */ 41 void registerListener(IStorageEventListener listener) = 0; 42 /** 43 * Unregisters an IStorageEventListener 44 */ 45 void unregisterListener(IStorageEventListener listener) = 1; 46 /** 47 * Returns true if a USB mass storage host is connected 48 */ 49 boolean isUsbMassStorageConnected() = 2; 50 /** 51 * Enables / disables USB mass storage. The caller should check actual 52 * status of enabling/disabling USB mass storage via StorageEventListener. 53 */ 54 void setUsbMassStorageEnabled(boolean enable) = 3; 55 /** 56 * Returns true if a USB mass storage host is enabled (media is shared) 57 */ 58 boolean isUsbMassStorageEnabled() = 4; 59 /** 60 * Mount external storage at given mount point. Returns an int consistent 61 * with StorageResultCode 62 */ 63 int mountVolume(in String mountPoint) = 5; 64 /** 65 * Safely unmount external storage at given mount point. The unmount is an 66 * asynchronous operation. Applications should register StorageEventListener 67 * for storage related status changes. 68 * @param mountPoint the mount point 69 * @param force whether or not to forcefully unmount it (e.g. even if programs are using this 70 * data currently) 71 * @param removeEncryption whether or not encryption mapping should be removed from the volume. 72 * This value implies {@code force}. 73 */ 74 void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 6; 75 /** 76 * Format external storage given a mount point. Returns an int consistent 77 * with StorageResultCode 78 */ 79 int formatVolume(in String mountPoint) = 7; 80 /** 81 * Returns an array of pids with open files on the specified path. 82 */ 83 int[] getStorageUsers(in String path) = 8; 84 /** 85 * Gets the state of a volume via its mountpoint. 86 */ 87 String getVolumeState(in String mountPoint) = 9; 88 /* 89 * Creates a secure container with the specified parameters. Returns an int 90 * consistent with StorageResultCode 91 */ 92 int createSecureContainer(in String id, int sizeMb, in String fstype, in String key, 93 int ownerUid, boolean external) = 10; 94 /* 95 * Finalize a container which has just been created and populated. After 96 * finalization, the container is immutable. Returns an int consistent with 97 * StorageResultCode 98 */ 99 int finalizeSecureContainer(in String id) = 11; 100 /* 101 * Destroy a secure container, and free up all resources associated with it. 102 * NOTE: Ensure all references are released prior to deleting. Returns an 103 * int consistent with StorageResultCode 104 */ 105 int destroySecureContainer(in String id, boolean force) = 12; 106 /* 107 * Mount a secure container with the specified key and owner UID. Returns an 108 * int consistent with StorageResultCode 109 */ 110 int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 13; 111 /* 112 * Unount a secure container. Returns an int consistent with 113 * StorageResultCode 114 */ 115 int unmountSecureContainer(in String id, boolean force) = 14; 116 /* 117 * Returns true if the specified container is mounted 118 */ 119 boolean isSecureContainerMounted(in String id) = 15; 120 /* 121 * Rename an unmounted secure container. Returns an int consistent with 122 * StorageResultCode 123 */ 124 int renameSecureContainer(in String oldId, in String newId) = 16; 125 /* 126 * Returns the filesystem path of a mounted secure container. 127 */ 128 String getSecureContainerPath(in String id) = 17; 129 /** 130 * Gets an Array of currently known secure container IDs 131 */ 132 String[] getSecureContainerList() = 18; 133 /** 134 * Shuts down the StorageManagerService and gracefully unmounts all external media. 135 * Invokes call back once the shutdown is complete. 136 */ 137 void shutdown(IStorageShutdownObserver observer) = 19; 138 /** 139 * Call into StorageManagerService by PackageManager to notify that its done 140 * processing the media status update request. 141 */ 142 void finishMediaUpdate() = 20; 143 /** 144 * Mounts an Opaque Binary Blob (OBB) with the specified decryption key and 145 * only allows the calling process's UID access to the contents. 146 * StorageManagerService will call back to the supplied IObbActionListener to inform 147 * it of the terminal state of the call. 148 */ 149 void mountObb(in String rawPath, in String canonicalPath, in String key, 150 IObbActionListener token, int nonce) = 21; 151 /** 152 * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, 153 * any program using it will be forcibly killed to unmount the image. 154 * StorageManagerService will call back to the supplied IObbActionListener to inform 155 * it of the terminal state of the call. 156 */ 157 void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; 158 /** 159 * Checks whether the specified Opaque Binary Blob (OBB) is mounted 160 * somewhere. 161 */ 162 boolean isObbMounted(in String rawPath) = 23; 163 /** 164 * Gets the path to the mounted Opaque Binary Blob (OBB). 165 */ 166 String getMountedObbPath(in String rawPath) = 24; 167 /** 168 * Returns whether or not the external storage is emulated. 169 */ 170 boolean isExternalStorageEmulated() = 25; 171 /** 172 * Decrypts any encrypted volumes. 173 */ 174 int decryptStorage(in String password) = 26; 175 /** 176 * Encrypts storage. 177 */ 178 int encryptStorage(int type, in String password) = 27; 179 /** 180 * Changes the encryption password. 181 */ 182 int changeEncryptionPassword(int type, in String password) = 28; 183 /** 184 * Returns list of all mountable volumes. 185 */ 186 StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29; 187 /** 188 * Gets the path on the filesystem for the ASEC container itself. 189 * 190 * @param cid ASEC container ID 191 * @return path to filesystem or {@code null} if it's not found 192 * @throws RemoteException 193 */ 194 String getSecureContainerFilesystemPath(in String cid) = 30; 195 /** 196 * Determines the encryption state of the volume. 197 * @return a numerical value. See {@code ENCRYPTION_STATE_*} for possible 198 * values. 199 * Note that this has been replaced in most cases by the APIs in 200 * StorageManager (see isEncryptable and below) 201 * This is still useful to get the error state when encryption has failed 202 * and CryptKeeper needs to throw up a screen advising the user what to do 203 */ 204 int getEncryptionState() = 31; 205 /** 206 * Verify the encryption password against the stored volume. This method 207 * may only be called by the system process. 208 */ 209 int verifyEncryptionPassword(in String password) = 32; 210 /* 211 * Fix permissions in a container which has just been created and populated. 212 * Returns an int consistent with StorageResultCode 213 */ 214 int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 33; 215 /** 216 * Ensure that all directories along given path exist, creating parent 217 * directories as needed. Validates that given path is absolute and that it 218 * contains no relative "." or ".." paths or symlinks. Also ensures that 219 * path belongs to a volume managed by vold, and that path is either 220 * external storage data or OBB directory belonging to calling app. 221 */ 222 int mkdirs(in String callingPkg, in String path) = 34; 223 /** 224 * Determines the type of the encryption password 225 * @return PasswordType 226 */ 227 int getPasswordType() = 35; 228 /** 229 * Get password from vold 230 * @return password or empty string 231 */ 232 String getPassword() = 36; 233 /** 234 * Securely clear password from vold 235 */ 236 oneway void clearPassword() = 37; 237 /** 238 * Set a field in the crypto header. 239 * @param field field to set 240 * @param contents contents to set in field 241 */ 242 oneway void setField(in String field, in String contents) = 38; 243 /** 244 * Gets a field from the crypto header. 245 * @param field field to get 246 * @return contents of field 247 */ 248 String getField(in String field) = 39; 249 int resizeSecureContainer(in String id, int sizeMb, in String key) = 40; 250 /** 251 * Report the time of the last maintenance operation such as fstrim. 252 * @return Timestamp of the last maintenance operation, in the 253 * System.currentTimeMillis() time base 254 * @throws RemoteException 255 */ 256 long lastMaintenance() = 41; 257 /** 258 * Kick off an immediate maintenance operation 259 * @throws RemoteException 260 */ 261 void runMaintenance() = 42; 262 void waitForAsecScan() = 43; 263 DiskInfo[] getDisks() = 44; 264 VolumeInfo[] getVolumes(int flags) = 45; 265 VolumeRecord[] getVolumeRecords(int flags) = 46; 266 void mount(in String volId) = 47; 267 void unmount(in String volId) = 48; 268 void format(in String volId) = 49; 269 void partitionPublic(in String diskId) = 50; 270 void partitionPrivate(in String diskId) = 51; 271 void partitionMixed(in String diskId, int ratio) = 52; 272 void setVolumeNickname(in String fsUuid, in String nickname) = 53; 273 void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 54; 274 void forgetVolume(in String fsUuid) = 55; 275 void forgetAllVolumes() = 56; 276 String getPrimaryStorageUuid() = 57; 277 void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 58; 278 long benchmark(in String volId) = 59; 279 void setDebugFlags(int flags, int mask) = 60; 280 void createUserKey(int userId, int serialNumber, boolean ephemeral) = 61; 281 void destroyUserKey(int userId) = 62; 282 void unlockUserKey(int userId, int serialNumber, in byte[] token, in byte[] secret) = 63; 283 void lockUserKey(int userId) = 64; 284 boolean isUserKeyUnlocked(int userId) = 65; 285 void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 66; 286 void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67; 287 boolean isConvertibleToFBE() = 68; 288 ParcelFileDescriptor mountAppFuse(in String name) = 69; 289 void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70; 290 void fixateNewestUserKeyAuth(int userId) = 71; 291 void fstrim(int flags) = 72; 292} 293