1 /** 2 * Copyright (c) 2016, 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.storage; 18 19 import android.content.pm.IPackageMoveObserver; 20 import android.content.res.ObbInfo; 21 import android.os.IVoldTaskListener; 22 import android.os.ParcelFileDescriptor; 23 import android.os.storage.DiskInfo; 24 import android.os.storage.IStorageEventListener; 25 import android.os.storage.IStorageShutdownObserver; 26 import android.os.storage.IObbActionListener; 27 import android.os.storage.StorageVolume; 28 import android.os.storage.VolumeInfo; 29 import android.os.storage.VolumeRecord; 30 import com.android.internal.os.AppFuseMount; 31 import android.app.PendingIntent; 32 33 34 /** 35 * WARNING! Update IMountService.h and IMountService.cpp if you change this 36 * file. In particular, the transaction ids below must match the 37 * _TRANSACTION enum in IMountService.cpp 38 * 39 * @hide - Applications should use android.os.storage.StorageManager to access 40 * storage functions. 41 */ 42 interface IStorageManager { 43 /** 44 * Registers an IStorageEventListener for receiving async notifications. 45 */ 46 void registerListener(IStorageEventListener listener) = 0; 47 /** 48 * Unregisters an IStorageEventListener 49 */ 50 void unregisterListener(IStorageEventListener listener) = 1; 51 /** 52 * Shuts down the StorageManagerService and gracefully unmounts all external media. 53 * Invokes call back once the shutdown is complete. 54 */ 55 @EnforcePermission("SHUTDOWN") 56 void shutdown(IStorageShutdownObserver observer) = 19; 57 /** 58 * Mounts an Opaque Binary Blob (OBB). Only allows the calling process's UID 59 * access to the contents. StorageManagerService will call back to the 60 * supplied IObbActionListener to inform it of the terminal state of the 61 * call. 62 */ mountObb(in String rawPath, in String canonicalPath, IObbActionListener token, int nonce, in ObbInfo obbInfo)63 void mountObb(in String rawPath, in String canonicalPath, IObbActionListener token, 64 int nonce, in ObbInfo obbInfo) = 21; 65 /** 66 * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, 67 * any program using it will be forcibly killed to unmount the image. 68 * StorageManagerService will call back to the supplied IObbActionListener to inform 69 * it of the terminal state of the call. 70 */ unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce)71 void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; 72 /** 73 * Checks whether the specified Opaque Binary Blob (OBB) is mounted 74 * somewhere. 75 */ 76 boolean isObbMounted(in String rawPath) = 23; 77 /** 78 * Gets the path to the mounted Opaque Binary Blob (OBB). 79 */ 80 String getMountedObbPath(in String rawPath) = 24; 81 /** 82 * Returns list of all mountable volumes for the specified userId 83 */ getVolumeList(int userId, in String callingPackage, int flags)84 StorageVolume[] getVolumeList(int userId, in String callingPackage, int flags) = 29; 85 /** 86 * Ensure that all directories along given path exist, creating parent 87 * directories as needed. Validates that given path is absolute and that it 88 * contains no relative "." or ".." paths or symlinks. Also ensures that 89 * path belongs to a volume managed by vold, and that path is either 90 * external storage data or OBB directory belonging to calling app. 91 */ mkdirs(in String callingPkg, in String path)92 void mkdirs(in String callingPkg, in String path) = 34; 93 /** 94 * Report the time of the last maintenance operation such as fstrim. 95 * @return Timestamp of the last maintenance operation, in the 96 * System.currentTimeMillis() time base 97 * @throws RemoteException 98 */ lastMaintenance()99 long lastMaintenance() = 41; 100 /** 101 * Kick off an immediate maintenance operation 102 * @throws RemoteException 103 */ 104 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") runMaintenance()105 void runMaintenance() = 42; getDisks()106 DiskInfo[] getDisks() = 44; getVolumes(int flags)107 VolumeInfo[] getVolumes(int flags) = 45; getVolumeRecords(int flags)108 VolumeRecord[] getVolumeRecords(int flags) = 46; 109 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") 110 void mount(in String volId) = 47; 111 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") 112 void unmount(in String volId) = 48; 113 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") 114 void format(in String volId) = 49; 115 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") 116 void partitionPublic(in String diskId) = 50; 117 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") 118 void partitionPrivate(in String diskId) = 51; 119 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") partitionMixed(in String diskId, int ratio)120 void partitionMixed(in String diskId, int ratio) = 52; 121 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") setVolumeNickname(in String fsUuid, in String nickname)122 void setVolumeNickname(in String fsUuid, in String nickname) = 53; 123 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") setVolumeUserFlags(in String fsUuid, int flags, int mask)124 void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 54; 125 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") 126 void forgetVolume(in String fsUuid) = 55; 127 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") forgetAllVolumes()128 void forgetAllVolumes() = 56; getPrimaryStorageUuid()129 String getPrimaryStorageUuid() = 57; 130 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback)131 void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 58; 132 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") benchmark(in String volId, IVoldTaskListener listener)133 void benchmark(in String volId, IVoldTaskListener listener) = 59; 134 @EnforcePermission("MOUNT_UNMOUNT_FILESYSTEMS") setDebugFlags(int flags, int mask)135 void setDebugFlags(int flags, int mask) = 60; 136 @EnforcePermission("STORAGE_INTERNAL") createUserStorageKeys(int userId, boolean ephemeral)137 void createUserStorageKeys(int userId, boolean ephemeral) = 61; 138 @EnforcePermission("STORAGE_INTERNAL") destroyUserStorageKeys(int userId)139 void destroyUserStorageKeys(int userId) = 62; 140 @EnforcePermission("STORAGE_INTERNAL") unlockCeStorage(int userId, in byte[] secret)141 void unlockCeStorage(int userId, in byte[] secret) = 63; 142 @EnforcePermission("STORAGE_INTERNAL") lockCeStorage(int userId)143 void lockCeStorage(int userId) = 64; isCeStorageUnlocked(int userId)144 boolean isCeStorageUnlocked(int userId) = 65; 145 @EnforcePermission("STORAGE_INTERNAL") prepareUserStorage(in String volumeUuid, int userId, int flags)146 void prepareUserStorage(in String volumeUuid, int userId, int flags) = 66; 147 @EnforcePermission("STORAGE_INTERNAL") destroyUserStorage(in String volumeUuid, int userId, int flags)148 void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67; 149 @EnforcePermission("STORAGE_INTERNAL") setCeStorageProtection(int userId, in byte[] secret)150 void setCeStorageProtection(int userId, in byte[] secret) = 70; 151 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") fstrim(int flags, IVoldTaskListener listener)152 void fstrim(int flags, IVoldTaskListener listener) = 72; mountProxyFileDescriptorBridge()153 AppFuseMount mountProxyFileDescriptorBridge() = 73; openProxyFileDescriptor(int mountPointId, int fileId, int mode)154 ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74; getCacheQuotaBytes(String volumeUuid, int uid)155 long getCacheQuotaBytes(String volumeUuid, int uid) = 75; getCacheSizeBytes(String volumeUuid, int uid)156 long getCacheSizeBytes(String volumeUuid, int uid) = 76; getAllocatableBytes(String volumeUuid, int flags, String callingPackage)157 long getAllocatableBytes(String volumeUuid, int flags, String callingPackage) = 77; allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage)158 void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78; runIdleMaintenance()159 void runIdleMaintenance() = 79; abortIdleMaintenance()160 void abortIdleMaintenance() = 80; commitChanges()161 void commitChanges() = 83; supportsCheckpoint()162 boolean supportsCheckpoint() = 84; startCheckpoint(int numTries)163 void startCheckpoint(int numTries) = 85; 164 @EnforcePermission("MOUNT_FORMAT_FILESYSTEMS") needsCheckpoint()165 boolean needsCheckpoint() = 86; abortChanges(in String message, boolean retry)166 void abortChanges(in String message, boolean retry) = 87; 167 void fixupAppDir(in String path) = 89; disableAppDataIsolation(in String pkgName, int pid, int userId)168 void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90; getManageSpaceActivityIntent(in String packageName, int requestCode)169 PendingIntent getManageSpaceActivityIntent(in String packageName, int requestCode) = 91; notifyAppIoBlocked(in String volumeUuid, int uid, int tid, int reason)170 void notifyAppIoBlocked(in String volumeUuid, int uid, int tid, int reason) = 92; notifyAppIoResumed(in String volumeUuid, int uid, int tid, int reason)171 void notifyAppIoResumed(in String volumeUuid, int uid, int tid, int reason) = 93; 172 @EnforcePermission("WRITE_MEDIA_STORAGE") getExternalStorageMountMode(int uid, in String packageName)173 int getExternalStorageMountMode(int uid, in String packageName) = 94; isAppIoBlocked(in String volumeUuid, int uid, int tid, int reason)174 boolean isAppIoBlocked(in String volumeUuid, int uid, int tid, int reason) = 95; 175 void setCloudMediaProvider(in String authority) = 96; getCloudMediaProvider()176 String getCloudMediaProvider() = 97; getInternalStorageBlockDeviceSize()177 long getInternalStorageBlockDeviceSize() = 98; 178 /** 179 * Returns the remaining lifetime of the internal storage device, as an 180 * integer percentage. For example, 90 indicates that 90% of the storage 181 * device's useful lifetime remains. If no information is available, -1 182 * is returned. 183 */ 184 @EnforcePermission("READ_PRIVILEGED_PHONE_STATE") getInternalStorageRemainingLifetime()185 int getInternalStorageRemainingLifetime() = 99; 186 } 187