blob: b1846d077562937314c8c0e61105a4e5bd76d1a3 [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);
Sudheer Shanka69bc40f2018-10-25 11:06:55 -070032 void onUserStarted(int userId, in @utf8InCpp String[] packageNames, in int[] appIds,
33 in @utf8InCpp String[] sandboxIds);
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 Sharkey2048a282017-06-15 09:59:43 -060048 void checkEncryption(@utf8InCpp String volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060049
Jeff Sharkey52f7a912017-09-15 12:57:44 -060050 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070051 IVoldTaskListener listener);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060052
53 void remountUid(int uid, int remountMode);
54
55 void mkdirs(@utf8InCpp String path);
56
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070057 @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
58 int ownerGid);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060059 void destroyObb(@utf8InCpp String volId);
60
Jeff Sharkey52f7a912017-09-15 12:57:44 -060061 void fstrim(int fstrimFlags, IVoldTaskListener listener);
Jin Qiana370c142017-10-17 15:41:45 -070062 void runIdleMaint(IVoldTaskListener listener);
63 void abortIdleMaint(IVoldTaskListener listener);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060064
65 FileDescriptor mountAppFuse(int uid, int pid, int mountId);
66 void unmountAppFuse(int uid, int pid, int mountId);
67
Jeff Sharkey83b559c2017-09-12 16:30:52 -060068 void fdeCheckPassword(@utf8InCpp String password);
69 void fdeRestart();
70 int fdeComplete();
71 void fdeEnable(int passwordType, @utf8InCpp String password, int encryptionFlags);
72 void fdeChangePassword(int passwordType, @utf8InCpp String password);
73 void fdeVerifyPassword(@utf8InCpp String password);
74 @utf8InCpp String fdeGetField(@utf8InCpp String key);
75 void fdeSetField(@utf8InCpp String key, @utf8InCpp String value);
76 int fdeGetPasswordType();
77 @utf8InCpp String fdeGetPassword();
78 void fdeClearPassword();
79
80 void fbeEnable();
81
82 void mountDefaultEncrypted();
83 void initUser0();
84 boolean isConvertibleToFbe();
Paul Crowley0fd26262018-01-30 09:48:19 -080085 void mountFstab(@utf8InCpp String mountPoint);
86 void encryptFstab(@utf8InCpp String mountPoint);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060087
88 void createUserKey(int userId, int userSerial, boolean ephemeral);
89 void destroyUserKey(int userId);
90
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070091 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token,
92 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060093 void fixateNewestUserKeyAuth(int userId);
94
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070095 void unlockUserKey(int userId, int userSerial, @utf8InCpp String token,
96 @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060097 void lockUserKey(int userId);
98
Paul Crowleyedf7a4e2018-09-18 15:14:18 -070099 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial,
100 int storageFlags);
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600101 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
102
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700103 void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
104 in @utf8InCpp String sandboxId, int userId);
Sudheer Shanka69bc40f2018-10-25 11:06:55 -0700105 void destroySandboxForApp(in @utf8InCpp String packageName,
Sudheer Shankafa6a1742018-10-04 16:26:22 -0700106 in @utf8InCpp String sandboxId, int userId);
Sudheer Shankac7562092018-08-24 10:20:56 -0700107
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700108 void startCheckpoint(int retry);
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700109 boolean needsCheckpoint();
Daniel Rosenbergd3992492018-10-02 17:40:44 -0700110 boolean needsRollback();
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700111 void abortChanges();
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700112 void commitChanges();
113 void prepareCheckpoint();
114 void restoreCheckpoint(@utf8InCpp String device);
115 void markBootAttempt();
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700116
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600117 const int ENCRYPTION_FLAG_NO_UI = 4;
118
119 const int ENCRYPTION_STATE_NONE = 1;
120 const int ENCRYPTION_STATE_OK = 0;
121 const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
122 const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
123 const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
124 const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
125
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600126 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600127
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600128 const int MOUNT_FLAG_PRIMARY = 1;
129 const int MOUNT_FLAG_VISIBLE = 2;
130
131 const int PARTITION_TYPE_PUBLIC = 0;
132 const int PARTITION_TYPE_PRIVATE = 1;
133 const int PARTITION_TYPE_MIXED = 2;
134
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600135 const int PASSWORD_TYPE_PASSWORD = 0;
136 const int PASSWORD_TYPE_DEFAULT = 1;
Paul Crowleyca08c0a2018-07-03 11:49:00 -0700137 const int PASSWORD_TYPE_PATTERN = 2;
138 const int PASSWORD_TYPE_PIN = 3;
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600139
140 const int STORAGE_FLAG_DE = 1;
141 const int STORAGE_FLAG_CE = 2;
142
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600143 const int REMOUNT_MODE_NONE = 0;
144 const int REMOUNT_MODE_DEFAULT = 1;
145 const int REMOUNT_MODE_READ = 2;
146 const int REMOUNT_MODE_WRITE = 3;
Sudheer Shanka70a78282018-08-21 15:06:23 -0700147 const int REMOUNT_MODE_FULL = 4;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600148
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600149 const int VOLUME_STATE_UNMOUNTED = 0;
150 const int VOLUME_STATE_CHECKING = 1;
151 const int VOLUME_STATE_MOUNTED = 2;
152 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
153 const int VOLUME_STATE_FORMATTING = 4;
154 const int VOLUME_STATE_EJECTING = 5;
155 const int VOLUME_STATE_UNMOUNTABLE = 6;
156 const int VOLUME_STATE_REMOVED = 7;
157 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600158
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600159 const int VOLUME_TYPE_PUBLIC = 0;
160 const int VOLUME_TYPE_PRIVATE = 1;
161 const int VOLUME_TYPE_EMULATED = 2;
162 const int VOLUME_TYPE_ASEC = 3;
163 const int VOLUME_TYPE_OBB = 4;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600164}