blob: cde6952588493813e10f1c19d4ba185b2b09900c [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;
Jeff Sharkey52f7a912017-09-15 12:57:44 -060021import android.os.IVoldTaskListener;
Jeff Sharkey814e9d32017-09-13 11:49:44 -060022
Jeff Sharkey068c6be2017-09-06 13:47:40 -060023/** {@hide} */
24interface IVold {
Jeff Sharkey814e9d32017-09-13 11:49:44 -060025 void setListener(IVoldListener listener);
26
Jeff Sharkeycbe69fc2017-09-15 16:50:28 -060027 void monitor();
Jeff Sharkey068c6be2017-09-06 13:47:40 -060028 void reset();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060029 void shutdown();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060030
31 void onUserAdded(int userId, int userSerial);
32 void onUserRemoved(int userId);
Sudheer Shanka5fceb482019-04-29 10:46:35 -070033 void onUserStarted(int userId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060034 void onUserStopped(int userId);
35
Sudheer Shankad484aa92018-07-31 10:07:34 -070036 void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
37 void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
38
Jeff Sharkey401b2602017-12-14 22:15:20 -070039 void onSecureKeyguardStateChanged(boolean isShowing);
40
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060041 void partition(@utf8InCpp String diskId, int partitionType, int ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060042 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060043
44 void mount(@utf8InCpp String volId, int mountFlags, int mountUserId);
45 void unmount(@utf8InCpp String volId);
46 void format(@utf8InCpp String volId, @utf8InCpp String fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060047 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060048
Jeff Sharkey52f7a912017-09-15 12:57:44 -060049 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070050 IVoldTaskListener listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060051
52 void remountUid(int uid, int remountMode);
53
54 void mkdirs(@utf8InCpp String path);
55
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070056 @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
57 int ownerGid);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060058 void destroyObb(@utf8InCpp String volId);
59
Jeff Sharkey52f7a912017-09-15 12:57:44 -060060 void fstrim(int fstrimFlags, IVoldTaskListener listener);
Jin Qiana370c142017-10-17 15:41:45 -070061 void runIdleMaint(IVoldTaskListener listener);
62 void abortIdleMaint(IVoldTaskListener listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060063
Risan8f6198d2018-10-26 20:56:45 -060064 FileDescriptor mountAppFuse(int uid, int mountId);
65 void unmountAppFuse(int uid, int mountId);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060066
Jeff Sharkey83b559c2017-09-12 16:30:52 -060067 void fdeCheckPassword(@utf8InCpp String password);
68 void fdeRestart();
69 int fdeComplete();
70 void fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags);
71 void fdeChangePassword(int passwordType, @utf8InCpp String password);
72 void fdeVerifyPassword(@utf8InCpp String password);
73 @utf8InCpp String fdeGetField(@utf8InCpp String key);
74 void fdeSetField(@utf8InCpp String key, @utf8InCpp String value);
75 int fdeGetPasswordType();
76 @utf8InCpp String fdeGetPassword();
77 void fdeClearPassword();
78
79 void fbeEnable();
80
81 void mountDefaultEncrypted();
82 void initUser0();
83 boolean isConvertibleToFbe();
Paul Lawrence236e5e82019-06-25 14:44:33 -070084 void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
85 void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060086
87 void createUserKey(int userId, int userSerial, boolean ephemeral);
88 void destroyUserKey(int userId);
89
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070090 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
91 @utf8InCpp String secret);
Barani Muthukumaranb1927c22019-10-31 22:59:34 -070092 void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
93 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060094 void fixateNewestUserKeyAuth(int userId);
95
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070096 void unlockUserKey(int userId, int userSerial, @utf8InCpp String token,
97 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060098 void lockUserKey(int userId);
99
Paul Crowleyedf7a4e2018-09-18 15:14:18 -0700100 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
101 int storageFlags);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600102 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
103
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700104 void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
105 in @utf8InCpp String sandboxId, int userId);
Sudheer Shanka69bc40f2018-10-25 11:06:55 -0700106 void destroySandboxForApp(in @utf8InCpp String packageName,
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700107 in @utf8InCpp String sandboxId, int userId);
Sudheer Shankac7562092018-08-24 10:20:56 -0700108
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700109 void startCheckpoint(int retry);
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700110 boolean needsCheckpoint();
Daniel Rosenbergd3992492018-10-02 17:40:44 -0700111 boolean needsRollback();
David Anderson23850d32020-06-10 23:51:17 -0700112 boolean isCheckpointing();
Daniel Rosenberga59e4392019-03-20 17:02:47 -0700113 void abortChanges(in @utf8InCpp String device, boolean retry);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700114 void commitChanges();
115 void prepareCheckpoint();
116 void restoreCheckpoint(@utf8InCpp String device);
Daniel Rosenbergdda59812019-03-06 17:45:17 -0800117 void restoreCheckpointPart(@utf8InCpp String device, int count);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700118 void markBootAttempt();
Daniel Rosenberg9b667fb2019-01-22 17:27:25 -0800119 boolean supportsCheckpoint();
Paul Lawrencec5c79c52019-03-18 13:36:40 -0700120 boolean supportsBlockCheckpoint();
121 boolean supportsFileCheckpoint();
Nikita Ioffea5798fc2019-10-11 16:38:21 +0100122 void resetCheckpoint();
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700123
Risan8c9f3322018-10-29 08:52:56 +0900124 @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
125 @utf8InCpp String mountPath, @utf8InCpp String fsType,
126 @utf8InCpp String fsUuid, @utf8InCpp String fsLabel);
127 void destroyStubVolume(@utf8InCpp String volId);
128
Risan8f6198d2018-10-26 20:56:45 -0600129 FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
130
Yurii Zubrytskyid05bcc82020-01-10 11:54:06 -0800131 boolean incFsEnabled();
132 IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags);
Songchun Fanab55cec2019-12-02 10:50:12 -0800133 void unmountIncFs(@utf8InCpp String dir);
134 void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
135
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600136 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
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600145 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600146
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600147 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
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600154 const int PASSWORD_TYPE_PASSWORD = 0;
155 const int PASSWORD_TYPE_DEFAULT = 1;
Paul Crowleyca08c0a2018-07-03 11:49:00 -0700156 const int PASSWORD_TYPE_PATTERN = 2;
157 const int PASSWORD_TYPE_PIN = 3;
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600158
159 const int STORAGE_FLAG_DE = 1;
160 const int STORAGE_FLAG_CE = 2;
161
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600162 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;
Sudheer Shanka55049012019-01-09 12:15:15 -0800166 const int REMOUNT_MODE_LEGACY = 4;
167 const int REMOUNT_MODE_INSTALLER = 5;
168 const int REMOUNT_MODE_FULL = 6;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600169
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600170 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;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600179
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600180 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;
Risan8c9f3322018-10-29 08:52:56 +0900185 const int VOLUME_TYPE_STUB = 5;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600186}