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