SDCardFS support is deprecated in Android 11 for kernel versions 5.4 and above. VTS testing doesn't allow mounted file systems listed as SDCardFS for those kernel versions. Previous kernel versions can continue to use SDCardFS for Android 11, however Google doesn't provide additional support.
In prior versions of Android, SDCardFS provided a way to control access to emulated internal storage and external SD cards, allowing apps to access only the data relevant to them. Additionally, it provided a layer of case insensitivity, as well as some additional storage tracking.
SDCardFS replacement functionality
In Android 11, case sensitivity is handled directly by the filesystem. This results in lookup times nearly identical in case-sensitive and case-insensitive folders, removing the large folder slowdown from SDCardFS. The quota tracking that SDCardFS was doing to quickly gather storage data for settings is now configured from userspace using project quotas. In some performance-sensitive contexts, directories are bind mounted in place. A new FUSE implementation provides scoped storage for direct filesystem access, primarily to support redaction of location information.
Configuring SDCard replacement functionality
To enable project quotas and case folding for emulated storage without SDCardFS,
emulated_storage.mk in the
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
Encryption with casefolding support requires using policy v2. To enable this,
:v2 within the vold flags in the fstab. For example:
Why deprecate SDCardFS?
There are various reasons to deprecate SDCardFS.
SDCardFS suffers from several race conditions concerning case sensitivity, as well as some issues concerning low memory circumstances. Case-insensitive lookups can be rather slow in large directories because lookups have to walk the lower directory to find alternate cases. Accessing the upper and lower filesystems at the same time can lead to issues as well.
SDCardFS requires additional patches to the VFS to support changing options on bind mounts. These patches cause additional work to accept upstream changes to these areas. SDCardFS’s features can be replicated by upstream components, removing this pain point.
Feature parity with API
In the previous release of Android, scoped storage limited access to particular types of metadata. Direct storage access through SDCardFS doesn't support these scoped storage features.