Skip to content

TECH: added bluetooth's switcher#684

Merged
Nikitae57 merged 4 commits intomasterfrom
TECH-device-bluetooth-switch
Apr 17, 2026
Merged

TECH: added bluetooth's switcher#684
Nikitae57 merged 4 commits intomasterfrom
TECH-device-bluetooth-switch

Conversation

@ersanin
Copy link
Copy Markdown
Contributor

@ersanin ersanin commented Nov 19, 2024

No description provided.

@ersanin ersanin force-pushed the TECH-device-bluetooth-switch branch from 1a7310f to 32eb9e1 Compare November 21, 2024 01:11
Copy link
Copy Markdown
Collaborator

@Nikitae57 Nikitae57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changeBluetoothStateUsingAdbServer method needs attention. Everything else either minor or LGTM

logger.i("Bluetooth is not supported")
return
}
logger.i("${if (enable) "En" else "Dis"}able bluetooth")
Copy link
Copy Markdown
Collaborator

@Nikitae57 Nikitae57 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, make two separate calls to the logger. Concatenating log strings make them almost imposible to find in the code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Nikitae57
Nikitae57 previously approved these changes Dec 6, 2024
@OvsyannikovMaksim
Copy link
Copy Markdown
Collaborator

OvsyannikovMaksim commented Dec 12, 2024

Hi! why you don't use more stable way to turn on/off bluetooth
It's work for me on Android 9+

        // Opening a dialog with the permission to turn on bluetooth
        adbServer.performShell("am", listOf("start -a android.bluetooth.adapter.action.REQUEST_ENABLE"))
        // Move cursor to "Allow" button
        adbServer.performShell("input", listOf("keyevent ${KeyEvent.KEYCODE_DPAD_RIGHT}"))
        adbServer.performShell("input", listOf("keyevent ${KeyEvent.KEYCODE_DPAD_RIGHT}"))

        // Clicking the "Allow" button
        adbServer.performShell("input", listOf("keyevent ${KeyEvent.KEYCODE_ENTER}"))

For disabling you can use same adb command "adb shell am start - a android.bluetooth.adapter.action.REQUEST_DISABLE"

/**
* The implementation of the [Bluetooth] interface.
*/
class BluetoothImpl(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this class is only needed inside our framework and should not be visible outside - let's make it internal to limit the creation of new instances and minimize the side effects of possible breaking changes in this class

@Nikitae57 Nikitae57 merged commit 9474b38 into master Apr 17, 2026
4 of 6 checks passed
@Nikitae57 Nikitae57 deleted the TECH-device-bluetooth-switch branch April 17, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants