Added in API level 26

StorageStats

class StorageStats : Parcelable
kotlin.Any
   ↳ android.app.usage.StorageStats

Storage statistics for a UID, package, or UserHandle on a single storage volume.

Summary

Inherited constants
Public methods
Int

Long

Return the size of app.

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!>

Public methods

describeContents

Added in API level 26
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

Added in API level 26
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.

getCacheBytes

Added in API level 26
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

Added in API level 26
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

Added in API level 31
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

Added in API level 26
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

Properties

CREATOR

Added in API level 26
static val CREATOR: Parcelable.Creator<StorageStats!>