public final class StorageInfoManager extends Object
The storage information includes the application size, application data size, and application cached data size.
It is stored in StorageInfo.
StorageInfoSystemCapability.ResourceSchedule#STORAGE_INFO| 限定符和类型 | 方法 | 说明 |
|---|---|---|
long |
getFreeSize(UUID storageUuid) |
Obtains the available space of a specified storage volume.
|
long |
getWholeSize(UUID storageUuid) |
Obtains the total space of a specified storage volume.
|
static StorageInfoManager |
newInstance(Context context) |
A static factory method used to create a
StorageInfoManager instance. |
StorageInfo |
queryInfoByPackageName(UUID storageUuid,
String packageName,
int uid) |
Obtains the storage information of a specified application that belongs to a specified user
on a specified storage volume.
|
StorageInfo |
queryInfoByUid(UUID storageUuid,
int uid) |
Obtains the application storage status of a specified user on a specified storage volume.
|
public static StorageInfoManager newInstance(Context context)
StorageInfoManager instance.context - Indicates the application context.StorageInfoManager instance if the creation is successful;
returns null if the context is null.public long getFreeSize(UUID storageUuid) throws IOException
The available space includes the remaining space and the cache data space that can be released.
storageUuid - Indicates the storage volume to be queried.
You can query the value using Volume.getVolUuid().IOException - Throws this exception if the storage volume to be queried does not exist.public long getWholeSize(UUID storageUuid) throws IOException
storageUuid - Indicates the UUID of the storage volume to be queried.
You can obtain the UUID using Volume.getVolUuid().IOException - Throws this exception if the storage volume to be queried does not exist.public StorageInfo queryInfoByPackageName(UUID storageUuid, String packageName, int uid) throws IOException, NotExistException
storageUuid - Indicates the UUID of the storage volume to be queried.
You can obtain the UUID using Volume.getVolUuid().packageName - Indicates the name of the application package to be queried.uid - Indicates the ID of the user to be queried.
You can obtain the user ID using IBundleManager.getUidByBundleName(java.lang.String, int).StorageInfo.IOException - Throws this exception if the storage volume to be queried does not exist.NotExistException - Throws this exception if the queried package does not exist.public StorageInfo queryInfoByUid(UUID storageUuid, int uid) throws IOException
storageUuid - Indicates the storage volume to be queried.
You can query the value using Volume.getVolUuid().uid - Indicates the ID of the user to be queried.
You can obtain the user ID using IBundleManager.getUidByBundleName(java.lang.String, int).StorageInfo.IOException - Throws this exception if the storage volume to be queried does not exist.