blob: ea984506ec84a31a09f50af9b78ad55b488c7558 [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,
Paul Crowley8915d622018-09-18 15:14:18 -070047 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
Paul Crowley8915d622018-09-18 15:14:18 -070053 @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
54 int ownerGid);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060055 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
Paul Crowley8915d622018-09-18 15:14:18 -070087 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
88 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060089 void fixateNewestUserKeyAuth(int userId);
90
Paul Crowley8915d622018-09-18 15:14:18 -070091 void unlockUserKey(int userId, int userSerial, @utf8InCpp String token,
92 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060093 void lockUserKey(int userId);
94
Paul Crowley8915d622018-09-18 15:14:18 -070095 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
96 int storageFlags);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060097 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
98
Daniel Rosenberg73680ec2018-10-10 18:52:04 -070099 void startCheckpoint(int retry);
Daniel Rosenberg65f99c92018-08-28 01:58:49 -0700100 boolean needsCheckpoint();
Daniel Rosenbergd3992492018-10-02 17:40:44 -0700101 boolean needsRollback();
Daniel Rosenberg65f99c92018-08-28 01:58:49 -0700102 void abortChanges();
Daniel Rosenberg73680ec2018-10-10 18:52:04 -0700103 void commitChanges();
104 void prepareCheckpoint();
105 void restoreCheckpoint(@utf8InCpp String device);
106 void markBootAttempt();
Daniel Rosenberg65f99c92018-08-28 01:58:49 -0700107
Risan8c9f3322018-10-29 08:52:56 +0900108 @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
109 @utf8InCpp String mountPath, @utf8InCpp String fsType,
110 @utf8InCpp String fsUuid, @utf8InCpp String fsLabel);
111 void destroyStubVolume(@utf8InCpp String volId);
112
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600113 const int ENCRYPTION_FLAG_NO_UI = 4;
114
115 const int ENCRYPTION_STATE_NONE = 1;
116 const int ENCRYPTION_STATE_OK = 0;
117 const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
118 const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
119 const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
120 const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
121
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600122 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600123
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600124 const int MOUNT_FLAG_PRIMARY = 1;
125 const int MOUNT_FLAG_VISIBLE = 2;
126
127 const int PARTITION_TYPE_PUBLIC = 0;
128 const int PARTITION_TYPE_PRIVATE = 1;
129 const int PARTITION_TYPE_MIXED = 2;
130
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600131 const int PASSWORD_TYPE_PASSWORD = 0;
132 const int PASSWORD_TYPE_DEFAULT = 1;
Paul Crowleyca08c0a2018-07-03 11:49:00 -0700133 const int PASSWORD_TYPE_PATTERN = 2;
134 const int PASSWORD_TYPE_PIN = 3;
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600135
136 const int STORAGE_FLAG_DE = 1;
137 const int STORAGE_FLAG_CE = 2;
138
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600139 const int REMOUNT_MODE_NONE = 0;
140 const int REMOUNT_MODE_DEFAULT = 1;
141 const int REMOUNT_MODE_READ = 2;
142 const int REMOUNT_MODE_WRITE = 3;
143
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600144 const int VOLUME_STATE_UNMOUNTED = 0;
145 const int VOLUME_STATE_CHECKING = 1;
146 const int VOLUME_STATE_MOUNTED = 2;
147 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
148 const int VOLUME_STATE_FORMATTING = 4;
149 const int VOLUME_STATE_EJECTING = 5;
150 const int VOLUME_STATE_UNMOUNTABLE = 6;
151 const int VOLUME_STATE_REMOVED = 7;
152 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600153
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600154 const int VOLUME_TYPE_PUBLIC = 0;
155 const int VOLUME_TYPE_PRIVATE = 1;
156 const int VOLUME_TYPE_EMULATED = 2;
157 const int VOLUME_TYPE_ASEC = 3;
158 const int VOLUME_TYPE_OBB = 4;
Risan8c9f3322018-10-29 08:52:56 +0900159 const int VOLUME_TYPE_STUB = 5;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600160}