From 370e311c4bb43086f9859ec35f2f84a8b6a334f1 Mon Sep 17 00:00:00 2001 From: Muntashir Al-Islam Date: Sun, 29 Dec 2024 00:26:37 -0800 Subject: [PATCH] [ADB] Add a "manual" option in the pairing dialog prompt 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 --- .../io/github/muntashirakon/AppManager/settings/Ops.java | 6 ++++++ app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/muntashirakon/AppManager/settings/Ops.java b/app/src/main/java/io/github/muntashirakon/AppManager/settings/Ops.java index e14e27546dc..f4b58732c13 100644 --- a/app/src/main/java/io/github/muntashirakon/AppManager/settings/Ops.java +++ b/app/src/main/java/io/github/muntashirakon/AppManager/settings/Ops.java @@ -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) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 74bd9f94c4a..9251ec15456 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1468,7 +1468,7 @@ Connecting via %s Connected via %s Could not connect via %s - Please navigate to the developer options to enable wireless debugging and generate a pairing code. + Please navigate to the developer options to enable wireless debugging and generate a pairing code. Click Manual if you've already opened the developer options. Searching… Stop Pairing code @@ -1488,4 +1488,5 @@ Cache Activity Name Available: %s + Manual