StorageStats
class StorageStats : Parcelable
kotlin.Any | |
↳ | android.app.usage.StorageStats |
Storage statistics for a UID, package, or UserHandle
on a single storage volume.
Summary
Constants | |
---|---|
static Int |
Represents all . |
static Int |
Represents current profile of application. |
static Int |
Represents all nonstale dexopt and runtime artifacts of application. |
static Int |
Represents all . |
static Int |
Represents reference profile of application. |
static Int |
Represents lib/ in application code path. |
Inherited constants | |
---|---|
Public methods | |
---|---|
Int | |
Long |
Return the size of app. |
Long |
getAppBytesByDataType(dataType: Int) Return the size of the specified data type. |
Long |
Return the size of all cached data. |
Long |
Return the size of all data. |
Long |
Return the size of all cached data in the primary external/shared storage. |
Unit |
writeToParcel(dest: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<StorageStats!> |
Constants
APP_DATA_TYPE_FILE_TYPE_APK
static val APP_DATA_TYPE_FILE_TYPE_APK: Int
Represents all .apk files in application code path. Can be used as an input to getAppBytesByDataType(int)
to get the sum of sizes for files of this type.
Value: 3
APP_DATA_TYPE_FILE_TYPE_CURRENT_PROFILE
static val APP_DATA_TYPE_FILE_TYPE_CURRENT_PROFILE: Int
Represents current profile of application. Current profiles may or may not be used during the next profile-guided dexopt. Can be used as an input to getAppBytesByDataType(int)
to get the size of files of this type. This size fluctuates regularly, it goes up when the user uses more and more classes/methods and comes down when a deamon merges this into the ref profile and does profile-guided dexopt.
Value: 2
APP_DATA_TYPE_FILE_TYPE_DEXOPT_ARTIFACT
static val APP_DATA_TYPE_FILE_TYPE_DEXOPT_ARTIFACT: Int
Represents all nonstale dexopt and runtime artifacts of application. This includes AOT-compiled code and other data that can speed up app execution. For more detailed information, read the JIT compiler guide. Dexopt artifacts become stale when one of their dependencies has changed. They may be cleaned up or replaced by ART Services at any time. For a preload app, this type includes dexopt artifacts on readonly partitions if they are up-to-date. Can be used as an input to getAppBytesByDataType(int)
to get the sum of sizes for files of this type. The sum might include the size of data that is part of appBytes, dataBytes or cacheBytes.
Value: 0
APP_DATA_TYPE_FILE_TYPE_DM
static val APP_DATA_TYPE_FILE_TYPE_DM: Int
Represents all .dm files in application code path. Can be used as an input to getAppBytesByDataType(int)
to get the sum of sizes for files of this type.
Value: 4
APP_DATA_TYPE_FILE_TYPE_REFERENCE_PROFILE
static val APP_DATA_TYPE_FILE_TYPE_REFERENCE_PROFILE: Int
Represents reference profile of application. Reference profiles are the ones used during the last profile-guided dexopt. If the last dexopt wasn't profile-guided, then these profiles were not used. Can be used as an input to getAppBytesByDataType(int)
to get the size of files of this type.
Value: 1
APP_DATA_TYPE_LIB
static val APP_DATA_TYPE_LIB: Int
Represents lib/ in application code path. Can be used as an input to getAppBytesByDataType(int)
to get the size of lib/ directory.
Value: 5
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getAppBytes
fun getAppBytes(): Long
Return the size of app. This includes APK
files, optimized compiler output, and unpacked native libraries.
If the primary external/shared storage is hosted on this storage device, then this includes files stored under Context.getObbDir()
.
Code is shared between all users on a multiuser device.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Value is a non-negative number of bytes. |
getAppBytesByDataType
fun getAppBytesByDataType(dataType: Int): Long
Return the size of the specified data type. This includes files stored under application code path.
If there is more than one package inside a uid, the return represents the aggregated stats when query StorageStat for package or uid. The data is not collected and the return defaults to 0 when query StorageStats for user.
Data is isolated for each user on a multiuser device.
getCacheBytes
fun getCacheBytes(): Long
Return the size of all cached data. This includes files stored under Context.getCacheDir()
and Context.getCodeCacheDir()
.
If the primary external/shared storage is hosted on this storage device, then this includes files stored under Context.getExternalCacheDir()
.
Cached data is isolated for each user on a multiuser device.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Value is a non-negative number of bytes. |
getDataBytes
fun getDataBytes(): Long
Return the size of all data. This includes files stored under Context.getDataDir()
, Context.getCacheDir()
, Context.getCodeCacheDir()
.
If the primary external/shared storage is hosted on this storage device, then this includes files stored under Context.getExternalFilesDir(String)
, Context.getExternalCacheDir()
, and Context.getExternalMediaDirs()
.
Data is isolated for each user on a multiuser device.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Value is a non-negative number of bytes. |
getExternalCacheBytes
fun getExternalCacheBytes(): Long
Return the size of all cached data in the primary external/shared storage. This includes files stored under Context.getExternalCacheDir()
.
Cached data is isolated for each user on a multiuser device.
Value is a non-negative number of bytes.
Return | |
---|---|
Long |
Value is a non-negative number of bytes. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |