AI summary
LSPosed module that prevents Android from auto-creating standard media folders on external removable storage. Hooks libc mkdir symbols in MediaProvider to intercept directory creation at the volume root level for OTG drives and SD cards, without affecting internal storage or manual file manager operations. Latest update fixes colorSurface to use material R.attr.
Generated by AI. May contain inaccuracies.
About this app
An LSPosed module that stops Android from automatically creating standard media folders (Android, Music, Pictures, DCIM, Movies, and others) in the root directory of external removable storage such as OTG USB drives and SD cards.
Verified end-to-end on ColorOS 16 (Android 16, tested on PJZ110 with ColorOS V16.1.0). Should also work on AOSP-based systems.
How it works
Android's MediaProvider initialises a set of standard media folders at the root of an external volume the first time it is mounted. These folders are created through the native layer via libc's mkdir and mkdirat, not through Java's File.mkdir, so a typical Java-level hook cannot intercept them.
BlockDirs hooks the libc mkdir and mkdirat symbols inside the MediaProvider process using ShadowHook inline hooks, and applies a location-based rule rather than a directory-name blacklist:
- Only intercepts paths under /storage/, /mnt/media_rw/, or /mnt/secure/. - Excludes internal storage (emulated). - Only intercepts directories exactly one level below the volume UUID. - Returns 0 (pretending success) without actually creating the directory.
Design notes
- No hardcoded directory names: any first-level directory is intercepted, so no standard name can be missed. - Only external removable storage is affected. Internal storage at /storage/emulated is untouched. - Deeper subdirectories are unaffected. Only the first level below the volume root is intercepted. - Process-level isolation: the hook only runs inside MediaProvider. Manual folder creation from a file manager runs in a different process and is not intercepted. - No infinite loop: returning 0 (success) is a terminal signal, so the caller does not retry.
Side effect
Any first-level directory at the root of an external volume will be intercepted. This is a statement about the hook semantics only; manual directories created by a file manager process are not affected.
Requirements
- LSPosed framework installed - Module scope: System Framework and com.android.providers.media.module (MediaProvider) - A reboot (or soft reboot) after enabling, so Zygote injection takes effect
Setup
1. Install the APK. 2. Open LSPosed and enable the module. The module ships with a built-in scope suggestion that pre-selects MediaProvider. 3. Set the scope to System Framework and com.android.providers.media.module. 4. Reboot the phone (or soft reboot) so Zygote injection takes effect. 5. Insert an OTG USB drive or SD card and check that its root no longer generates media folders automatically.
If the older module io.github.rootuser.no_otg_media_folders was previously installed, uninstall it first to avoid confusion during verification.
Disclaimer
BlockDirs is an independent, community-developed LSPosed module. It is not affiliated with LSPosed, MediaProvider, Google, or any third-party service. All trademarks belong to their respective owners.
What's new
- 阻止外置存储(OTG U 盘 / SD 卡)自动创建 Android、Music、Pictures、DCIM、Movies 等标准目录的 LSPosed 模块。
- 本次更新: fix: colorSurface 使用 material R.attr 而非 android.R.attr
About this version
- Version
- git+ce85108b (86)
- Size
- 3.06 MB
- Requires Android
- 11
- Target SDK
- 30
- Architecture
- arm64-v8a
- Downloads
- 5
- Updated
- Sep 18, 2026
- Package
- top.yixiangren.blockdirs
Similar apps
Ratings & reviews
- 50
- 40
- 30
- 20
- 10