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