xref: /aosp_15_r20/system/vold/binder/android/os/IVold.aidl (revision f40fafd4c6c2594924d919feffc1a1fd6e3b30f3)
1*f40fafd4SAndroid Build Coastguard Worker /*
2*f40fafd4SAndroid Build Coastguard Worker  * Copyright (C) 2017 The Android Open Source Project
3*f40fafd4SAndroid Build Coastguard Worker  *
4*f40fafd4SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*f40fafd4SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*f40fafd4SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*f40fafd4SAndroid Build Coastguard Worker  *
8*f40fafd4SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*f40fafd4SAndroid Build Coastguard Worker  *
10*f40fafd4SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*f40fafd4SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*f40fafd4SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*f40fafd4SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*f40fafd4SAndroid Build Coastguard Worker  * limitations under the License.
15*f40fafd4SAndroid Build Coastguard Worker  */
16*f40fafd4SAndroid Build Coastguard Worker 
17*f40fafd4SAndroid Build Coastguard Worker package android.os;
18*f40fafd4SAndroid Build Coastguard Worker 
19*f40fafd4SAndroid Build Coastguard Worker import android.os.incremental.IncrementalFileSystemControlParcel;
20*f40fafd4SAndroid Build Coastguard Worker import android.os.IVoldListener;
21*f40fafd4SAndroid Build Coastguard Worker import android.os.IVoldMountCallback;
22*f40fafd4SAndroid Build Coastguard Worker import android.os.IVoldTaskListener;
23*f40fafd4SAndroid Build Coastguard Worker 
24*f40fafd4SAndroid Build Coastguard Worker /** {@hide} */
25*f40fafd4SAndroid Build Coastguard Worker @SensitiveData
26*f40fafd4SAndroid Build Coastguard Worker interface IVold {
setListener(IVoldListener listener)27*f40fafd4SAndroid Build Coastguard Worker     void setListener(IVoldListener listener);
28*f40fafd4SAndroid Build Coastguard Worker 
abortFuse()29*f40fafd4SAndroid Build Coastguard Worker     void abortFuse();
monitor()30*f40fafd4SAndroid Build Coastguard Worker     void monitor();
reset()31*f40fafd4SAndroid Build Coastguard Worker     void reset();
shutdown()32*f40fafd4SAndroid Build Coastguard Worker     void shutdown();
33*f40fafd4SAndroid Build Coastguard Worker 
onUserAdded(int userId, int userSerial, int sharesStorageWithUserId)34*f40fafd4SAndroid Build Coastguard Worker     void onUserAdded(int userId, int userSerial, int sharesStorageWithUserId);
onUserRemoved(int userId)35*f40fafd4SAndroid Build Coastguard Worker     void onUserRemoved(int userId);
onUserStarted(int userId)36*f40fafd4SAndroid Build Coastguard Worker     void onUserStarted(int userId);
onUserStopped(int userId)37*f40fafd4SAndroid Build Coastguard Worker     void onUserStopped(int userId);
38*f40fafd4SAndroid Build Coastguard Worker 
addAppIds(in @tf8InCpp String[] packageNames, in int[] appIds)39*f40fafd4SAndroid Build Coastguard Worker     void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds);
addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds)40*f40fafd4SAndroid Build Coastguard Worker     void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds);
41*f40fafd4SAndroid Build Coastguard Worker 
onSecureKeyguardStateChanged(boolean isShowing)42*f40fafd4SAndroid Build Coastguard Worker     void onSecureKeyguardStateChanged(boolean isShowing);
43*f40fafd4SAndroid Build Coastguard Worker 
partition(@tf8InCpp String diskId, int partitionType, int ratio)44*f40fafd4SAndroid Build Coastguard Worker     void partition(@utf8InCpp String diskId, int partitionType, int ratio);
forgetPartition(@tf8InCpp String partGuid, @utf8InCpp String fsUuid)45*f40fafd4SAndroid Build Coastguard Worker     void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
46*f40fafd4SAndroid Build Coastguard Worker 
mount(@tf8InCpp String volId, int mountFlags, int mountUserId, @nullable IVoldMountCallback callback)47*f40fafd4SAndroid Build Coastguard Worker     void mount(@utf8InCpp String volId, int mountFlags, int mountUserId,
48*f40fafd4SAndroid Build Coastguard Worker          @nullable IVoldMountCallback callback);
unmount(@tf8InCpp String volId)49*f40fafd4SAndroid Build Coastguard Worker     void unmount(@utf8InCpp String volId);
format(@tf8InCpp String volId, @utf8InCpp String fsType)50*f40fafd4SAndroid Build Coastguard Worker     void format(@utf8InCpp String volId, @utf8InCpp String fsType);
benchmark(@tf8InCpp String volId, IVoldTaskListener listener)51*f40fafd4SAndroid Build Coastguard Worker     void benchmark(@utf8InCpp String volId, IVoldTaskListener listener);
52*f40fafd4SAndroid Build Coastguard Worker 
moveStorage(@tf8InCpp String fromVolId, @utf8InCpp String toVolId, IVoldTaskListener listener)53*f40fafd4SAndroid Build Coastguard Worker     void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId,
54*f40fafd4SAndroid Build Coastguard Worker                      IVoldTaskListener listener);
55*f40fafd4SAndroid Build Coastguard Worker 
remountUid(int uid, int remountMode)56*f40fafd4SAndroid Build Coastguard Worker     void remountUid(int uid, int remountMode);
remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)57*f40fafd4SAndroid Build Coastguard Worker     void remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)58*f40fafd4SAndroid Build Coastguard Worker     void unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames);
59*f40fafd4SAndroid Build Coastguard Worker 
setupAppDir(@tf8InCpp String path, int appUid)60*f40fafd4SAndroid Build Coastguard Worker     void setupAppDir(@utf8InCpp String path, int appUid);
fixupAppDir(@tf8InCpp String path, int appUid)61*f40fafd4SAndroid Build Coastguard Worker     void fixupAppDir(@utf8InCpp String path, int appUid);
ensureAppDirsCreated(in @tf8InCpp String[] paths, int appUid)62*f40fafd4SAndroid Build Coastguard Worker     void ensureAppDirsCreated(in @utf8InCpp String[] paths, int appUid);
63*f40fafd4SAndroid Build Coastguard Worker 
createObb(@tf8InCpp String sourcePath, int ownerGid)64*f40fafd4SAndroid Build Coastguard Worker     @utf8InCpp String createObb(@utf8InCpp String sourcePath, int ownerGid);
destroyObb(@tf8InCpp String volId)65*f40fafd4SAndroid Build Coastguard Worker     void destroyObb(@utf8InCpp String volId);
66*f40fafd4SAndroid Build Coastguard Worker 
fstrim(int fstrimFlags, IVoldTaskListener listener)67*f40fafd4SAndroid Build Coastguard Worker     void fstrim(int fstrimFlags, IVoldTaskListener listener);
runIdleMaint(boolean needGC, IVoldTaskListener listener)68*f40fafd4SAndroid Build Coastguard Worker     void runIdleMaint(boolean needGC, IVoldTaskListener listener);
abortIdleMaint(IVoldTaskListener listener)69*f40fafd4SAndroid Build Coastguard Worker     void abortIdleMaint(IVoldTaskListener listener);
70*f40fafd4SAndroid Build Coastguard Worker     // Returns the amount of storage lifetime used, as a percentage.
71*f40fafd4SAndroid Build Coastguard Worker     // (eg, 10 indicates 10% of lifetime used), or -1 on failure.
getStorageLifeTime()72*f40fafd4SAndroid Build Coastguard Worker     int getStorageLifeTime();
setGCUrgentPace(int neededSegments, int minSegmentThreshold, float dirtyReclaimRate, float reclaimWeight, int gcPeriod, int minGCSleepTime, int targetDirtyRatio)73*f40fafd4SAndroid Build Coastguard Worker     void setGCUrgentPace(int neededSegments, int minSegmentThreshold,
74*f40fafd4SAndroid Build Coastguard Worker                          float dirtyReclaimRate, float reclaimWeight,
75*f40fafd4SAndroid Build Coastguard Worker                          int gcPeriod, int minGCSleepTime,
76*f40fafd4SAndroid Build Coastguard Worker                          int targetDirtyRatio);
refreshLatestWrite()77*f40fafd4SAndroid Build Coastguard Worker     void refreshLatestWrite();
getWriteAmount()78*f40fafd4SAndroid Build Coastguard Worker     int getWriteAmount();
79*f40fafd4SAndroid Build Coastguard Worker 
mountAppFuse(int uid, int mountId)80*f40fafd4SAndroid Build Coastguard Worker     FileDescriptor mountAppFuse(int uid, int mountId);
unmountAppFuse(int uid, int mountId)81*f40fafd4SAndroid Build Coastguard Worker     void unmountAppFuse(int uid, int mountId);
82*f40fafd4SAndroid Build Coastguard Worker 
fbeEnable()83*f40fafd4SAndroid Build Coastguard Worker     void fbeEnable();
84*f40fafd4SAndroid Build Coastguard Worker 
initUser0()85*f40fafd4SAndroid Build Coastguard Worker     void initUser0();
mountFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean isZoned, in @utf8InCpp String[] userDevices)86*f40fafd4SAndroid Build Coastguard Worker     void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean isZoned, in @utf8InCpp String[] userDevices);
encryptFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType, boolean isZoned, in @utf8InCpp String[] userDevices, in boolean[] deviceAliased, long length)87*f40fafd4SAndroid Build Coastguard Worker     void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType, boolean isZoned, in @utf8InCpp String[] userDevices, in boolean[] deviceAliased, long length);
88*f40fafd4SAndroid Build Coastguard Worker 
setStorageBindingSeed(in byte[] seed)89*f40fafd4SAndroid Build Coastguard Worker     void setStorageBindingSeed(in byte[] seed);
90*f40fafd4SAndroid Build Coastguard Worker 
createUserStorageKeys(int userId, boolean ephemeral)91*f40fafd4SAndroid Build Coastguard Worker     void createUserStorageKeys(int userId, boolean ephemeral);
destroyUserStorageKeys(int userId)92*f40fafd4SAndroid Build Coastguard Worker     void destroyUserStorageKeys(int userId);
93*f40fafd4SAndroid Build Coastguard Worker 
setCeStorageProtection(int userId, in byte[] secret)94*f40fafd4SAndroid Build Coastguard Worker     void setCeStorageProtection(int userId, in byte[] secret);
95*f40fafd4SAndroid Build Coastguard Worker 
getUnlockedUsers()96*f40fafd4SAndroid Build Coastguard Worker     int[] getUnlockedUsers();
unlockCeStorage(int userId, in byte[] secret)97*f40fafd4SAndroid Build Coastguard Worker     void unlockCeStorage(int userId, in byte[] secret);
lockCeStorage(int userId)98*f40fafd4SAndroid Build Coastguard Worker     void lockCeStorage(int userId);
99*f40fafd4SAndroid Build Coastguard Worker 
prepareUserStorage(@ullable @tf8InCpp String uuid, int userId, int storageFlags)100*f40fafd4SAndroid Build Coastguard Worker     void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
destroyUserStorage(@ullable @tf8InCpp String uuid, int userId, int storageFlags)101*f40fafd4SAndroid Build Coastguard Worker     void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags);
102*f40fafd4SAndroid Build Coastguard Worker 
prepareSandboxForApp(in @tf8InCpp String packageName, int appId, in @utf8InCpp String sandboxId, int userId)103*f40fafd4SAndroid Build Coastguard Worker     void prepareSandboxForApp(in @utf8InCpp String packageName, int appId,
104*f40fafd4SAndroid Build Coastguard Worker                               in @utf8InCpp String sandboxId, int userId);
destroySandboxForApp(in @tf8InCpp String packageName, in @utf8InCpp String sandboxId, int userId)105*f40fafd4SAndroid Build Coastguard Worker     void destroySandboxForApp(in @utf8InCpp String packageName,
106*f40fafd4SAndroid Build Coastguard Worker                               in @utf8InCpp String sandboxId, int userId);
107*f40fafd4SAndroid Build Coastguard Worker 
startCheckpoint(int retry)108*f40fafd4SAndroid Build Coastguard Worker     void startCheckpoint(int retry);
needsCheckpoint()109*f40fafd4SAndroid Build Coastguard Worker     boolean needsCheckpoint();
needsRollback()110*f40fafd4SAndroid Build Coastguard Worker     boolean needsRollback();
isCheckpointing()111*f40fafd4SAndroid Build Coastguard Worker     boolean isCheckpointing();
abortChanges(in @tf8InCpp String device, boolean retry)112*f40fafd4SAndroid Build Coastguard Worker     void abortChanges(in @utf8InCpp String device, boolean retry);
commitChanges()113*f40fafd4SAndroid Build Coastguard Worker     void commitChanges();
prepareCheckpoint()114*f40fafd4SAndroid Build Coastguard Worker     void prepareCheckpoint();
restoreCheckpoint(@tf8InCpp String device)115*f40fafd4SAndroid Build Coastguard Worker     void restoreCheckpoint(@utf8InCpp String device);
restoreCheckpointPart(@tf8InCpp String device, int count)116*f40fafd4SAndroid Build Coastguard Worker     void restoreCheckpointPart(@utf8InCpp String device, int count);
markBootAttempt()117*f40fafd4SAndroid Build Coastguard Worker     void markBootAttempt();
supportsCheckpoint()118*f40fafd4SAndroid Build Coastguard Worker     boolean supportsCheckpoint();
supportsBlockCheckpoint()119*f40fafd4SAndroid Build Coastguard Worker     boolean supportsBlockCheckpoint();
supportsFileCheckpoint()120*f40fafd4SAndroid Build Coastguard Worker     boolean supportsFileCheckpoint();
resetCheckpoint()121*f40fafd4SAndroid Build Coastguard Worker     void resetCheckpoint();
122*f40fafd4SAndroid Build Coastguard Worker 
earlyBootEnded()123*f40fafd4SAndroid Build Coastguard Worker     void earlyBootEnded();
createStubVolume(@tf8InCpp String sourcePath, @utf8InCpp String mountPath, @utf8InCpp String fsType, @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags)124*f40fafd4SAndroid Build Coastguard Worker     @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
125*f40fafd4SAndroid Build Coastguard Worker             @utf8InCpp String mountPath, @utf8InCpp String fsType,
126*f40fafd4SAndroid Build Coastguard Worker             @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags);
destroyStubVolume(@tf8InCpp String volId)127*f40fafd4SAndroid Build Coastguard Worker     void destroyStubVolume(@utf8InCpp String volId);
128*f40fafd4SAndroid Build Coastguard Worker 
openAppFuseFile(int uid, int mountId, int fileId, int flags)129*f40fafd4SAndroid Build Coastguard Worker     FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags);
130*f40fafd4SAndroid Build Coastguard Worker 
incFsEnabled()131*f40fafd4SAndroid Build Coastguard Worker     boolean incFsEnabled();
mountIncFs(@tf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName)132*f40fafd4SAndroid Build Coastguard Worker     IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName);
unmountIncFs(@tf8InCpp String dir)133*f40fafd4SAndroid Build Coastguard Worker     void unmountIncFs(@utf8InCpp String dir);
setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName)134*f40fafd4SAndroid Build Coastguard Worker     void setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName);
bindMount(@tf8InCpp String sourceDir, @utf8InCpp String targetDir)135*f40fafd4SAndroid Build Coastguard Worker     void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir);
136*f40fafd4SAndroid Build Coastguard Worker 
destroyDsuMetadataKey(@tf8InCpp String dsuSlot)137*f40fafd4SAndroid Build Coastguard Worker     void destroyDsuMetadataKey(@utf8InCpp String dsuSlot);
138*f40fafd4SAndroid Build Coastguard Worker 
getStorageSize()139*f40fafd4SAndroid Build Coastguard Worker     long getStorageSize();
140*f40fafd4SAndroid Build Coastguard Worker 
141*f40fafd4SAndroid Build Coastguard Worker     // Returns the remaining storage lifetime as a percentage, rounded up as
142*f40fafd4SAndroid Build Coastguard Worker     // needed when the underlying hardware reports low precision. Returns -1
143*f40fafd4SAndroid Build Coastguard Worker     // on failure.
getStorageRemainingLifetime()144*f40fafd4SAndroid Build Coastguard Worker     int getStorageRemainingLifetime();
145*f40fafd4SAndroid Build Coastguard Worker 
146*f40fafd4SAndroid Build Coastguard Worker     const int FSTRIM_FLAG_DEEP_TRIM = 1;
147*f40fafd4SAndroid Build Coastguard Worker 
148*f40fafd4SAndroid Build Coastguard Worker     const int MOUNT_FLAG_PRIMARY = 1;
149*f40fafd4SAndroid Build Coastguard Worker     const int MOUNT_FLAG_VISIBLE_FOR_READ = 2;
150*f40fafd4SAndroid Build Coastguard Worker     const int MOUNT_FLAG_VISIBLE_FOR_WRITE = 4;
151*f40fafd4SAndroid Build Coastguard Worker 
152*f40fafd4SAndroid Build Coastguard Worker     const int PARTITION_TYPE_PUBLIC = 0;
153*f40fafd4SAndroid Build Coastguard Worker     const int PARTITION_TYPE_PRIVATE = 1;
154*f40fafd4SAndroid Build Coastguard Worker     const int PARTITION_TYPE_MIXED = 2;
155*f40fafd4SAndroid Build Coastguard Worker 
156*f40fafd4SAndroid Build Coastguard Worker     const int STORAGE_FLAG_DE = 1;
157*f40fafd4SAndroid Build Coastguard Worker     const int STORAGE_FLAG_CE = 2;
158*f40fafd4SAndroid Build Coastguard Worker 
159*f40fafd4SAndroid Build Coastguard Worker     const int REMOUNT_MODE_NONE = 0;
160*f40fafd4SAndroid Build Coastguard Worker     const int REMOUNT_MODE_DEFAULT = 1;
161*f40fafd4SAndroid Build Coastguard Worker     const int REMOUNT_MODE_INSTALLER = 2;
162*f40fafd4SAndroid Build Coastguard Worker     const int REMOUNT_MODE_PASS_THROUGH = 3;
163*f40fafd4SAndroid Build Coastguard Worker     const int REMOUNT_MODE_ANDROID_WRITABLE = 4;
164*f40fafd4SAndroid Build Coastguard Worker 
165*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_UNMOUNTED = 0;
166*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_CHECKING = 1;
167*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_MOUNTED = 2;
168*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_MOUNTED_READ_ONLY = 3;
169*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_FORMATTING = 4;
170*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_EJECTING = 5;
171*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_UNMOUNTABLE = 6;
172*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_REMOVED = 7;
173*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_STATE_BAD_REMOVAL = 8;
174*f40fafd4SAndroid Build Coastguard Worker 
175*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_PUBLIC = 0;
176*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_PRIVATE = 1;
177*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_EMULATED = 2;
178*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_ASEC = 3;
179*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_OBB = 4;
180*f40fafd4SAndroid Build Coastguard Worker     const int VOLUME_TYPE_STUB = 5;
181*f40fafd4SAndroid Build Coastguard Worker }
182