A minimal Android app that exposes a single toggle for the system USB debugging setting (Settings.Global.ADB_ENABLED).
The switch reflects the live system value via a ContentObserver, so it stays in sync if the setting is changed elsewhere (e.g. from Developer Options).
- Android 7.0 (API 24) or higher.
- The app needs the signature-level permission
WRITE_SECURE_SETTINGSto actually toggle the setting. Regular installs cannot grant it via the UI — see below.
After installing, run once over ADB:
adb shell pm grant info.plateaukao.androidusb android.permission.WRITE_SECURE_SETTINGSWithout this grant, tapping the switch will fall back to opening Settings → Developer Options so you can flip the toggle manually.
./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apkOr, with the android CLI:
android run --apks=app/build/outputs/apk/debug/app-debug.apkMainScreen.ktreadsSettings.Global.ADB_ENABLEDand renders a Material 3Switch.- A
ContentObserverregistered on theADB_ENABLEDURI keeps the UI in sync with external changes. - Toggling calls
Settings.Global.putInt(...). OnSecurityException, the app shows aToastwith the grant command and opens Developer Options.
info.plateaukao.androidusb