Reference

StorageManager (Android)

StorageManager is the Android system service apps use to query storage volumes, request free space, and let the OS reclaim clearable cache. Its allocateBytes and getCacheQuotaBytes APIs help apps make room before writing large files.

Android developmentAndroid

StorageManager (Android)

Also known as: storage manager android, allocate space, android storagemanager, allocateBytes

StorageManager is the Android system service apps use to query storage volumes, request free space, and let the OS reclaim clearable cache. Its allocateBytes and getCacheQuotaBytes APIs help apps make room before writing large files.

  • StorageManager is reached via getSystemService(StorageManager.class).
  • allocateBytes() asks Android to free clearable cache to make room for large writes.
  • The OS enforces a per-app cache quota and evicts over-quota cache under low storage.

What StorageManager is

StorageManager is an Android framework service (`android.os.storage.StorageManager`) that gives apps a programmatic view of device storage. Apps obtain it via getSystemService(StorageManager.class) and use it to enumerate storage volumes, inspect their state, and coordinate with the system on free space.

It became central to storage management starting in Android 8.0 (Oreo), which introduced APIs for requesting space and a per-app cache quota model that the system enforces automatically.

Requesting space and clearable cache

Before writing a large file, an app can call getAllocatableBytes() to learn how many bytes it could obtain, then call allocateBytes() to ask the system to make room. To satisfy that request, Android automatically deletes clearable cache files across apps that have exceeded their quota, freeing space without the user manually clearing each app.

Each app also has a cache quota the system tracks; an app can read its allotment with getCacheQuotaBytes(). When the device runs low on storage, the OS evicts cached data from apps that are over quota first. This is the mechanism behind Android automatically trimming cache under storage pressure.

How it relates to cleaning

StorageManager is the OS-level plumbing for the same goal a cleaner pursues: it identifies regenerable cache as safe to remove and protects real app data. Because the system only auto-clears cache (not user files), space can still fill up with duplicates, screenshots, and large videos the OS will not touch.

Cleanor complements this by finding the space the OS leaves behind, including duplicate photos and oversized media, so you reclaim more than the system's automatic cache eviction alone.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.