1 /*
2  * Copyright (C) 2017 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;
18 
19 import android.os.incremental.IncrementalFileSystemControlParcel;
20 import android.os.IVoldListener;
21 import android.os.IVoldMountCallback;
22 import android.os.IVoldTaskListener;
23 
24 /** {@hide} */
25 interface IVold {
setListener(IVoldListener listener)26     void setListener(IVoldListener listener);
27 
abortFuse()28     void abortFuse();
monitor()29     void monitor();
reset()30     void reset();
shutdown()31     void shutdown();
32 
onUserAdded(int userId, int userSerial)33     void onUserAdded(int userId, int userSerial);
onUserRemoved(int userId)34     void onUserRemoved(int userId);
onUserStarted(int userId)35     void onUserStarted(int userId);
onUserStopped(int userId)36     void onUserStopped(int userId);
37 
addAppIds(in @tf8InCpp String[] packageNames, in int[] appIds)38     void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds)39     void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
40 
onSecureKeyguardStateChanged(boolean isShowing)41     void onSecureKeyguardStateChanged(boolean isShowing);
42 
partition(@tf8InCpp String diskId, int partitionType, int ratio)43     void partition(@utf8InCpp String diskId, int partitionType, int ratio);
forgetPartition(@tf8InCpp String partGuid, @utf8InCpp String fsUuid)44     void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
45 
mount(@tf8InCpp String volId, int mountFlags, int mountUserId, @nullable IVoldMountCallback callback)46     void mount(@utf8InCpp String volId, int mountFlags, int mountUserId,
47          @nullable IVoldMountCallback callback);
unmount(@tf8InCpp String volId)48     void unmount(@utf8InCpp String volId);
format(@tf8InCpp String volId, @utf8InCpp String fsType)49     void format(@utf8InCpp String volId, @utf8InCpp String fsType);
benchmark(@tf8InCpp String volId, IVoldTaskListener listener)50     void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
51 
moveStorage(@tf8InCpp String fromVolId, @utf8InCpp String toVolId, IVoldTaskListener listener)52     void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
53                      IVoldTaskListener listener);
54 
remountUid(int uid, int remountMode)55     void remountUid(int uid, int remountMode);
remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)56     void remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)57     void unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
58 
setupAppDir(@tf8InCpp String path, int appUid)59     void setupAppDir(@utf8InCpp String path, int appUid);
fixupAppDir(@tf8InCpp String path, int appUid)60     void fixupAppDir(@utf8InCpp String path, int appUid);
ensureAppDirsCreated(in @tf8InCpp String[] paths, int appUid)61     void ensureAppDirsCreated(in @utf8InCpp String[] paths, int appUid);
62 
createObb(@tf8InCpp String sourcePath, @utf8InCpp String sourceKey, int ownerGid)63     @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
64                                 int ownerGid);
destroyObb(@tf8InCpp String volId)65     void destroyObb(@utf8InCpp String volId);
66 
fstrim(int fstrimFlags, IVoldTaskListener listener)67     void fstrim(int fstrimFlags, IVoldTaskListener listener);
runIdleMaint(IVoldTaskListener listener)68     void runIdleMaint(IVoldTaskListener listener);
abortIdleMaint(IVoldTaskListener listener)69     void abortIdleMaint(IVoldTaskListener listener);
70 
mountAppFuse(int uid, int mountId)71     FileDescriptor mountAppFuse(int uid, int mountId);
unmountAppFuse(int uid, int mountId)72     void unmountAppFuse(int uid, int mountId);
73 
fdeCheckPassword(@tf8InCpp String password)74     void fdeCheckPassword(@utf8InCpp String password);
fdeRestart()75     void fdeRestart();
fdeComplete()76     int fdeComplete();
fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags)77     void fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags);
fdeChangePassword(int passwordType, @utf8InCpp String password)78     void fdeChangePassword(int passwordType, @utf8InCpp String password);
fdeVerifyPassword(@tf8InCpp String password)79     void fdeVerifyPassword(@utf8InCpp String password);
fdeGetField(@tf8InCpp String key)80     @utf8InCpp String fdeGetField(@utf8InCpp String key);
fdeSetField(@tf8InCpp String key, @utf8InCpp String value)81     void fdeSetField(@utf8InCpp String key, @utf8InCpp String value);
fdeGetPasswordType()82     int fdeGetPasswordType();
fdeGetPassword()83     @utf8InCpp String fdeGetPassword();
fdeClearPassword()84     void fdeClearPassword();
85 
fbeEnable()86     void fbeEnable();
87 
mountDefaultEncrypted()88     void mountDefaultEncrypted();
initUser0()89     void initUser0();
isConvertibleToFbe()90     boolean isConvertibleToFbe();
mountFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint)91     void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
encryptFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType)92     void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType);
93 
setStorageBindingSeed(in byte[] seed)94     void setStorageBindingSeed(in byte[] seed);
95 
createUserKey(int userId, int userSerial, boolean ephemeral)96     void createUserKey(int userId, int userSerial, boolean ephemeral);
destroyUserKey(int userId)97     void destroyUserKey(int userId);
98 
addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret)99     void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
100                         @utf8InCpp String secret);
clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret)101     void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
102                         @utf8InCpp String secret);
fixateNewestUserKeyAuth(int userId)103     void fixateNewestUserKeyAuth(int userId);
104 
getUnlockedUsers()105     int[] getUnlockedUsers();
unlockUserKey(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret)106     void unlockUserKey(int userId, int userSerial, @utf8InCpp String token,
107                        @utf8InCpp String secret);
lockUserKey(int userId)108     void lockUserKey(int userId);
109 
prepareUserStorage(@ullable @tf8InCpp String uuid, int userId, int userSerial, int storageFlags)110     void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
111                             int storageFlags);
destroyUserStorage(@ullable @tf8InCpp String uuid, int userId, int storageFlags)112     void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
113 
prepareSandboxForApp(in @tf8InCpp String packageName, int appId, in @utf8InCpp String sandboxId, int userId)114     void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
115                               in @utf8InCpp String sandboxId, int userId);
destroySandboxForApp(in @tf8InCpp String packageName, in @utf8InCpp String sandboxId, int userId)116     void destroySandboxForApp(in @utf8InCpp String packageName,
117                               in @utf8InCpp String sandboxId, int userId);
118 
startCheckpoint(int retry)119     void startCheckpoint(int retry);
needsCheckpoint()120     boolean needsCheckpoint();
needsRollback()121     boolean needsRollback();
isCheckpointing()122     boolean isCheckpointing();
abortChanges(in @tf8InCpp String device, boolean retry)123     void abortChanges(in @utf8InCpp String device, boolean retry);
commitChanges()124     void commitChanges();
prepareCheckpoint()125     void prepareCheckpoint();
restoreCheckpoint(@tf8InCpp String device)126     void restoreCheckpoint(@utf8InCpp String device);
restoreCheckpointPart(@tf8InCpp String device, int count)127     void restoreCheckpointPart(@utf8InCpp String device, int count);
markBootAttempt()128     void markBootAttempt();
supportsCheckpoint()129     boolean supportsCheckpoint();
supportsBlockCheckpoint()130     boolean supportsBlockCheckpoint();
supportsFileCheckpoint()131     boolean supportsFileCheckpoint();
resetCheckpoint()132     void resetCheckpoint();
133 
earlyBootEnded()134     void earlyBootEnded();
createStubVolume(@tf8InCpp String sourcePath, @utf8InCpp String mountPath, @utf8InCpp String fsType, @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags)135     @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
136             @utf8InCpp String mountPath, @utf8InCpp String fsType,
137             @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags);
destroyStubVolume(@tf8InCpp String volId)138     void destroyStubVolume(@utf8InCpp String volId);
139 
openAppFuseFile(int uid, int mountId, int fileId, int flags)140     FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
141 
incFsEnabled()142     boolean incFsEnabled();
mountIncFs(@tf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName)143     IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName);
unmountIncFs(@tf8InCpp String dir)144     void unmountIncFs(@utf8InCpp String dir);
setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName)145     void setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName);
bindMount(@tf8InCpp String sourceDir, @utf8InCpp String targetDir)146     void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
147 
destroyDsuMetadataKey(@tf8InCpp String dsuSlot)148     void destroyDsuMetadataKey(@utf8InCpp String dsuSlot);
149 
150     const int ENCRYPTION_FLAG_NO_UI = 4;
151 
152     const int ENCRYPTION_STATE_NONE = 1;
153     const int ENCRYPTION_STATE_OK = 0;
154     const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
155     const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
156     const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
157     const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
158 
159     const int FSTRIM_FLAG_DEEP_TRIM = 1;
160 
161     const int MOUNT_FLAG_PRIMARY = 1;
162     const int MOUNT_FLAG_VISIBLE = 2;
163 
164     const int PARTITION_TYPE_PUBLIC = 0;
165     const int PARTITION_TYPE_PRIVATE = 1;
166     const int PARTITION_TYPE_MIXED = 2;
167 
168     const int PASSWORD_TYPE_PASSWORD = 0;
169     const int PASSWORD_TYPE_DEFAULT = 1;
170     const int PASSWORD_TYPE_PATTERN = 2;
171     const int PASSWORD_TYPE_PIN = 3;
172 
173     const int STORAGE_FLAG_DE = 1;
174     const int STORAGE_FLAG_CE = 2;
175 
176     const int REMOUNT_MODE_NONE = 0;
177     const int REMOUNT_MODE_DEFAULT = 1;
178     const int REMOUNT_MODE_INSTALLER = 2;
179     const int REMOUNT_MODE_PASS_THROUGH = 3;
180     const int REMOUNT_MODE_ANDROID_WRITABLE = 4;
181 
182     const int VOLUME_STATE_UNMOUNTED = 0;
183     const int VOLUME_STATE_CHECKING = 1;
184     const int VOLUME_STATE_MOUNTED = 2;
185     const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
186     const int VOLUME_STATE_FORMATTING = 4;
187     const int VOLUME_STATE_EJECTING = 5;
188     const int VOLUME_STATE_UNMOUNTABLE = 6;
189     const int VOLUME_STATE_REMOVED = 7;
190     const int VOLUME_STATE_BAD_REMOVAL = 8;
191 
192     const int VOLUME_TYPE_PUBLIC = 0;
193     const int VOLUME_TYPE_PRIVATE = 1;
194     const int VOLUME_TYPE_EMULATED = 2;
195     const int VOLUME_TYPE_ASEC = 3;
196     const int VOLUME_TYPE_OBB = 4;
197     const int VOLUME_TYPE_STUB = 5;
198 }
199