BlockDirs

Verified safeExclusive
5.0
1 review
20
downloads
11
android

AI summary

LSPosed module that prevents MediaProvider from automatically creating first-level folders on removable USB and SD storage. Requires LSPosed, configured module scope, and a reboot; the update adds diagnostic logging.

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

vgit+e3f8a9a9Oct 16, 2026
  • 阻止外置存储(OTG U 盘 / SD 卡)自动创建 Android、Music、Pictures、DCIM、Movies 等标准目录的 LSPosed 模块。
  • 本次更新: diag(native): 加全链路诊断日志(LOGE级)覆盖 scan/delete/lstat/errno/hook自检

About this version

Version
git+e3f8a9a9 (103)
Size
3.92 MB
Requires Android
11
Target SDK
30
Architecture
arm64-v8a
Downloads
20
Updated
Oct 16, 2026
Package
top.yixiangren.blockdirs

Similar apps

Ratings & reviews

5.0·1 review
5.0
1 rating
  • 5
    1
  • 4
    0
  • 3
    0
  • 2
    0
  • 1
    0

Write a review

Tap a star to rate this app

Recent reviews

Showing 1 of 1