Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.os; |
| 18 | |
Songchun Fan | ab55cec | 2019-12-02 10:50:12 -0800 | [diff] [blame] | 19 | import android.os.incremental.IncrementalFileSystemControlParcel; |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 20 | import android.os.IVoldListener; |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 21 | import android.os.IVoldTaskListener; |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 22 | |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 23 | /** {@hide} */ |
| 24 | interface IVold { |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 25 | void setListener(IVoldListener listener); |
| 26 | |
Jeff Sharkey | cbe69fc | 2017-09-15 16:50:28 -0600 | [diff] [blame] | 27 | void monitor(); |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 28 | void reset(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 29 | void shutdown(); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 30 | |
| 31 | void onUserAdded(int userId, int userSerial); |
| 32 | void onUserRemoved(int userId); |
Sudheer Shanka | 5fceb48 | 2019-04-29 10:46:35 -0700 | [diff] [blame] | 33 | void onUserStarted(int userId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 34 | void onUserStopped(int userId); |
| 35 | |
Sudheer Shanka | d484aa9 | 2018-07-31 10:07:34 -0700 | [diff] [blame] | 36 | void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds); |
| 37 | void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds); |
| 38 | |
Jeff Sharkey | 401b260 | 2017-12-14 22:15:20 -0700 | [diff] [blame] | 39 | void onSecureKeyguardStateChanged(boolean isShowing); |
| 40 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 41 | void partition(@utf8InCpp String diskId, int partitionType, int ratio); |
Jeff Sharkey | 3ce1825 | 2017-10-24 11:08:45 -0600 | [diff] [blame] | 42 | void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 43 | |
| 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 Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 47 | void benchmark(@utf8InCpp String volId, IVoldTaskListener listener); |
Jeff Sharkey | 2048a28 | 2017-06-15 09:59:43 -0600 | [diff] [blame] | 48 | void checkEncryption(@utf8InCpp String volId); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 49 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 50 | void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId, |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 51 | IVoldTaskListener listener); |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 52 | |
| 53 | void remountUid(int uid, int remountMode); |
| 54 | |
| 55 | void mkdirs(@utf8InCpp String path); |
| 56 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 57 | @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey, |
| 58 | int ownerGid); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 59 | void destroyObb(@utf8InCpp String volId); |
| 60 | |
Jeff Sharkey | 52f7a91 | 2017-09-15 12:57:44 -0600 | [diff] [blame] | 61 | void fstrim(int fstrimFlags, IVoldTaskListener listener); |
Jin Qian | a370c14 | 2017-10-17 15:41:45 -0700 | [diff] [blame] | 62 | void runIdleMaint(IVoldTaskListener listener); |
| 63 | void abortIdleMaint(IVoldTaskListener listener); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 64 | |
Risan | 8f6198d | 2018-10-26 20:56:45 -0600 | [diff] [blame] | 65 | FileDescriptor mountAppFuse(int uid, int mountId); |
| 66 | void unmountAppFuse(int uid, int mountId); |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 67 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 68 | 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 Lawrence | 236e5e8 | 2019-06-25 14:44:33 -0700 | [diff] [blame] | 85 | void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint); |
| 86 | void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 87 | |
| 88 | void createUserKey(int userId, int userSerial, boolean ephemeral); |
| 89 | void destroyUserKey(int userId); |
| 90 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 91 | void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, |
| 92 | @utf8InCpp String secret); |
Barani Muthukumaran | b1927c2 | 2019-10-31 22:59:34 -0700 | [diff] [blame] | 93 | void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String token, |
| 94 | @utf8InCpp String secret); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 95 | void fixateNewestUserKeyAuth(int userId); |
| 96 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 97 | void unlockUserKey(int userId, int userSerial, @utf8InCpp String token, |
| 98 | @utf8InCpp String secret); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 99 | void lockUserKey(int userId); |
| 100 | |
Paul Crowley | edf7a4e | 2018-09-18 15:14:18 -0700 | [diff] [blame] | 101 | void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial, |
| 102 | int storageFlags); |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 103 | void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags); |
| 104 | |
Sudheer Shanka | fa6a174 | 2018-10-04 16:26:22 -0700 | [diff] [blame] | 105 | void prepareSandboxForApp(in @utf8InCpp String packageName, int appId, |
| 106 | in @utf8InCpp String sandboxId, int userId); |
Sudheer Shanka | 69bc40f | 2018-10-25 11:06:55 -0700 | [diff] [blame] | 107 | void destroySandboxForApp(in @utf8InCpp String packageName, |
Sudheer Shanka | fa6a174 | 2018-10-04 16:26:22 -0700 | [diff] [blame] | 108 | in @utf8InCpp String sandboxId, int userId); |
Sudheer Shanka | c756209 | 2018-08-24 10:20:56 -0700 | [diff] [blame] | 109 | |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 110 | void startCheckpoint(int retry); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 111 | boolean needsCheckpoint(); |
Daniel Rosenberg | d399249 | 2018-10-02 17:40:44 -0700 | [diff] [blame] | 112 | boolean needsRollback(); |
David Anderson | 23850d3 | 2020-06-10 23:51:17 -0700 | [diff] [blame^] | 113 | boolean isCheckpointing(); |
Daniel Rosenberg | a59e439 | 2019-03-20 17:02:47 -0700 | [diff] [blame] | 114 | void abortChanges(in @utf8InCpp String device, boolean retry); |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 115 | void commitChanges(); |
| 116 | void prepareCheckpoint(); |
| 117 | void restoreCheckpoint(@utf8InCpp String device); |
Daniel Rosenberg | dda5981 | 2019-03-06 17:45:17 -0800 | [diff] [blame] | 118 | void restoreCheckpointPart(@utf8InCpp String device, int count); |
Daniel Rosenberg | e334aab | 2018-10-10 18:52:04 -0700 | [diff] [blame] | 119 | void markBootAttempt(); |
Daniel Rosenberg | 9b667fb | 2019-01-22 17:27:25 -0800 | [diff] [blame] | 120 | boolean supportsCheckpoint(); |
Paul Lawrence | c5c79c5 | 2019-03-18 13:36:40 -0700 | [diff] [blame] | 121 | boolean supportsBlockCheckpoint(); |
| 122 | boolean supportsFileCheckpoint(); |
Nikita Ioffe | a5798fc | 2019-10-11 16:38:21 +0100 | [diff] [blame] | 123 | void resetCheckpoint(); |
Daniel Rosenberg | 4f68471 | 2018-08-28 01:58:49 -0700 | [diff] [blame] | 124 | |
Risan | 8c9f332 | 2018-10-29 08:52:56 +0900 | [diff] [blame] | 125 | @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath, |
| 126 | @utf8InCpp String mountPath, @utf8InCpp String fsType, |
| 127 | @utf8InCpp String fsUuid, @utf8InCpp String fsLabel); |
| 128 | void destroyStubVolume(@utf8InCpp String volId); |
| 129 | |
Risan | 8f6198d | 2018-10-26 20:56:45 -0600 | [diff] [blame] | 130 | FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags); |
| 131 | |
Yurii Zubrytskyi | d05bcc8 | 2020-01-10 11:54:06 -0800 | [diff] [blame] | 132 | boolean incFsEnabled(); |
| 133 | IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags); |
Songchun Fan | ab55cec | 2019-12-02 10:50:12 -0800 | [diff] [blame] | 134 | void unmountIncFs(@utf8InCpp String dir); |
| 135 | void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir); |
| 136 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 137 | const int ENCRYPTION_FLAG_NO_UI = 4; |
| 138 | |
| 139 | const int ENCRYPTION_STATE_NONE = 1; |
| 140 | const int ENCRYPTION_STATE_OK = 0; |
| 141 | const int ENCRYPTION_STATE_ERROR_UNKNOWN = -1; |
| 142 | const int ENCRYPTION_STATE_ERROR_INCOMPLETE = -2; |
| 143 | const int ENCRYPTION_STATE_ERROR_INCONSISTENT = -3; |
| 144 | const int ENCRYPTION_STATE_ERROR_CORRUPT = -4; |
| 145 | |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 146 | const int FSTRIM_FLAG_DEEP_TRIM = 1; |
Jeff Sharkey | 11c2d38 | 2017-09-11 10:32:01 -0600 | [diff] [blame] | 147 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 148 | const int MOUNT_FLAG_PRIMARY = 1; |
| 149 | const int MOUNT_FLAG_VISIBLE = 2; |
| 150 | |
| 151 | const int PARTITION_TYPE_PUBLIC = 0; |
| 152 | const int PARTITION_TYPE_PRIVATE = 1; |
| 153 | const int PARTITION_TYPE_MIXED = 2; |
| 154 | |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 155 | const int PASSWORD_TYPE_PASSWORD = 0; |
| 156 | const int PASSWORD_TYPE_DEFAULT = 1; |
Paul Crowley | ca08c0a | 2018-07-03 11:49:00 -0700 | [diff] [blame] | 157 | const int PASSWORD_TYPE_PATTERN = 2; |
| 158 | const int PASSWORD_TYPE_PIN = 3; |
Jeff Sharkey | 83b559c | 2017-09-12 16:30:52 -0600 | [diff] [blame] | 159 | |
| 160 | const int STORAGE_FLAG_DE = 1; |
| 161 | const int STORAGE_FLAG_CE = 2; |
| 162 | |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 163 | const int REMOUNT_MODE_NONE = 0; |
| 164 | const int REMOUNT_MODE_DEFAULT = 1; |
| 165 | const int REMOUNT_MODE_READ = 2; |
| 166 | const int REMOUNT_MODE_WRITE = 3; |
Sudheer Shanka | 5504901 | 2019-01-09 12:15:15 -0800 | [diff] [blame] | 167 | const int REMOUNT_MODE_LEGACY = 4; |
| 168 | const int REMOUNT_MODE_INSTALLER = 5; |
| 169 | const int REMOUNT_MODE_FULL = 6; |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 170 | |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 171 | const int VOLUME_STATE_UNMOUNTED = 0; |
| 172 | const int VOLUME_STATE_CHECKING = 1; |
| 173 | const int VOLUME_STATE_MOUNTED = 2; |
| 174 | const int VOLUME_STATE_MOUNTED_READ_ONLY = 3; |
| 175 | const int VOLUME_STATE_FORMATTING = 4; |
| 176 | const int VOLUME_STATE_EJECTING = 5; |
| 177 | const int VOLUME_STATE_UNMOUNTABLE = 6; |
| 178 | const int VOLUME_STATE_REMOVED = 7; |
| 179 | const int VOLUME_STATE_BAD_REMOVAL = 8; |
Jeff Sharkey | 9462bdd | 2017-09-07 15:27:28 -0600 | [diff] [blame] | 180 | |
Jeff Sharkey | 814e9d3 | 2017-09-13 11:49:44 -0600 | [diff] [blame] | 181 | const int VOLUME_TYPE_PUBLIC = 0; |
| 182 | const int VOLUME_TYPE_PRIVATE = 1; |
| 183 | const int VOLUME_TYPE_EMULATED = 2; |
| 184 | const int VOLUME_TYPE_ASEC = 3; |
| 185 | const int VOLUME_TYPE_OBB = 4; |
Risan | 8c9f332 | 2018-10-29 08:52:56 +0900 | [diff] [blame] | 186 | const int VOLUME_TYPE_STUB = 5; |
Jeff Sharkey | 068c6be | 2017-09-06 13:47:40 -0600 | [diff] [blame] | 187 | } |