IStorageManager.aidl revision 7e19f53f75386eab289a2ddf33dd6619775d6f21
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.IVoldTaskListener;
21import android.os.ParcelFileDescriptor;
22import android.os.storage.DiskInfo;
23import android.os.storage.IStorageEventListener;
24import android.os.storage.IStorageShutdownObserver;
25import android.os.storage.IObbActionListener;
26import android.os.storage.StorageVolume;
27import android.os.storage.VolumeInfo;
28import android.os.storage.VolumeRecord;
29import com.android.internal.os.AppFuseMount;
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 */
39interface IStorageManager {
40    /**
41     * Registers an IStorageEventListener for receiving async notifications.
42     */
43    void registerListener(IStorageEventListener listener) = 0;
44    /**
45     * Unregisters an IStorageEventListener
46     */
47    void unregisterListener(IStorageEventListener listener) = 1;
48    /**
49     * Shuts down the StorageManagerService and gracefully unmounts all external media.
50     * Invokes call back once the shutdown is complete.
51     */
52    void shutdown(IStorageShutdownObserver observer) = 19;
53    /**
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.
56     * StorageManagerService will call back to the supplied IObbActionListener to inform
57     * it of the terminal state of the call.
58     */
59    void mountObb(in String rawPath, in String canonicalPath, in String key,
60            IObbActionListener token, int nonce) = 21;
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.
64     * StorageManagerService will call back to the supplied IObbActionListener to inform
65     * it of the terminal state of the call.
66     */
67    void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22;
68    /**
69     * Checks whether the specified Opaque Binary Blob (OBB) is mounted
70     * somewhere.
71     */
72    boolean isObbMounted(in String rawPath) = 23;
73    /**
74     * Gets the path to the mounted Opaque Binary Blob (OBB).
75     */
76    String getMountedObbPath(in String rawPath) = 24;
77    /**
78     * Decrypts any encrypted volumes.
79     */
80    int decryptStorage(in String password) = 26;
81    /**
82     * Encrypts storage.
83     */
84    int encryptStorage(int type, in String password) = 27;
85    /**
86     * Changes the encryption password.
87     */
88    int changeEncryptionPassword(int type, in String password) = 28;
89    /**
90     * Returns list of all mountable volumes.
91     */
92    StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29;
93    /**
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     */
102    int getEncryptionState() = 31;
103    /**
104     * Verify the encryption password against the stored volume.  This method
105     * may only be called by the system process.
106     */
107    int verifyEncryptionPassword(in String password) = 32;
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     */
115    int mkdirs(in String callingPkg, in String path) = 34;
116    /**
117     * Determines the type of the encryption password
118     * @return PasswordType
119     */
120    int getPasswordType() = 35;
121    /**
122     * Get password from vold
123     * @return password or empty string
124     */
125    String getPassword() = 36;
126    /**
127     * Securely clear password from vold
128     */
129    oneway void clearPassword() = 37;
130    /**
131     * Set a field in the crypto header.
132     * @param field field to set
133     * @param contents contents to set in field
134     */
135    oneway void setField(in String field, in String contents) = 38;
136    /**
137     * Gets a field from the crypto header.
138     * @param field field to get
139     * @return contents of field
140     */
141    String getField(in String field) = 39;
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     */
148    long lastMaintenance() = 41;
149    /**
150     * Kick off an immediate maintenance operation
151     * @throws RemoteException
152     */
153    void runMaintenance() = 42;
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;
169    void benchmark(in String volId, IVoldTaskListener listener) = 59;
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;
179    void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70;
180    void fixateNewestUserKeyAuth(int userId) = 71;
181    void fstrim(int flags, IVoldTaskListener listener) = 72;
182    AppFuseMount mountProxyFileDescriptorBridge() = 73;
183    ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74;
184    long getCacheQuotaBytes(String volumeUuid, int uid) = 75;
185    long getCacheSizeBytes(String volumeUuid, int uid) = 76;
186    long getAllocatableBytes(String volumeUuid, int flags, String callingPackage) = 77;
187    void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78;
188    void secdiscard(in String path) = 79;
189}
190