Is there an Intent that goes directly to the "Enable USB Debugging" toggle or a way to request it to be enabled?
---Situation Explanation---
We have an application we use for testing on many phones at once and they all have developer mode enabled. However, usb debugging needs to be enabled when they're all reflashed.
We're aware of how to do this via ADB but our use case requires using a traditional in Android approach.
--- End Explanation
Is it possible to open a dialog allowing the user to go directly to the Usb Debugging option?
Similarly, is it possible to do this with developer mode?
handleQsTileLongPressActionIfAny was added in Android 12, so this only works in Android 12 and higher.
In the entire source for Android 11's Settings app there is no SubSettingLauncher with WirelessDebuggingFragment.class found, so an alternative solution is not possible.
Since there exist Quick Setting Tiles for Developer Options (which includes Wireless Debugging) and long press of one brings you to it's related page in Settings, I thought to figure out what intent it is sending and how to replicate it.
I started with searching for the source file responsible for the UI of the Developer Options page in Settings. I found DevelopmentSettingsDashboardFragment.java which has the method handleQsTileLongPressActionIfAny. In this method I saw that it is looking for an intent with the ACTION_QS_TILE_PREFERENCES action and an EXTRA_COMPONENT_NAME extra that has a ComponentName matching the Settings package name (getPackageName() = com.android.settings) and tile subclass name (DevelopmentTiles.WirelessDebugging.class.getName() = com.android.settings.development.qstile.DevelopmentTiles$WirelessDebugging, see DevelopmentTiles.java).
From these observations, I wrote the following example code:
Intent intent = new Intent(TileService.ACTION_QS_TILE_PREFERENCES);
intent.putExtra(Intent.EXTRA_COMPONENT_NAME, new ComponentName("com.android.settings", "com.android.settings.development.qstile.DevelopmentTiles$WirelessDebugging"));
try {
startActivity(intent);
finish();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
finish();
}
After testing it, it works perfectly. The Quick Settings Tile for Wirless Debugging doesn't even have to be enabled for it to work (though Developer Options does have to be enabled).
Tested on Android 13 (Google Pixel 7 Pro).



If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With