Skip to content

Conversation

@ersanin
Copy link
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
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
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
Contributor Author

Choose a reason for hiding this comment

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

Done

@OvsyannikovMaksim
Copy link
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
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

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.

5 participants