BlockDirs

Verified safeExclusive
No reviews reviews
11
downloads
11
android

AI summary

LSPosed module that blocks Android from auto-creating standard media folders (Android, Music, Pictures, DCIM, Movies) on external storage like OTG drives and SD cards. Hooks libc mkdir calls in MediaProvider using ShadowHook, intercepting only first-level directories under removable volume paths while leaving internal storage untouched.

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

v1.1Sep 16, 2026

Added an LSPosed module that blocks external storage (OTG drives / SD cards) from automatically creating standard directories like Android, Music, Pictures, DCIM, and Movies.

About this version

Version
1.1 (2)
Size
541.69 KB
Requires Android
11
Target SDK
30
Architecture
arm64-v8a
Downloads
11
Updated
Sep 16, 2026
Package
top.yixiangren.blockdirs

Similar apps

Ratings & reviews

0 ratings
  • 5
    0
  • 4
    0
  • 3
    0
  • 2
    0
  • 1
    0

Write a review

Tap a star to rate this app