Skip to content

Commit

Permalink
[ADB] Add a "manual" option in the pairing dialog prompt
Browse files Browse the repository at this point in the history
In the pairing dialog prompt, the user was forced to navigate to the Wireless
Debugging settings in order to initiate the pairing. If the user rather wants to
navigate to the settings manually, this can be done by choosing the "manual"
option.

Signed-off-by: Muntashir Al-Islam <[email protected]>
  • Loading branch information
MuntashirAkon committed Dec 29, 2024
1 parent 33e547b commit 370e311
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,12 @@ public static void pairAdbInput(@NonNull FragmentActivity activity,
.setTitle(R.string.wireless_debugging)
.setMessage(R.string.adb_pairing_instruction)
.setCancelable(false)
.setNeutralButton(R.string.action_manual, (dialog, which) -> {
Intent adbPairingServiceIntent = new Intent(activity, AdbPairingService.class)
.setAction(AdbPairingService.ACTION_START_PAIRING);
ContextCompat.startForegroundService(activity, adbPairingServiceIntent);
callback.pairAdb();
})
.setNegativeButton(R.string.cancel, (dialog, which) -> callback.onStatusReceived(STATUS_FAILURE))
.setPositiveButton(R.string.go, (dialog, which) -> {
Intent developerOptionsIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS)
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,7 @@
<string name="status_connecting_via_mode">Connecting via %s</string>
<string name="status_connected_via_mode">Connected via %s</string>
<string name="status_not_connected_via_mode">Could not connect via %s</string>
<string name="adb_pairing_instruction">Please navigate to the developer options to enable wireless debugging and generate a pairing code.</string>
<string name="adb_pairing_instruction">Please navigate to the developer options to enable wireless debugging and generate a pairing code. Click <b>Manual</b> if you've already opened the developer options.</string>
<string name="adb_pairing_searching_for_port">Searching…</string>
<string name="adb_pairing_stop_searching">Stop</string>
<string name="adb_pairing_input_pairing_code">Pairing code</string>
Expand All @@ -1488,4 +1488,5 @@
<string name="backup_cache">Cache</string>
<string name="activity_name">Activity Name</string>
<string name="available_memory">Available: %s</string>
<string name="action_manual">Manual</string>
</resources>

0 comments on commit 370e311

Please sign in to comment.