UsbDetectionBypass is an LSPosed/Xposed module focused only on bypassing USB connection and USB debugging detection inside scoped Android apps. It masks common Java/framework and native signals so the target process sees a disconnected, non-debuggable USB state.
Use it only for authorized testing and research on devices and apps you are allowed to inspect.
- Masks
adb_enabledanddevelopment_settings_enabled. - Masks
android.os.SystemPropertiesand native__system_property_get. - Sanitizes
USB_STATEandACTION_BATTERY_CHANGEDbroadcasts. - Hooks
Intentextra reads for USB and battery state. - Hooks common
UsbManagerAPIs so scoped apps see no attached USB devices or enabled USB functions. - Rewrites selected command checks including
getprop,settings,dumpsys usb,dumpsys battery, and common sysfs reads. - Hooks native
open,openat, andfopenfor USB-related sysfs paths such as/sys/class/power_supply/*usb*,/sys/class/android_usb/*, and/config/usb_gadget/*. - Logs module loading and hook hits through LSPosed logs, logcat, and a per-app diagnostic file.
-
app/src/main/java/io/github/ryttermohn/usbdetectionbypass/HookEntry.kt
Main LSPosed Java entry point. Installs Java/framework hooks and diagnostic logging. -
app/src/main/java/io/github/ryttermohn/usbdetectionbypass/LogUtil.kt
Bridges native logs into LSPosed and logcat. -
app/src/main/cpp/usb_detection_bypass.cpp
LSPosed native entry point. Installs native USB property and file-read hooks. -
app/src/main/assets/xposed_init
Xposed module entry declaration. -
app/src/main/assets/native_init
LSPosed native module declaration.
Use JDK 17 or newer. Android Studio's bundled JBR also works.
.\gradlew.bat assembleDebugThe debug APK is generated at:
app/build/outputs/apk/debug/app-debug.apk
- Install the APK on a rooted device with LSPosed enabled.
- Enable the module in LSPosed.
- Select your authorized target app in the module scope.
- Reboot the device, or fully stop and restart the target app after changing scope.
- Check logs with:
adb logcat -s UsbBypass UsbBypassNative UsbDetectionBypassNativeThe module also writes UsbDetectionBypass.log under the target app's external files directory when Application.attach() is reached.
- The module package is
io.github.ryttermohn.usbdetectionbypass. - The default LSPosed scope resource is intentionally empty. Select target apps from LSPosed or add package names to
app/src/main/res/values/arrays.xml. - If no
UsbBypasslog appears, the module has not entered the target process. Recheck LSPosed scope, module enablement, package/process name, and whether the target app was restarted after module changes.