An Android home screen widget to toggle USB debugging on and off.
- Simple icon widget that changes color based on USB debugging state (green for ON, red for OFF)
- Clicking the widget toggles USB debugging (requires WRITE_SECURE_SETTINGS permission)
- Quick Settings tile for fast toggle from notification panel
- Minimal launcher activity showing permission status and instructions
- Automatic widget updates after device reboot
- Android 8.0 (API level 26) or higher
- WRITE_SECURE_SETTINGS permission granted via ADB
- Build and install the APK via command line:
./gradlew buildAndInstall
To toggle USB debugging, the app needs the WRITE_SECURE_SETTINGS permission, which is a system-level permission that cannot be granted via normal installation. You must grant it via ADB:
adb shell pm grant io.github.sawa.usbdebugtoggle android.permission.WRITE_SECURE_SETTINGSAfter running the above command, you may need to re-add the widget to your home screen.
- Add the widget to your home screen:
- Long press on the home screen → Widgets → USB Debug Toggle
- Tap the widget icon to toggle USB debugging.
- The icon color indicates the current state:
- Green: USB debugging is ON
- Red: USB debugging is OFF
- Grant the WRITE_SECURE_SETTINGS permission (see above)
- Open Quick Settings panel (swipe down from the top of the screen)
- Long press the edit button or tap the pencil icon
- Find "USB Debug" in the available tiles
- Drag it to your active Quick Settings panel
- The app watches
Settings.Global.ADB_ENABLEDwith aContentObserverwhile the process is running, then refreshes the home screen widget, requests a Quick Settings tile refresh, and updates the main screen (via a sharedStateFlow). Changes from Developer options, this app’s widget/tile/activity, or ADB should stay in sync without re-adding the widget. If a device does not notify that setting correctly, open the main activity once or toggle from this app to force a refresh. - On some devices, battery saver may prevent widget updates. To fix this, go to App Info → Battery usage → Unrestricted.
MIT License


