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