blob: a664dfa28b4f4b750739cad52a5464b00fee3359 [file] [log] [blame]
Jeff Sharkey068c6be2017-09-06 13:47:40 -06001/*
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
Jeff Sharkey814e9d32017-09-13 11:49:44 -060019import android.os.IVoldListener;
Jeff Sharkey52f7a912017-09-15 12:57:44 -060020import android.os.IVoldTaskListener;
Jeff Sharkey814e9d32017-09-13 11:49:44 -060021
Jeff Sharkey068c6be2017-09-06 13:47:40 -060022/** {@hide} */
23interface IVold {
Jeff Sharkey814e9d32017-09-13 11:49:44 -060024 void setListener(IVoldListener listener);
25
Jeff Sharkeycbe69fc2017-09-15 16:50:28 -060026 void monitor();
Jeff Sharkey068c6be2017-09-06 13:47:40 -060027 void reset();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060028 void shutdown();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060029
30 void onUserAdded(int userId, int userSerial);
31 void onUserRemoved(int userId);
32 void onUserStarted(int userId);
33 void onUserStopped(int userId);
34
Jeff Sharkey401b2602017-12-14 22:15:20 -070035 void onSecureKeyguardStateChanged(boolean isShowing);
36
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060037 void partition(@utf8InCpp String diskId, int partitionType, int ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060038 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060039
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);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060043 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
Jeff Sharkey2048a282017-06-15 09:59:43 -060044 void checkEncryption(@utf8InCpp String volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060045
Jeff Sharkey52f7a912017-09-15 12:57:44 -060046 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
47 IVoldTaskListener listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060048
49 void remountUid(int uid, int remountMode);
50
51 void mkdirs(@utf8InCpp String path);
52
Jeff Sharkey11c2d382017-09-11 10:32:01 -060053 @utf8InCpp String createObb(@utf8InCpp String sourcePath,
54 @utf8InCpp String sourceKey, int ownerGid);
55 void destroyObb(@utf8InCpp String volId);
56
Jeff Sharkey52f7a912017-09-15 12:57:44 -060057 void fstrim(int fstrimFlags, IVoldTaskListener listener);
Jin Qiana370c142017-10-17 15:41:45 -070058 void runIdleMaint(IVoldTaskListener listener);
59 void abortIdleMaint(IVoldTaskListener listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060060
61 FileDescriptor mountAppFuse(int uid, int pid, int mountId);
62 void unmountAppFuse(int uid, int pid, int mountId);
63
Jeff Sharkey83b559c2017-09-12 16:30:52 -060064 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();
Paul Crowley0fd26262018-01-30 09:48:19 -080081 void mountFstab(@utf8InCpp String mountPoint);
82 void encryptFstab(@utf8InCpp String mountPoint);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060083
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 void secdiscard(@utf8InCpp String path);
97
Jeff Sharkey83b559c2017-09-12 16:30:52 -060098 const int ENCRYPTION_FLAG_NO_UI = 4;
99
100 const int ENCRYPTION_STATE_NONE = 1;
101 const int ENCRYPTION_STATE_OK = 0;
102 const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
103 const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
104 const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
105 const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
106
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600107 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600108
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600109 const int MOUNT_FLAG_PRIMARY = 1;
110 const int MOUNT_FLAG_VISIBLE = 2;
111
112 const int PARTITION_TYPE_PUBLIC = 0;
113 const int PARTITION_TYPE_PRIVATE = 1;
114 const int PARTITION_TYPE_MIXED = 2;
115
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600116 const int PASSWORD_TYPE_PASSWORD = 0;
117 const int PASSWORD_TYPE_DEFAULT = 1;
118 const int PASSWORD_TYPE_PIN = 2;
119 const int PASSWORD_TYPE_PATTERN = 3;
120
121 const int STORAGE_FLAG_DE = 1;
122 const int STORAGE_FLAG_CE = 2;
123
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600124 const int REMOUNT_MODE_NONE = 0;
125 const int REMOUNT_MODE_DEFAULT = 1;
126 const int REMOUNT_MODE_READ = 2;
127 const int REMOUNT_MODE_WRITE = 3;
128
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600129 const int VOLUME_STATE_UNMOUNTED = 0;
130 const int VOLUME_STATE_CHECKING = 1;
131 const int VOLUME_STATE_MOUNTED = 2;
132 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
133 const int VOLUME_STATE_FORMATTING = 4;
134 const int VOLUME_STATE_EJECTING = 5;
135 const int VOLUME_STATE_UNMOUNTABLE = 6;
136 const int VOLUME_STATE_REMOVED = 7;
137 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600138
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600139 const int VOLUME_TYPE_PUBLIC = 0;
140 const int VOLUME_TYPE_PRIVATE = 1;
141 const int VOLUME_TYPE_EMULATED = 2;
142 const int VOLUME_TYPE_ASEC = 3;
143 const int VOLUME_TYPE_OBB = 4;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600144}