blob: cc0b32debfcc35e8f8b30fcea35285a37e9418bb [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 Shankaebaad1c2018-07-31 16:39:59 -070032 void onUserStarted(int userId, in @utf8InCpp String[] packageNames);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060033 void onUserStopped(int userId);
34
Sudheer Shankad484aa92018-07-31 10:07:34 -070035 void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
36 void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
37
Jeff Sharkey401b2602017-12-14 22:15:20 -070038 void onSecureKeyguardStateChanged(boolean isShowing);
39
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060040 void partition(@utf8InCpp String diskId, int partitionType, int ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060041 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060042
43 void mount(@utf8InCpp String volId, int mountFlags, int mountUserId);
44 void unmount(@utf8InCpp String volId);
45 void format(@utf8InCpp String volId, @utf8InCpp String fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060046 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
Jeff Sharkey2048a282017-06-15 09:59:43 -060047 void checkEncryption(@utf8InCpp String volId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060048
Jeff Sharkey52f7a912017-09-15 12:57:44 -060049 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
50 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
Jeff Sharkey11c2d382017-09-11 10:32:01 -060056 @utf8InCpp String createObb(@utf8InCpp String sourcePath,
57 @utf8InCpp String sourceKey, int ownerGid);
58 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
64 FileDescriptor mountAppFuse(int uid, int pid, int mountId);
65 void unmountAppFuse(int uid, int pid, int mountId);
66
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 Crowley0fd26262018-01-30 09:48:19 -080084 void mountFstab(@utf8InCpp String mountPoint);
85 void encryptFstab(@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
90 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret);
91 void fixateNewestUserKeyAuth(int userId);
92
93 void unlockUserKey(int userId, int userSerial, @utf8InCpp String token, @utf8InCpp String secret);
94 void lockUserKey(int userId);
95
96 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial, int storageFlags);
97 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
98
Jeff Sharkey83b559c2017-09-12 16:30:52 -060099 const int ENCRYPTION_FLAG_NO_UI = 4;
100
101 const int ENCRYPTION_STATE_NONE = 1;
102 const int ENCRYPTION_STATE_OK = 0;
103 const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1;
104 const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2;
105 const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3;
106 const int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
107
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600108 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600109
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600110 const int MOUNT_FLAG_PRIMARY = 1;
111 const int MOUNT_FLAG_VISIBLE = 2;
112
113 const int PARTITION_TYPE_PUBLIC = 0;
114 const int PARTITION_TYPE_PRIVATE = 1;
115 const int PARTITION_TYPE_MIXED = 2;
116
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600117 const int PASSWORD_TYPE_PASSWORD = 0;
118 const int PASSWORD_TYPE_DEFAULT = 1;
Paul Crowleyca08c0a2018-07-03 11:49:00 -0700119 const int PASSWORD_TYPE_PATTERN = 2;
120 const int PASSWORD_TYPE_PIN = 3;
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600121
122 const int STORAGE_FLAG_DE = 1;
123 const int STORAGE_FLAG_CE = 2;
124
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600125 const int REMOUNT_MODE_NONE = 0;
126 const int REMOUNT_MODE_DEFAULT = 1;
127 const int REMOUNT_MODE_READ = 2;
128 const int REMOUNT_MODE_WRITE = 3;
Sudheer Shanka70a78282018-08-21 15:06:23 -0700129 const int REMOUNT_MODE_FULL = 4;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600130
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600131 const int VOLUME_STATE_UNMOUNTED = 0;
132 const int VOLUME_STATE_CHECKING = 1;
133 const int VOLUME_STATE_MOUNTED = 2;
134 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
135 const int VOLUME_STATE_FORMATTING = 4;
136 const int VOLUME_STATE_EJECTING = 5;
137 const int VOLUME_STATE_UNMOUNTABLE = 6;
138 const int VOLUME_STATE_REMOVED = 7;
139 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600140
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600141 const int VOLUME_TYPE_PUBLIC = 0;
142 const int VOLUME_TYPE_PRIVATE = 1;
143 const int VOLUME_TYPE_EMULATED = 2;
144 const int VOLUME_TYPE_ASEC = 3;
145 const int VOLUME_TYPE_OBB = 4;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600146}