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