Skip to content

plateaukao/android_usb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android USB

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).

Requirements

  • Android 7.0 (API 24) or higher.
  • The app needs the signature-level permission WRITE_SECURE_SETTINGS to actually toggle the setting. Regular installs cannot grant it via the UI — see below.

Granting the permission

After installing, run once over ADB:

adb shell pm grant info.plateaukao.androidusb android.permission.WRITE_SECURE_SETTINGS

Without this grant, tapping the switch will fall back to opening Settings → Developer Options so you can flip the toggle manually.

Build & install

./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk

Or, with the android CLI:

android run --apks=app/build/outputs/apk/debug/app-debug.apk

How it works

  • MainScreen.kt reads Settings.Global.ADB_ENABLED and renders a Material 3 Switch.
  • A ContentObserver registered on the ADB_ENABLED URI keeps the UI in sync with external changes.
  • Toggling calls Settings.Global.putInt(...). On SecurityException, the app shows a Toast with the grant command and opens Developer Options.

Package

info.plateaukao.androidusb

About

Android app: toggle USB debugging via Settings.Global.ADB_ENABLED

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages