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
17package android.os;
18
19import android.os.IVoldListener;
20import android.os.IVoldTaskListener;
21
22/** {@hide} */
23interface IVold {
24    void setListener(IVoldListener listener);
25
26    void monitor();
27    void reset();
28    void shutdown();
29
30    void onUserAdded(int userId, int userSerial);
31    void onUserRemoved(int userId);
32    void onUserStarted(int userId);
33    void onUserStopped(int userId);
34
35    void onSecureKeyguardStateChanged(boolean isShowing);
36
37    void partition(@utf8InCpp String diskId, int partitionType, int ratio);
38    void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
39
40    void mount(@utf8InCpp String volId, int mountFlags, int mountUserId);
41    void unmount(@utf8InCpp String volId);
42    void format(@utf8InCpp String volId, @utf8InCpp String fsType);
43    void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
44    void checkEncryption(@utf8InCpp String volId);
45
46    void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
47            IVoldTaskListener listener);
48
49    void remountUid(int uid, int remountMode);
50
51    void mkdirs(@utf8InCpp String path);
52
53    @utf8InCpp String createObb(@utf8InCpp String sourcePath,
54            @utf8InCpp String sourceKey, int ownerGid);
55    void destroyObb(@utf8InCpp String volId);
56
57    void fstrim(int fstrimFlags, IVoldTaskListener listener);
58    void runIdleMaint(IVoldTaskListener listener);
59    void abortIdleMaint(IVoldTaskListener listener);
60
61    FileDescriptor mountAppFuse(int uid, int pid, int mountId);
62    void unmountAppFuse(int uid, int pid, int mountId);
63
64    void fdeCheckPassword(@utf8InCpp String password);
65    void fdeRestart();
66    int fdeComplete();
67    void fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags);
68    void fdeChangePassword(int passwordType, @utf8InCpp String password);
69    void fdeVerifyPassword(@utf8InCpp String password);
70    @utf8InCpp String fdeGetField(@utf8InCpp String key);
71    void fdeSetField(@utf8InCpp String key, @utf8InCpp String value);
72    int fdeGetPasswordType();
73    @utf8InCpp String fdeGetPassword();
74    void fdeClearPassword();
75
76    void fbeEnable();
77
78    void mountDefaultEncrypted();
79    void initUser0();
80    boolean isConvertibleToFbe();
81    void mountFstab(@utf8InCpp String mountPoint);
82    void encryptFstab(@utf8InCpp String mountPoint);
83
84    void createUserKey(int userId, int userSerial, boolean ephemeral);
85    void destroyUserKey(int userId);
86
87    void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret);
88    void fixateNewestUserKeyAuth(int userId);
89
90    void unlockUserKey(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret);
91    void lockUserKey(int userId);
92
93    void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial, int storageFlags);
94    void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
95
96    const int ENCRYPTION_FLAG_NO_UI = 4;
97
98    const int ENCRYPTION_STATE_NONE = 1;
99    const int ENCRYPTION_STATE_OK = 0;
100    const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
101    const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
102    const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
103    const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
104
105    const int FSTRIM_FLAG_DEEP_TRIM = 1;
106
107    const int MOUNT_FLAG_PRIMARY = 1;
108    const int MOUNT_FLAG_VISIBLE = 2;
109
110    const int PARTITION_TYPE_PUBLIC = 0;
111    const int PARTITION_TYPE_PRIVATE = 1;
112    const int PARTITION_TYPE_MIXED = 2;
113
114    const int PASSWORD_TYPE_PASSWORD = 0;
115    const int PASSWORD_TYPE_DEFAULT = 1;
116    const int PASSWORD_TYPE_PIN = 2;
117    const int PASSWORD_TYPE_PATTERN = 3;
118
119    const int STORAGE_FLAG_DE = 1;
120    const int STORAGE_FLAG_CE = 2;
121
122    const int REMOUNT_MODE_NONE = 0;
123    const int REMOUNT_MODE_DEFAULT = 1;
124    const int REMOUNT_MODE_READ = 2;
125    const int REMOUNT_MODE_WRITE = 3;
126
127    const int VOLUME_STATE_UNMOUNTED = 0;
128    const int VOLUME_STATE_CHECKING = 1;
129    const int VOLUME_STATE_MOUNTED = 2;
130    const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
131    const int VOLUME_STATE_FORMATTING = 4;
132    const int VOLUME_STATE_EJECTING = 5;
133    const int VOLUME_STATE_UNMOUNTABLE = 6;
134    const int VOLUME_STATE_REMOVED = 7;
135    const int VOLUME_STATE_BAD_REMOVAL = 8;
136
137    const int VOLUME_TYPE_PUBLIC = 0;
138    const int VOLUME_TYPE_PRIVATE = 1;
139    const int VOLUME_TYPE_EMULATED = 2;
140    const int VOLUME_TYPE_ASEC = 3;
141    const int VOLUME_TYPE_OBB = 4;
142}
143