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 interface IVold { setListener(IVoldListener listener)26 void setListener(IVoldListener listener); 27 abortFuse()28 void abortFuse(); monitor()29 void monitor(); reset()30 void reset(); shutdown()31 void shutdown(); 32 onUserAdded(int userId, int userSerial, int sharesStorageWithUserId)33 void onUserAdded(int userId, int userSerial, int sharesStorageWithUserId); onUserRemoved(int userId)34 void onUserRemoved(int userId); onUserStarted(int userId)35 void onUserStarted(int userId); onUserStopped(int userId)36 void onUserStopped(int userId); 37 addAppIds(in @tf8InCpp String[] packageNames, in int[] appIds)38 void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds); addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds)39 void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds); 40 onSecureKeyguardStateChanged(boolean isShowing)41 void onSecureKeyguardStateChanged(boolean isShowing); 42 partition(@tf8InCpp String diskId, int partitionType, int ratio)43 void partition(@utf8InCpp String diskId, int partitionType, int ratio); forgetPartition(@tf8InCpp String partGuid, @utf8InCpp String fsUuid)44 void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid); 45 mount(@tf8InCpp String volId, int mountFlags, int mountUserId, @nullable IVoldMountCallback callback)46 void mount(@utf8InCpp String volId, int mountFlags, int mountUserId, 47 @nullable IVoldMountCallback callback); unmount(@tf8InCpp String volId)48 void unmount(@utf8InCpp String volId); format(@tf8InCpp String volId, @utf8InCpp String fsType)49 void format(@utf8InCpp String volId, @utf8InCpp String fsType); benchmark(@tf8InCpp String volId, IVoldTaskListener listener)50 void benchmark(@utf8InCpp String volId, IVoldTaskListener listener); 51 moveStorage(@tf8InCpp String fromVolId, @utf8InCpp String toVolId, IVoldTaskListener listener)52 void moveStorage(@utf8InCpp String fromVolId, @utf8InCpp String toVolId, 53 IVoldTaskListener listener); 54 remountUid(int uid, int remountMode)55 void remountUid(int uid, int remountMode); remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)56 void remountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames); unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames)57 void unmountAppStorageDirs(int uid, int pid, in @utf8InCpp String[] packageNames); 58 setupAppDir(@tf8InCpp String path, int appUid)59 void setupAppDir(@utf8InCpp String path, int appUid); fixupAppDir(@tf8InCpp String path, int appUid)60 void fixupAppDir(@utf8InCpp String path, int appUid); ensureAppDirsCreated(in @tf8InCpp String[] paths, int appUid)61 void ensureAppDirsCreated(in @utf8InCpp String[] paths, int appUid); 62 createObb(@tf8InCpp String sourcePath, int ownerGid)63 @utf8InCpp String createObb(@utf8InCpp String sourcePath, int ownerGid); destroyObb(@tf8InCpp String volId)64 void destroyObb(@utf8InCpp String volId); 65 fstrim(int fstrimFlags, IVoldTaskListener listener)66 void fstrim(int fstrimFlags, IVoldTaskListener listener); runIdleMaint(boolean needGC, IVoldTaskListener listener)67 void runIdleMaint(boolean needGC, IVoldTaskListener listener); abortIdleMaint(IVoldTaskListener listener)68 void abortIdleMaint(IVoldTaskListener listener); getStorageLifeTime()69 int getStorageLifeTime(); setGCUrgentPace(int neededSegments, int minSegmentThreshold, float dirtyReclaimRate, float reclaimWeight, int gcPeriod, int minGCSleepTime, int targetDirtyRatio)70 void setGCUrgentPace(int neededSegments, int minSegmentThreshold, 71 float dirtyReclaimRate, float reclaimWeight, 72 int gcPeriod, int minGCSleepTime, 73 int targetDirtyRatio); refreshLatestWrite()74 void refreshLatestWrite(); getWriteAmount()75 int getWriteAmount(); 76 mountAppFuse(int uid, int mountId)77 FileDescriptor mountAppFuse(int uid, int mountId); unmountAppFuse(int uid, int mountId)78 void unmountAppFuse(int uid, int mountId); 79 fbeEnable()80 void fbeEnable(); 81 initUser0()82 void initUser0(); mountFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint, @utf8InCpp String zonedDevice)83 void mountFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, @utf8InCpp String zonedDevice); encryptFstab(@tf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType, @utf8InCpp String zonedDevice)84 void encryptFstab(@utf8InCpp String blkDevice, @utf8InCpp String mountPoint, boolean shouldFormat, @utf8InCpp String fsType, @utf8InCpp String zonedDevice); 85 setStorageBindingSeed(in byte[] seed)86 void setStorageBindingSeed(in byte[] seed); 87 createUserKey(int userId, int userSerial, boolean ephemeral)88 void createUserKey(int userId, int userSerial, boolean ephemeral); destroyUserKey(int userId)89 void destroyUserKey(int userId); 90 setUserKeyProtection(int userId, @utf8InCpp String secret)91 void setUserKeyProtection(int userId, @utf8InCpp String secret); 92 getUnlockedUsers()93 int[] getUnlockedUsers(); unlockUserKey(int userId, int userSerial, @utf8InCpp String secret)94 void unlockUserKey(int userId, int userSerial, @utf8InCpp String secret); lockUserKey(int userId)95 void lockUserKey(int userId); 96 prepareUserStorage(@ullable @tf8InCpp String uuid, int userId, int userSerial, int storageFlags)97 void prepareUserStorage(@nullable @utf8InCpp String uuid, int userId, int userSerial, 98 int storageFlags); destroyUserStorage(@ullable @tf8InCpp String uuid, int userId, int storageFlags)99 void destroyUserStorage(@nullable @utf8InCpp String uuid, int userId, int storageFlags); 100 prepareSandboxForApp(in @tf8InCpp String packageName, int appId, in @utf8InCpp String sandboxId, int userId)101 void prepareSandboxForApp(in @utf8InCpp String packageName, int appId, 102 in @utf8InCpp String sandboxId, int userId); destroySandboxForApp(in @tf8InCpp String packageName, in @utf8InCpp String sandboxId, int userId)103 void destroySandboxForApp(in @utf8InCpp String packageName, 104 in @utf8InCpp String sandboxId, int userId); 105 startCheckpoint(int retry)106 void startCheckpoint(int retry); needsCheckpoint()107 boolean needsCheckpoint(); needsRollback()108 boolean needsRollback(); isCheckpointing()109 boolean isCheckpointing(); abortChanges(in @tf8InCpp String device, boolean retry)110 void abortChanges(in @utf8InCpp String device, boolean retry); commitChanges()111 void commitChanges(); prepareCheckpoint()112 void prepareCheckpoint(); restoreCheckpoint(@tf8InCpp String device)113 void restoreCheckpoint(@utf8InCpp String device); restoreCheckpointPart(@tf8InCpp String device, int count)114 void restoreCheckpointPart(@utf8InCpp String device, int count); markBootAttempt()115 void markBootAttempt(); supportsCheckpoint()116 boolean supportsCheckpoint(); supportsBlockCheckpoint()117 boolean supportsBlockCheckpoint(); supportsFileCheckpoint()118 boolean supportsFileCheckpoint(); resetCheckpoint()119 void resetCheckpoint(); 120 earlyBootEnded()121 void earlyBootEnded(); createStubVolume(@tf8InCpp String sourcePath, @utf8InCpp String mountPath, @utf8InCpp String fsType, @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags)122 @utf8InCpp String createStubVolume(@utf8InCpp String sourcePath, 123 @utf8InCpp String mountPath, @utf8InCpp String fsType, 124 @utf8InCpp String fsUuid, @utf8InCpp String fsLabel, int flags); destroyStubVolume(@tf8InCpp String volId)125 void destroyStubVolume(@utf8InCpp String volId); 126 openAppFuseFile(int uid, int mountId, int fileId, int flags)127 FileDescriptor openAppFuseFile(int uid, int mountId, int fileId, int flags); 128 incFsEnabled()129 boolean incFsEnabled(); mountIncFs(@tf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName)130 IncrementalFileSystemControlParcel mountIncFs(@utf8InCpp String backingPath, @utf8InCpp String targetDir, int flags, @utf8InCpp String sysfsName); unmountIncFs(@tf8InCpp String dir)131 void unmountIncFs(@utf8InCpp String dir); setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName)132 void setIncFsMountOptions(in IncrementalFileSystemControlParcel control, boolean enableReadLogs, boolean enableReadTimeouts, @utf8InCpp String sysfsName); bindMount(@tf8InCpp String sourceDir, @utf8InCpp String targetDir)133 void bindMount(@utf8InCpp String sourceDir, @utf8InCpp String targetDir); 134 destroyDsuMetadataKey(@tf8InCpp String dsuSlot)135 void destroyDsuMetadataKey(@utf8InCpp String dsuSlot); 136 getStorageSize()137 long getStorageSize(); 138 139 const int FSTRIM_FLAG_DEEP_TRIM = 1; 140 141 const int MOUNT_FLAG_PRIMARY = 1; 142 const int MOUNT_FLAG_VISIBLE_FOR_READ = 2; 143 const int MOUNT_FLAG_VISIBLE_FOR_WRITE = 4; 144 145 const int PARTITION_TYPE_PUBLIC = 0; 146 const int PARTITION_TYPE_PRIVATE = 1; 147 const int PARTITION_TYPE_MIXED = 2; 148 149 const int STORAGE_FLAG_DE = 1; 150 const int STORAGE_FLAG_CE = 2; 151 152 const int REMOUNT_MODE_NONE = 0; 153 const int REMOUNT_MODE_DEFAULT = 1; 154 const int REMOUNT_MODE_INSTALLER = 2; 155 const int REMOUNT_MODE_PASS_THROUGH = 3; 156 const int REMOUNT_MODE_ANDROID_WRITABLE = 4; 157 158 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; 167 168 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; 173 const int VOLUME_TYPE_STUB = 5; 174 } 175