blob: ea7586482602049d05aa8517d10c71ad747cdce5 [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
Martijn Coenen23c04452020-04-29 07:49:41 +020028 void abortFuse();
Jeff Sharkeycbe69fc2017-09-15 16:50:28 -060029 void monitor();
Jeff Sharkey068c6be2017-09-06 13:47:40 -060030 void reset();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060031 void shutdown();
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060032
33 void onUserAdded(int userId, int userSerial);
34 void onUserRemoved(int userId);
Sudheer Shanka5fceb482019-04-29 10:46:35 -070035 void onUserStarted(int userId);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060036 void onUserStopped(int userId);
37
Sudheer Shankad484aa92018-07-31 10:07:34 -070038 void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
39 void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
40
Jeff Sharkey401b2602017-12-14 22:15:20 -070041 void onSecureKeyguardStateChanged(boolean isShowing);
42
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060043 void partition(@utf8InCpp String diskId, int partitionType, int ratio);
Jeff Sharkey3ce18252017-10-24 11:08:45 -060044 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060045
Zim5048b4b2019-11-19 09:16:03 +000046 void mount(@utf8InCpp String volId, int mountFlags, int mountUserId,
Zim9d1425c2019-11-27 18:15:14 +000047 @nullable IVoldMountCallback callback);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060048 void unmount(@utf8InCpp String volId);
49 void format(@utf8InCpp String volId, @utf8InCpp String fsType);
Jeff Sharkey52f7a912017-09-15 12:57:44 -060050 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
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);
Ricky Wai6b122572020-02-28 16:30:47 +000056 void remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
Ricky Waia2ca11e2021-01-15 14:03:23 +000057 void unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060058
Martijn Coenen8a68a072020-02-12 15:29:02 +010059 void setupAppDir(@utf8InCpp String path, int appUid);
Martijn Coenen816f4d92020-02-18 15:06:37 +010060 void fixupAppDir(@utf8InCpp String path, int appUid);
Ricky Waibbfb6ea2020-12-03 15:32:52 +000061 void ensureAppDirsCreated(in @utf8InCpp String[] paths, int appUid);
Jeff Sharkey9462bdd2017-09-07 15:27:28 -060062
Eric Biggers7e79a432022-03-01 21:19:18 +000063 @utf8InCpp String createObb(@utf8InCpp String sourcePath, int ownerGid);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060064 void destroyObb(@utf8InCpp String volId);
65
Jeff Sharkey52f7a912017-09-15 12:57:44 -060066 void fstrim(int fstrimFlags, IVoldTaskListener listener);
Daeho Jeong999fceb2022-01-04 11:37:39 -080067 void runIdleMaint(boolean needGC, IVoldTaskListener listener);
Jin Qiana370c142017-10-17 15:41:45 -070068 void abortIdleMaint(IVoldTaskListener listener);
Daeho Jeong999fceb2022-01-04 11:37:39 -080069 int getStorageLifeTime();
70 void setGCUrgentPace(int neededSegments, int minSegmentThreshold,
Daeho Jeong7c788fc2022-03-18 12:24:41 -070071 float dirtyReclaimRate, float reclaimWeight,
Daeho Jeong3f8e8552022-06-24 14:50:47 -070072 int gcPeriod, int minGCSleepTime,
73 int targetDirtyRatio);
Daeho Jeong999fceb2022-01-04 11:37:39 -080074 void refreshLatestWrite();
75 int getWriteAmount();
Jeff Sharkey11c2d382017-09-11 10:32:01 -060076
Risan8f6198d2018-10-26 20:56:45 -060077 FileDescriptor mountAppFuse(int uid, int mountId);
78 void unmountAppFuse(int uid, int mountId);
Jeff Sharkey11c2d382017-09-11 10:32:01 -060079
Jeff Sharkey83b559c2017-09-12 16:30:52 -060080 void fbeEnable();
81
Jeff Sharkey83b559c2017-09-12 16:30:52 -060082 void initUser0();
Paul Lawrence236e5e82019-06-25 14:44:33 -070083 void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint);
Jaegeuk Kim0c52c712020-12-15 09:00:49 -080084 void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060085
Seth Moore5a43d612021-01-19 17:51:51 +000086 void setStorageBindingSeed(in byte[] seed);
87
Jeff Sharkey83b559c2017-09-12 16:30:52 -060088 void createUserKey(int userId, int userSerial, boolean ephemeral);
89 void destroyUserKey(int userId);
90
Eric Biggers90a30522022-01-25 19:21:37 +000091 void addUserKeyAuth(int userId, int userSerial, @utf8InCpp String secret);
92 void clearUserKeyAuth(int userId, int userSerial, @utf8InCpp String secret);
Jeff Sharkey83b559c2017-09-12 16:30:52 -060093 void fixateNewestUserKeyAuth(int userId);
94
Eric Biggers1799deb2021-04-06 12:02:56 -070095 int[] getUnlockedUsers();
Eric Biggers90a30522022-01-25 19:21:37 +000096 void unlockUserKey(int userId, int userSerial, @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();
David Anderson23850d32020-06-10 23:51:17 -0700111 boolean isCheckpointing();
Daniel Rosenberga59e4392019-03-20 17:02:47 -0700112 void abortChanges(in @utf8InCpp String device, boolean retry);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700113 void commitChanges();
114 void prepareCheckpoint();
115 void restoreCheckpoint(@utf8InCpp String device);
Daniel Rosenbergdda59812019-03-06 17:45:17 -0800116 void restoreCheckpointPart(@utf8InCpp String device, int count);
Daniel Rosenberge334aab2018-10-10 18:52:04 -0700117 void markBootAttempt();
Daniel Rosenberg9b667fb2019-01-22 17:27:25 -0800118 boolean supportsCheckpoint();
Paul Lawrencec5c79c52019-03-18 13:36:40 -0700119 boolean supportsBlockCheckpoint();
120 boolean supportsFileCheckpoint();
Nikita Ioffea5798fc2019-10-11 16:38:21 +0100121 void resetCheckpoint();
Daniel Rosenberg4f684712018-08-28 01:58:49 -0700122
Martijn Coeneneed957f2020-11-12 10:59:13 +0100123 void earlyBootEnded();
Risan8c9f3322018-10-29 08:52:56 +0900124 @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
125 @utf8InCpp String mountPath, @utf8InCpp String fsType,
Risan82e90de2020-02-04 16:07:21 +0900126 @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags);
Risan8c9f3322018-10-29 08:52:56 +0900127 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 Zubrytskyi3497cb52020-01-10 11:54:06 -0800131 boolean incFsEnabled();
Songchun Fan046e68a2021-04-27 12:46:02 -0700132 IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName);
Songchun Fanab55cec2019-12-02 10:50:12 -0800133 void unmountIncFs(@utf8InCpp String dir);
Songchun Fan0e53c1c2021-05-10 16:19:38 -0700134 void setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName);
Songchun Fanab55cec2019-12-02 10:50:12 -0800135 void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
136
Yo Chiang0af25a32020-10-07 14:20:00 +0800137 void destroyDsuMetadataKey(@utf8InCpp String dsuSlot);
138
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600139 const int FSTRIM_FLAG_DEEP_TRIM = 1;
Jeff Sharkey11c2d382017-09-11 10:32:01 -0600140
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600141 const int MOUNT_FLAG_PRIMARY = 1;
Youkichi Hosoi2991cbe2021-11-11 11:23:01 +0900142 const int MOUNT_FLAG_VISIBLE_FOR_READ = 2;
143 const int MOUNT_FLAG_VISIBLE_FOR_WRITE = 4;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600144
145 const int PARTITION_TYPE_PUBLIC = 0;
146 const int PARTITION_TYPE_PRIVATE = 1;
147 const int PARTITION_TYPE_MIXED = 2;
148
Jeff Sharkey83b559c2017-09-12 16:30:52 -0600149 const int STORAGE_FLAG_DE = 1;
150 const int STORAGE_FLAG_CE = 2;
151
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600152 const int REMOUNT_MODE_NONE = 0;
153 const int REMOUNT_MODE_DEFAULT = 1;
Abhijeet Kaure715ec12021-02-24 12:33:25 +0000154 const int REMOUNT_MODE_INSTALLER = 2;
155 const int REMOUNT_MODE_PASS_THROUGH = 3;
156 const int REMOUNT_MODE_ANDROID_WRITABLE = 4;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600157
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600158 const int VOLUME_STATE_UNMOUNTED = 0;
159 const int VOLUME_STATE_CHECKING = 1;
160 const int VOLUME_STATE_MOUNTED = 2;
161 const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
162 const int VOLUME_STATE_FORMATTING = 4;
163 const int VOLUME_STATE_EJECTING = 5;
164 const int VOLUME_STATE_UNMOUNTABLE = 6;
165 const int VOLUME_STATE_REMOVED = 7;
166 const int VOLUME_STATE_BAD_REMOVAL = 8;
Jeff Sharkey9462bdd2017-09-07 15:27:28 -0600167
Jeff Sharkey814e9d32017-09-13 11:49:44 -0600168 const int VOLUME_TYPE_PUBLIC = 0;
169 const int VOLUME_TYPE_PRIVATE = 1;
170 const int VOLUME_TYPE_EMULATED = 2;
171 const int VOLUME_TYPE_ASEC = 3;
172 const int VOLUME_TYPE_OBB = 4;
Risan8c9f3322018-10-29 08:52:56 +0900173 const int VOLUME_TYPE_STUB = 5;
Jeff Sharkey068c6be2017-09-06 13:47:40 -0600174}