Tools / 02
OTG Switch
One tap to turn on USB OTG, from the home screen.
The problem
On my OnePlus phone, USB OTG hides deep in Settings and switches itself off after 10 minutes. Plugging in a pen drive meant digging through menus every time.
What it does
- Tap the app icon, the widget or the quick-settings tile to flip OTG.
- A 'Keep on' switch turns OTG back on after the system's auto-off.
- A USB-C plug animation slides in when OTG turns on and pulls out when it turns off.
How it's built
- I decompiled SystemUI and found that writing the OTG setting alone does nothing: the real switch is a charger hardware call.
- So v3 uses an accessibility service that opens the real OTG switch in Settings and taps it, behind a full-screen animation.
- A background job keeps the widget and tile in sync with the real state, and re-arms after a reboot.
Private build · demo on request
Next tool 👉GitHub Widgets