Humpty Promotes > Rfo-Basic> Project Articles >


Android Storage Map  (Apr 2015).    updated (mar 2016).

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.
  • treated as 'private' but available publicly due to media being external.
  • cleared upon app-uninstall.
  • Context.getExternalFilesDir()
Before KITKAT:
- No permissions needed for read access.
- WRITE_EXTERNAL_STORAGE needed for write access, even if app is owner.

After KITKAT:
- Owner app gets full access without needing permissions.
PE Shared Storage

e.g /mnt/sdcard/

  • no sandboxing restrictions.
  • not cleared upon app-uninstall.
  • Environment.
    getExternalStorageDirectory()
    e.g /mnt/sdcard
Before KITKAT:
- No permissions needed for read access.
- WRITE_EXTERNAL_STORAGE needed for write access.

After KITKAT:
- READ_EXTERNAL_STORAGE needed for read access.
- WRITE_EXTERNAL_STORAGE grants read,write on same volume.
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/<>
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.

After KITKAT:
- 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.









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 service

Leading Enterprise Cloud IT Service Since 2003

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