blob: 0b76eec4ae0bfcf5a67883bf0ac6e85330155657 [file] [log] [blame]
Sudheer Shankaf7341142016-10-18 17:15:18 -07001/**
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;
Jeff Sharkey7e19f532017-11-06 13:54:11 -070020import android.os.IVoldTaskListener;
Sudheer Shankaf7341142016-10-18 17:15:18 -070021import android.os.ParcelFileDescriptor;
22import android.os.storage.DiskInfo;
Sudheer Shanka2250d562016-11-07 15:41:02 -080023import android.os.storage.IStorageEventListener;
24import android.os.storage.IStorageShutdownObserver;
Sudheer Shankaf7341142016-10-18 17:15:18 -070025import android.os.storage.IObbActionListener;
26import android.os.storage.StorageVolume;
27import android.os.storage.VolumeInfo;
28import android.os.storage.VolumeRecord;
Daichi Hirono9fb00182016-11-08 14:12:17 +090029import com.android.internal.os.AppFuseMount;
Sudheer Shankaf7341142016-10-18 17:15:18 -070030
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 Shanka2250d562016-11-07 15:41:02 -080039interface IStorageManager {
Sudheer Shankaf7341142016-10-18 17:15:18 -070040 /**
Sudheer Shanka2250d562016-11-07 15:41:02 -080041 * Registers an IStorageEventListener for receiving async notifications.
Sudheer Shankaf7341142016-10-18 17:15:18 -070042 */
Sudheer Shanka2250d562016-11-07 15:41:02 -080043 void registerListener(IStorageEventListener listener) = 0;
Sudheer Shankaf7341142016-10-18 17:15:18 -070044 /**
Sudheer Shanka2250d562016-11-07 15:41:02 -080045 * Unregisters an IStorageEventListener
Sudheer Shankaf7341142016-10-18 17:15:18 -070046 */
Sudheer Shanka2250d562016-11-07 15:41:02 -080047 void unregisterListener(IStorageEventListener listener) = 1;
Sudheer Shankaf7341142016-10-18 17:15:18 -070048 /**
Sudheer Shanka2250d562016-11-07 15:41:02 -080049 * Shuts down the StorageManagerService and gracefully unmounts all external media.
Sudheer Shankaf7341142016-10-18 17:15:18 -070050 * Invokes call back once the shutdown is complete.
51 */
Sudheer Shanka2250d562016-11-07 15:41:02 -080052 void shutdown(IStorageShutdownObserver observer) = 19;
Sudheer Shankaf7341142016-10-18 17:15:18 -070053 /**
Sudheer Shankaf7341142016-10-18 17:15:18 -070054 * 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 Shanka2250d562016-11-07 15:41:02 -080056 * StorageManagerService will call back to the supplied IObbActionListener to inform
Sudheer Shankaf7341142016-10-18 17:15:18 -070057 * it of the terminal state of the call.
58 */
59 void mountObb(in String rawPath, in String canonicalPath, in String key,
Sudheer Shanka34b33882016-11-01 00:13:51 -070060 IObbActionListener token, int nonce) = 21;
Sudheer Shankaf7341142016-10-18 17:15:18 -070061 /**
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 Shanka2250d562016-11-07 15:41:02 -080064 * StorageManagerService will call back to the supplied IObbActionListener to inform
Sudheer Shankaf7341142016-10-18 17:15:18 -070065 * it of the terminal state of the call.
66 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070067 void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22;
Sudheer Shankaf7341142016-10-18 17:15:18 -070068 /**
69 * Checks whether the specified Opaque Binary Blob (OBB) is mounted
70 * somewhere.
71 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070072 boolean isObbMounted(in String rawPath) = 23;
Sudheer Shankaf7341142016-10-18 17:15:18 -070073 /**
74 * Gets the path to the mounted Opaque Binary Blob (OBB).
75 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070076 String getMountedObbPath(in String rawPath) = 24;
Sudheer Shankaf7341142016-10-18 17:15:18 -070077 /**
Sudheer Shankaf7341142016-10-18 17:15:18 -070078 * Decrypts any encrypted volumes.
79 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070080 int decryptStorage(in String password) = 26;
Sudheer Shankaf7341142016-10-18 17:15:18 -070081 /**
82 * Encrypts storage.
83 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070084 int encryptStorage(int type, in String password) = 27;
Sudheer Shankaf7341142016-10-18 17:15:18 -070085 /**
86 * Changes the encryption password.
87 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070088 int changeEncryptionPassword(int type, in String password) = 28;
Sudheer Shankaf7341142016-10-18 17:15:18 -070089 /**
90 * Returns list of all mountable volumes.
91 */
Sudheer Shanka34b33882016-11-01 00:13:51 -070092 StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29;
Sudheer Shankaf7341142016-10-18 17:15:18 -070093 /**
Sudheer Shankaf7341142016-10-18 17:15:18 -070094 * 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 Shanka34b33882016-11-01 00:13:51 -0700102 int getEncryptionState() = 31;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700103 /**
104 * Verify the encryption password against the stored volume. This method
105 * may only be called by the system process.
106 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700107 int verifyEncryptionPassword(in String password) = 32;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700108 /**
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 Shanka34b33882016-11-01 00:13:51 -0700115 int mkdirs(in String callingPkg, in String path) = 34;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700116 /**
117 * Determines the type of the encryption password
118 * @return PasswordType
119 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700120 int getPasswordType() = 35;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700121 /**
122 * Get password from vold
123 * @return password or empty string
124 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700125 String getPassword() = 36;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700126 /**
127 * Securely clear password from vold
128 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700129 oneway void clearPassword() = 37;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700130 /**
131 * Set a field in the crypto header.
132 * @param field field to set
133 * @param contents contents to set in field
134 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700135 oneway void setField(in String field, in String contents) = 38;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700136 /**
137 * Gets a field from the crypto header.
138 * @param field field to get
139 * @return contents of field
140 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700141 String getField(in String field) = 39;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700142 /**
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 Shanka34b33882016-11-01 00:13:51 -0700148 long lastMaintenance() = 41;
Sudheer Shankaf7341142016-10-18 17:15:18 -0700149 /**
150 * Kick off an immediate maintenance operation
151 * @throws RemoteException
152 */
Sudheer Shanka34b33882016-11-01 00:13:51 -0700153 void runMaintenance() = 42;
Sudheer Shanka34b33882016-11-01 00:13:51 -0700154 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 Sharkey7e19f532017-11-06 13:54:11 -0700169 void benchmark(in String volId, IVoldTaskListener listener) = 59;
Sudheer Shanka34b33882016-11-01 00:13:51 -0700170 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 Shanka34b33882016-11-01 00:13:51 -0700179 void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70;
180 void fixateNewestUserKeyAuth(int userId) = 71;
Jeff Sharkey7e19f532017-11-06 13:54:11 -0700181 void fstrim(int flags, IVoldTaskListener listener) = 72;
Daichi Hirono9fb00182016-11-08 14:12:17 +0900182 AppFuseMount mountProxyFileDescriptorBridge() = 73;
183 ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74;
Jeff Sharkey9bed0702017-01-23 20:37:05 -0700184 long getCacheQuotaBytes(String volumeUuid, int uid) = 75;
185 long getCacheSizeBytes(String volumeUuid, int uid) = 76;
Jeff Sharkey35e46d22017-06-09 10:01:20 -0600186 long getAllocatableBytes(String volumeUuid, int flags, String callingPackage) = 77;
187 void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78;
Rubin Xuaa32d152017-04-27 17:01:05 +0100188 void secdiscard(in String path) = 79;
Jeff Sharkey31d0b702016-11-21 14:16:53 -0700189}