blob: f1ada6ccd2a074bf52b619c8ab23495565897784 [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
Songchun Fanab55cec2019-12-02 10:50:12 -080019import android.os.incremental.IncrementalFileSystemControlParcel;
Jeff Sharkey814e9d32017-09-13 11:49:44 -060020import android.os.IVoldListener;
Zim5048b4b2019-11-19 09:16:03 +000021import android.os.IVoldMountCallback;
Jeff Sharkey52f7a912017-09-15 12:57:44 -060022import android.os.IVoldTaskListener;
Jeff Sharkey814e9d32017-09-13 11:49:44 -060023
Jeff Sharkey068c6be2017-09-06 13:47:40 -060024/** {@hide} */
25interface IVold {
Jeff Sharkey814e9d32017-09-13 11:49:44 -060026 void setListener(IVoldListener listener);
27
Jeff Sharkeycbe69fc2017-09-15 16:50:28 -060028 void monitor();
Jeff Sharkey068c6be2017-09-06 13:47:40 -060029 void reset();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060030 void shutdown();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060031
32 void onUserAdded(int userId, int userSerial);
33 void onUserRemoved(int userId);
Sudheer Shanka5fceb482019-04-29 10:46:35 -070034 void onUserStarted(int userId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060035 void onUserStopped(int userId);
36
Sudheer Shankad484aa92018-07-31 10:07:34 -070037 void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
38 void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
39
Jeff Sharkey401b2602017-12-14 22:15:20 -070040 void onSecureKeyguardStateChanged(boolean isShowing);
41
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060042 void partition(@utf8InCpp String diskId, int partitionType, int ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060043 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060044
Zim5048b4b2019-11-19 09:16:03 +000045 void mount(@utf8InCpp String volId, int mountFlags, int mountUserId,
Zim9d1425c2019-11-27 18:15:14 +000046 @nullable IVoldMountCallback callback);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060047 void unmount(@utf8InCpp String volId);
48 void format(@utf8InCpp String volId, @utf8InCpp String fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060049 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
Jeff Sharkey2048a282017-06-15 09:59:43 -060050 void checkEncryption(@utf8InCpp String volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060051
Jeff Sharkey52f7a912017-09-15 12:57:44 -060052 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070053 IVoldTaskListener listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060054
55 void remountUid(int uid, int remountMode);
56
Martijn Coenen8a68a072020-02-12 15:29:02 +010057 void setupAppDir(@utf8InCpp String path, int appUid);
Martijn Coenen816f4d92020-02-18 15:06:37 +010058 void fixupAppDir(@utf8InCpp String path, int appUid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060059
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070060 @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
61 int ownerGid);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060062 void destroyObb(@utf8InCpp String volId);
63
Jeff Sharkey52f7a912017-09-15 12:57:44 -060064 void fstrim(int fstrimFlags, IVoldTaskListener listener);
Jin Qiana370c142017-10-17 15:41:45 -070065 void runIdleMaint(IVoldTaskListener listener);
66 void abortIdleMaint(IVoldTaskListener listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060067
Risan8f6198d2018-10-26 20:56:45 -060068 FileDescriptor mountAppFuse(int uid, int mountId);
69 void unmountAppFuse(int uid, int mountId);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060070
Jeff Sharkey83b559c2017-09-12 16:30:52 -060071 void fdeCheckPassword(@utf8InCpp String password);
72 void fdeRestart();
73 int fdeComplete();
74 void fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags);
75 void fdeChangePassword(int passwordType, @utf8InCpp String password);
76 void fdeVerifyPassword(@utf8InCpp String password);
77 @utf8InCpp String fdeGetField(@utf8InCpp String key);
78 void fdeSetField(@utf8InCpp String key, @utf8InCpp String value);
79 int fdeGetPasswordType();
80 @utf8InCpp String fdeGetPassword();
81 void fdeClearPassword();
82
83 void fbeEnable();
84
85 void mountDefaultEncrypted();
86 void initUser0();
87 boolean isConvertibleToFbe();
Paul Lawrence236e5e82019-06-25 14:44:33 -070088 void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
89 void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060090
91 void createUserKey(int userId, int userSerial, boolean ephemeral);
92 void destroyUserKey(int userId);
93
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070094 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
95 @utf8InCpp String secret);
Barani Muthukumaran9ad51ad2019-10-31 22:59:34 -070096 void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
97 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060098 void fixateNewestUserKeyAuth(int userId);
99
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700100 void unlockUserKey(int userId, int userSerial, @utf8InCpp String token,
101 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600102 void lockUserKey(int userId);
103
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700104 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
105 int storageFlags);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600106 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
107
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700108 void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
109 in @utf8InCpp String sandboxId, int userId);
Sudheer Shanka69bc40f2018-10-25 11:06:55 -0700110 void destroySandboxForApp(in @utf8InCpp String packageName,
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700111 in @utf8InCpp String sandboxId, int userId);
Sudheer Shankac7562092018-08-24 10:20:56 -0700112
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700113 void startCheckpoint(int retry);
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700114 boolean needsCheckpoint();
Daniel Rosenbergd3992492018-10-02 17:40:44 -0700115 boolean needsRollback();
Daniel Rosenberga59e4392019-03-20 17:02:47 -0700116 void abortChanges(in @utf8InCpp String device, boolean retry);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700117 void commitChanges();
118 void prepareCheckpoint();
119 void restoreCheckpoint(@utf8InCpp String device);
Daniel Rosenbergdda59812019-03-06 17:45:17 -0800120 void restoreCheckpointPart(@utf8InCpp String device, int count);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700121 void markBootAttempt();
Daniel Rosenberg9b667fb2019-01-22 17:27:25 -0800122 boolean supportsCheckpoint();
Paul Lawrencec5c79c52019-03-18 13:36:40 -0700123 boolean supportsBlockCheckpoint();
124 boolean supportsFileCheckpoint();
Nikita Ioffea5798fc2019-10-11 16:38:21 +0100125 void resetCheckpoint();
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700126
Risan8c9f3322018-10-29 08:52:56 +0900127 @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
128 @utf8InCpp String mountPath, @utf8InCpp String fsType,
Risan82e90de2020-02-04 16:07:21 +0900129 @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags);
Risan8c9f3322018-10-29 08:52:56 +0900130 void destroyStubVolume(@utf8InCpp String volId);
131
Risan8f6198d2018-10-26 20:56:45 -0600132 FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
133
Yurii Zubrytskyi3497cb52020-01-10 11:54:06 -0800134 boolean incFsEnabled();
135 IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags);
Songchun Fanab55cec2019-12-02 10:50:12 -0800136 void unmountIncFs(@utf8InCpp String dir);
137 void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
138
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600139 const int ENCRYPTION_FLAG_NO_UI = 4;
140
141 const int ENCRYPTION_STATE_NONE = 1;
142 const int ENCRYPTION_STATE_OK = 0;
143 const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
144 const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
145 const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
146 const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
147
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600148 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600149
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600150 const int MOUNT_FLAG_PRIMARY = 1;
151 const int MOUNT_FLAG_VISIBLE = 2;
152
153 const int PARTITION_TYPE_PUBLIC = 0;
154 const int PARTITION_TYPE_PRIVATE = 1;
155 const int PARTITION_TYPE_MIXED = 2;
156
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600157 const int PASSWORD_TYPE_PASSWORD = 0;
158 const int PASSWORD_TYPE_DEFAULT = 1;
Paul Crowleyca08c0a2018-07-03 11:49:00 -0700159 const int PASSWORD_TYPE_PATTERN = 2;
160 const int PASSWORD_TYPE_PIN = 3;
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600161
162 const int STORAGE_FLAG_DE = 1;
163 const int STORAGE_FLAG_CE = 2;
164
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600165 const int REMOUNT_MODE_NONE = 0;
166 const int REMOUNT_MODE_DEFAULT = 1;
167 const int REMOUNT_MODE_READ = 2;
168 const int REMOUNT_MODE_WRITE = 3;
Sudheer Shanka55049012019-01-09 12:15:15 -0800169 const int REMOUNT_MODE_LEGACY = 4;
170 const int REMOUNT_MODE_INSTALLER = 5;
171 const int REMOUNT_MODE_FULL = 6;
Zim981222f2019-09-09 10:24:44 +0100172 const int REMOUNT_MODE_PASS_THROUGH = 7;
Martijn Coenenb52eb852020-01-08 15:04:21 +0100173 const int REMOUNT_MODE_ANDROID_WRITABLE = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600174
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600175 const int VOLUME_STATE_UNMOUNTED = 0;
176 const int VOLUME_STATE_CHECKING = 1;
177 const int VOLUME_STATE_MOUNTED = 2;
178 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
179 const int VOLUME_STATE_FORMATTING = 4;
180 const int VOLUME_STATE_EJECTING = 5;
181 const int VOLUME_STATE_UNMOUNTABLE = 6;
182 const int VOLUME_STATE_REMOVED = 7;
183 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600184
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600185 const int VOLUME_TYPE_PUBLIC = 0;
186 const int VOLUME_TYPE_PRIVATE = 1;
187 const int VOLUME_TYPE_EMULATED = 2;
188 const int VOLUME_TYPE_ASEC = 3;
189 const int VOLUME_TYPE_OBB = 4;
Risan8c9f3322018-10-29 08:52:56 +0900190 const int VOLUME_TYPE_STUB = 5;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600191}