Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 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 | |
| 17 | package android.os.storage; |
| 18 | |
| 19 | import android.content.pm.IPackageMoveObserver; |
Jeff Sharkey | 7e19f53 | 2017-11-06 13:54:11 -0700 | [diff] [blame^] | 20 | import android.os.IVoldTaskListener; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 21 | import android.os.ParcelFileDescriptor; |
| 22 | import android.os.storage.DiskInfo; |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 23 | import android.os.storage.IStorageEventListener; |
| 24 | import android.os.storage.IStorageShutdownObserver; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 25 | import android.os.storage.IObbActionListener; |
| 26 | import android.os.storage.StorageVolume; |
| 27 | import android.os.storage.VolumeInfo; |
| 28 | import android.os.storage.VolumeRecord; |
Daichi Hirono | 9fb0018 | 2016-11-08 14:12:17 +0900 | [diff] [blame] | 29 | import com.android.internal.os.AppFuseMount; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * WARNING! Update IMountService.h and IMountService.cpp if you change this |
| 33 | * file. In particular, the transaction ids below must match the |
| 34 | * _TRANSACTION enum in IMountService.cpp |
| 35 | * |
| 36 | * @hide - Applications should use android.os.storage.StorageManager to access |
| 37 | * storage functions. |
| 38 | */ |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 39 | interface IStorageManager { |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 40 | /** |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 41 | * Registers an IStorageEventListener for receiving async notifications. |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 42 | */ |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 43 | void registerListener(IStorageEventListener listener) = 0; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 44 | /** |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 45 | * Unregisters an IStorageEventListener |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 46 | */ |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 47 | void unregisterListener(IStorageEventListener listener) = 1; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 48 | /** |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 49 | * Shuts down the StorageManagerService and gracefully unmounts all external media. |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 50 | * Invokes call back once the shutdown is complete. |
| 51 | */ |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 52 | void shutdown(IStorageShutdownObserver observer) = 19; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 53 | /** |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 54 | * Mounts an Opaque Binary Blob (OBB) with the specified decryption key and |
| 55 | * only allows the calling process's UID access to the contents. |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 56 | * StorageManagerService will call back to the supplied IObbActionListener to inform |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 57 | * it of the terminal state of the call. |
| 58 | */ |
| 59 | void mountObb(in String rawPath, in String canonicalPath, in String key, |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 60 | IObbActionListener token, int nonce) = 21; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 61 | /** |
| 62 | * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, |
| 63 | * any program using it will be forcibly killed to unmount the image. |
Sudheer Shanka | 2250d56 | 2016-11-07 15:41:02 -0800 | [diff] [blame] | 64 | * StorageManagerService will call back to the supplied IObbActionListener to inform |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 65 | * it of the terminal state of the call. |
| 66 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 67 | void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 68 | /** |
| 69 | * Checks whether the specified Opaque Binary Blob (OBB) is mounted |
| 70 | * somewhere. |
| 71 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 72 | boolean isObbMounted(in String rawPath) = 23; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 73 | /** |
| 74 | * Gets the path to the mounted Opaque Binary Blob (OBB). |
| 75 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 76 | String getMountedObbPath(in String rawPath) = 24; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 77 | /** |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 78 | * Decrypts any encrypted volumes. |
| 79 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 80 | int decryptStorage(in String password) = 26; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 81 | /** |
| 82 | * Encrypts storage. |
| 83 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 84 | int encryptStorage(int type, in String password) = 27; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 85 | /** |
| 86 | * Changes the encryption password. |
| 87 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 88 | int changeEncryptionPassword(int type, in String password) = 28; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 89 | /** |
| 90 | * Returns list of all mountable volumes. |
| 91 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 92 | StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 93 | /** |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 94 | * Determines the encryption state of the volume. |
| 95 | * @return a numerical value. See {@code ENCRYPTION_STATE_*} for possible |
| 96 | * values. |
| 97 | * Note that this has been replaced in most cases by the APIs in |
| 98 | * StorageManager (see isEncryptable and below) |
| 99 | * This is still useful to get the error state when encryption has failed |
| 100 | * and CryptKeeper needs to throw up a screen advising the user what to do |
| 101 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 102 | int getEncryptionState() = 31; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 103 | /** |
| 104 | * Verify the encryption password against the stored volume. This method |
| 105 | * may only be called by the system process. |
| 106 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 107 | int verifyEncryptionPassword(in String password) = 32; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 108 | /** |
| 109 | * Ensure that all directories along given path exist, creating parent |
| 110 | * directories as needed. Validates that given path is absolute and that it |
| 111 | * contains no relative "." or ".." paths or symlinks. Also ensures that |
| 112 | * path belongs to a volume managed by vold, and that path is either |
| 113 | * external storage data or OBB directory belonging to calling app. |
| 114 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 115 | int mkdirs(in String callingPkg, in String path) = 34; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 116 | /** |
| 117 | * Determines the type of the encryption password |
| 118 | * @return PasswordType |
| 119 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 120 | int getPasswordType() = 35; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 121 | /** |
| 122 | * Get password from vold |
| 123 | * @return password or empty string |
| 124 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 125 | String getPassword() = 36; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 126 | /** |
| 127 | * Securely clear password from vold |
| 128 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 129 | oneway void clearPassword() = 37; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 130 | /** |
| 131 | * Set a field in the crypto header. |
| 132 | * @param field field to set |
| 133 | * @param contents contents to set in field |
| 134 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 135 | oneway void setField(in String field, in String contents) = 38; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 136 | /** |
| 137 | * Gets a field from the crypto header. |
| 138 | * @param field field to get |
| 139 | * @return contents of field |
| 140 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 141 | String getField(in String field) = 39; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 142 | /** |
| 143 | * Report the time of the last maintenance operation such as fstrim. |
| 144 | * @return Timestamp of the last maintenance operation, in the |
| 145 | * System.currentTimeMillis() time base |
| 146 | * @throws RemoteException |
| 147 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 148 | long lastMaintenance() = 41; |
Sudheer Shanka | f734114 | 2016-10-18 17:15:18 -0700 | [diff] [blame] | 149 | /** |
| 150 | * Kick off an immediate maintenance operation |
| 151 | * @throws RemoteException |
| 152 | */ |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 153 | void runMaintenance() = 42; |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 154 | DiskInfo[] getDisks() = 44; |
| 155 | VolumeInfo[] getVolumes(int flags) = 45; |
| 156 | VolumeRecord[] getVolumeRecords(int flags) = 46; |
| 157 | void mount(in String volId) = 47; |
| 158 | void unmount(in String volId) = 48; |
| 159 | void format(in String volId) = 49; |
| 160 | void partitionPublic(in String diskId) = 50; |
| 161 | void partitionPrivate(in String diskId) = 51; |
| 162 | void partitionMixed(in String diskId, int ratio) = 52; |
| 163 | void setVolumeNickname(in String fsUuid, in String nickname) = 53; |
| 164 | void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 54; |
| 165 | void forgetVolume(in String fsUuid) = 55; |
| 166 | void forgetAllVolumes() = 56; |
| 167 | String getPrimaryStorageUuid() = 57; |
| 168 | void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 58; |
Jeff Sharkey | 7e19f53 | 2017-11-06 13:54:11 -0700 | [diff] [blame^] | 169 | void benchmark(in String volId, IVoldTaskListener listener) = 59; |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 170 | void setDebugFlags(int flags, int mask) = 60; |
| 171 | void createUserKey(int userId, int serialNumber, boolean ephemeral) = 61; |
| 172 | void destroyUserKey(int userId) = 62; |
| 173 | void unlockUserKey(int userId, int serialNumber, in byte[] token, in byte[] secret) = 63; |
| 174 | void lockUserKey(int userId) = 64; |
| 175 | boolean isUserKeyUnlocked(int userId) = 65; |
| 176 | void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 66; |
| 177 | void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67; |
| 178 | boolean isConvertibleToFBE() = 68; |
Sudheer Shanka | 34b3388 | 2016-11-01 00:13:51 -0700 | [diff] [blame] | 179 | void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70; |
| 180 | void fixateNewestUserKeyAuth(int userId) = 71; |
Jeff Sharkey | 7e19f53 | 2017-11-06 13:54:11 -0700 | [diff] [blame^] | 181 | void fstrim(int flags, IVoldTaskListener listener) = 72; |
Daichi Hirono | 9fb0018 | 2016-11-08 14:12:17 +0900 | [diff] [blame] | 182 | AppFuseMount mountProxyFileDescriptorBridge() = 73; |
| 183 | ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74; |
Jeff Sharkey | 9bed070 | 2017-01-23 20:37:05 -0700 | [diff] [blame] | 184 | long getCacheQuotaBytes(String volumeUuid, int uid) = 75; |
| 185 | long getCacheSizeBytes(String volumeUuid, int uid) = 76; |
Jeff Sharkey | 35e46d2 | 2017-06-09 10:01:20 -0600 | [diff] [blame] | 186 | long getAllocatableBytes(String volumeUuid, int flags, String callingPackage) = 77; |
| 187 | void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78; |
Rubin Xu | aa32d15 | 2017-04-27 17:01:05 +0100 | [diff] [blame] | 188 | void secdiscard(in String path) = 79; |
Jeff Sharkey | 31d0b70 | 2016-11-21 14:16:53 -0700 | [diff] [blame] | 189 | } |