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 void shutdown(IStorageShutdownObserver observer) = 19; 56 /** 57 * Mounts an Opaque Binary Blob (OBB). Only allows the calling process's UID 58 * access to the contents. StorageManagerService will call back to the 59 * supplied IObbActionListener to inform it of the terminal state of the 60 * call. 61 */ mountObb(in String rawPath, in String canonicalPath, IObbActionListener token, int nonce, in ObbInfo obbInfo)62 void mountObb(in String rawPath, in String canonicalPath, IObbActionListener token, 63 int nonce, in ObbInfo obbInfo) = 21; 64 /** 65 * Unmounts an Opaque Binary Blob (OBB). When the force flag is specified, 66 * any program using it will be forcibly killed to unmount the image. 67 * StorageManagerService will call back to the supplied IObbActionListener to inform 68 * it of the terminal state of the call. 69 */ unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce)70 void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22; 71 /** 72 * Checks whether the specified Opaque Binary Blob (OBB) is mounted 73 * somewhere. 74 */ 75 boolean isObbMounted(in String rawPath) = 23; 76 /** 77 * Gets the path to the mounted Opaque Binary Blob (OBB). 78 */ 79 String getMountedObbPath(in String rawPath) = 24; 80 /** 81 * Returns list of all mountable volumes for the specified userId 82 */ getVolumeList(int userId, in String callingPackage, int flags)83 StorageVolume[] getVolumeList(int userId, in String callingPackage, int flags) = 29; 84 /** 85 * Ensure that all directories along given path exist, creating parent 86 * directories as needed. Validates that given path is absolute and that it 87 * contains no relative "." or ".." paths or symlinks. Also ensures that 88 * path belongs to a volume managed by vold, and that path is either 89 * external storage data or OBB directory belonging to calling app. 90 */ mkdirs(in String callingPkg, in String path)91 void mkdirs(in String callingPkg, in String path) = 34; 92 /** 93 * Report the time of the last maintenance operation such as fstrim. 94 * @return Timestamp of the last maintenance operation, in the 95 * System.currentTimeMillis() time base 96 * @throws RemoteException 97 */ lastMaintenance()98 long lastMaintenance() = 41; 99 /** 100 * Kick off an immediate maintenance operation 101 * @throws RemoteException 102 */ runMaintenance()103 void runMaintenance() = 42; getDisks()104 DiskInfo[] getDisks() = 44; getVolumes(int flags)105 VolumeInfo[] getVolumes(int flags) = 45; getVolumeRecords(int flags)106 VolumeRecord[] getVolumeRecords(int flags) = 46; 107 void mount(in String volId) = 47; 108 void unmount(in String volId) = 48; 109 void format(in String volId) = 49; 110 void partitionPublic(in String diskId) = 50; 111 void partitionPrivate(in String diskId) = 51; partitionMixed(in String diskId, int ratio)112 void partitionMixed(in String diskId, int ratio) = 52; setVolumeNickname(in String fsUuid, in String nickname)113 void setVolumeNickname(in String fsUuid, in String nickname) = 53; setVolumeUserFlags(in String fsUuid, int flags, int mask)114 void setVolumeUserFlags(in String fsUuid, int flags, int mask) = 54; 115 void forgetVolume(in String fsUuid) = 55; forgetAllVolumes()116 void forgetAllVolumes() = 56; getPrimaryStorageUuid()117 String getPrimaryStorageUuid() = 57; setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback)118 void setPrimaryStorageUuid(in String volumeUuid, IPackageMoveObserver callback) = 58; benchmark(in String volId, IVoldTaskListener listener)119 void benchmark(in String volId, IVoldTaskListener listener) = 59; setDebugFlags(int flags, int mask)120 void setDebugFlags(int flags, int mask) = 60; createUserKey(int userId, int serialNumber, boolean ephemeral)121 void createUserKey(int userId, int serialNumber, boolean ephemeral) = 61; destroyUserKey(int userId)122 void destroyUserKey(int userId) = 62; unlockUserKey(int userId, int serialNumber, in byte[] secret)123 void unlockUserKey(int userId, int serialNumber, in byte[] secret) = 63; lockUserKey(int userId)124 void lockUserKey(int userId) = 64; isUserKeyUnlocked(int userId)125 boolean isUserKeyUnlocked(int userId) = 65; prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags)126 void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 66; destroyUserStorage(in String volumeUuid, int userId, int flags)127 void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67; addUserKeyAuth(int userId, int serialNumber, in byte[] secret)128 void addUserKeyAuth(int userId, int serialNumber, in byte[] secret) = 70; fixateNewestUserKeyAuth(int userId)129 void fixateNewestUserKeyAuth(int userId) = 71; fstrim(int flags, IVoldTaskListener listener)130 void fstrim(int flags, IVoldTaskListener listener) = 72; mountProxyFileDescriptorBridge()131 AppFuseMount mountProxyFileDescriptorBridge() = 73; openProxyFileDescriptor(int mountPointId, int fileId, int mode)132 ParcelFileDescriptor openProxyFileDescriptor(int mountPointId, int fileId, int mode) = 74; getCacheQuotaBytes(String volumeUuid, int uid)133 long getCacheQuotaBytes(String volumeUuid, int uid) = 75; getCacheSizeBytes(String volumeUuid, int uid)134 long getCacheSizeBytes(String volumeUuid, int uid) = 76; getAllocatableBytes(String volumeUuid, int flags, String callingPackage)135 long getAllocatableBytes(String volumeUuid, int flags, String callingPackage) = 77; allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage)136 void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78; runIdleMaintenance()137 void runIdleMaintenance() = 79; abortIdleMaintenance()138 void abortIdleMaintenance() = 80; commitChanges()139 void commitChanges() = 83; supportsCheckpoint()140 boolean supportsCheckpoint() = 84; startCheckpoint(int numTries)141 void startCheckpoint(int numTries) = 85; needsCheckpoint()142 boolean needsCheckpoint() = 86; abortChanges(in String message, boolean retry)143 void abortChanges(in String message, boolean retry) = 87; clearUserKeyAuth(int userId, int serialNumber, in byte[] secret)144 void clearUserKeyAuth(int userId, int serialNumber, in byte[] secret) = 88; 145 void fixupAppDir(in String path) = 89; disableAppDataIsolation(in String pkgName, int pid, int userId)146 void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90; getManageSpaceActivityIntent(in String packageName, int requestCode)147 PendingIntent getManageSpaceActivityIntent(in String packageName, int requestCode) = 91; notifyAppIoBlocked(in String volumeUuid, int uid, int tid, int reason)148 void notifyAppIoBlocked(in String volumeUuid, int uid, int tid, int reason) = 92; notifyAppIoResumed(in String volumeUuid, int uid, int tid, int reason)149 void notifyAppIoResumed(in String volumeUuid, int uid, int tid, int reason) = 93; getExternalStorageMountMode(int uid, in String packageName)150 int getExternalStorageMountMode(int uid, in String packageName) = 94; isAppIoBlocked(in String volumeUuid, int uid, int tid, int reason)151 boolean isAppIoBlocked(in String volumeUuid, int uid, int tid, int reason) = 95; 152 void setCloudMediaProvider(in String authority) = 96; getCloudMediaProvider()153 String getCloudMediaProvider() = 97; 154 }