Humpty Promotes > Rfo-Basic> Project Articles >


Android Storage Map  (Apr 2015).    updated (Dec 2020).

This is an outline of the different storage locations used in the Android apps environment.
It might also clear up some confusion over external storage restrictions when Google introduced
KitKat (4.4).


Internal Storage


case-sensitive

with linux attributes.
e.g
ext,ext2-ext4

Primary Internal

Example:
Internal memory
1st partition
/
PI Private Storage

e.g /data/data/<PACKAGE_NAME>/
e.g /data/data/<PACKAGE_NAME>/files/
  • private to app.
  • app has full access permissions on this level and below.
  • cleared upon app-uninstall.
  • Context.getFilesDir()
Secondary Internal   ??

External Storage


case-insensitive
without linux attributes.
e.g
fat,fat32,or other


Primary External

All APIs prior to KITKAT reference
here for external storage.

Examples:
Removable card inside of phone
e.g /mnt/sdcard/<>
e.g /SDCARD/<>

Internal memory,
2nd partition
e.g /storage/sdcard0/<>
e.g /sdcard/
e.g /mnt/sdcard0/<>
e.g /mnt/emmc/<>

Internal memory pretending to be
sdcard (emulated)
e.g /storage/emulated/0/<>
PE Private Storage

        <>/Android/data/<PACKAGE_NAME>
e.g /mnt/sdcard/Android/data/<PACKAGE_NAME>
  • no sandboxing restrictions before Android 11.
  • treated as 'private' but available publicly due to media being external.
  • cleared upon app-uninstall.
  • getExternalStorageDirectory ()
    (deprecated since API 29 Android Q)
  • Context.getExternalFilesDir(null)
Before KITKAT:
- No permissions needed for read access.
- WRITE_EXTERNAL_STORAGE needed for write access, even if app is owner.

KITKAT and after:
- Owner app gets full access without needing permissions.

Android-11 and after:
- Sandboxed as private for owner app with full access.
- Not available publicly. Even SAF cannot access it.

PE Shared Storage
  • no sandboxing restrictions.
  • not cleared upon app-uninstall.
  • Environment.
    getExternalStoragePublicDirectory(type)
    e.g /mnt/sdcard/Movies
    (deprecated since API 29 Android Q)

  • Context.getExternalFilesDir(type)
    /mnt/sdcard/Android/data/
    <PACKAGE_NAME>/Movies

Before KITKAT:
- No permissions needed for read access.
- WRITE_EXTERNAL_STORAGE needed for write access.

KITKAT and after:
- READ_EXTERNAL_STORAGE needed for read access.
- WRITE_EXTERNAL_STORAGE grants read,write on same volume.

Android-11 and after:
- Access restricted to SAF or MediaStore for all apps, even the owner app.
Secondary External

(new sandbox restrictions being enforced here since KITKAT)

Examples:
Removable card inside of phone.
e.g /storage/external_SD/<>
e.g /mnt/external_SD/<>

Removable card on outside slot of phone.
e.g /extsd/<>
e.g /extSdcard/<>
e.g /storage/1234-ABCD/<>
SE Private Storage

       
<>/Android/data/<PACKAGE_NAME>
e.g /extsd/Android/data/<PACKAGE_NAME>
  • app is sandboxed here.
  • cleared upon app-uninstall
  • Context.getExternalFilesDirs()
    - as additional item.
Before KITKAT:
- WRITE_EXTERNAL_STORAGE needed for write.

KITKAT and after:
- Owner app gets full access without needing permissions.
SE Shared Storage

- READ_EXTERNAL_STORAGE needed for read access after KITKAT.

- WRITE_EXTERNAL_STORAGE does NOT grant sdcard_rw membership on this volume.

In KitKat:
SAF API needed to r/w outside application-specific directories on secondary storage for specific directories.

In Lollipop:
SAF API extension removes the restriction to app-specific directories with ACTION_OPEN_DOCUMENT_TREE.

After Android-11:
- Access restricted to SAF or MediaStore for all apps, even the owner app.







Sources and Acknowledgements:

http://android.stackexchange.com/questions/46926/android-folder-hierarchy/46934#46934
http://stackoverflow.com/questions/23625104/storage-emulated-legacy-vs-storage-emulated-0-vs-data-data-myapp
http://commonsware.com/blog/2014/04/08/storage-situation-external-storage.html

http://commonsware.com/blog/2014/04/07/storage-situation-internal-storage.html
http://www.doubleencore.com/2014/03/android-external-storage/
https://groups.google.com/forum/#!topic/android-platform/14VUiIgwUjY%5B1-25-false%5D
http://stackoverflow.com/questions/22414417/saving-data-to-externalsdcard-android-data-app-package-name-in-kitkat

http://www.techtimes.com/articles/19510/20141106/android-5-0-lollipop-comes-with-better-sd-card-support-hoorah-google.htm

Support my projects!
Donate





Leading Cloud Surveillance, Recording and Storage service; IP camera live viewing

Leading Enterprise Cloud IT Service; cloud file server, FTP Hosting, Online Storage, Backup and Sharing

Powered by FirstCloudIT.com, a division of DriveHQ, the leading Cloud IT and Cloud Surveillance Service provider since 2003.