ralismark / bluehid

Bluetooth HID device for Android Oreo (proof of concept)
Apache License 2.0
36 stars 9 forks source link

Bluetooth HID Device Profiles on Android 9+ firmware that don't have it implemented #1

Closed ForsakenFortress closed 4 years ago

ForsakenFortress commented 5 years ago

As you know, Android 9 introduced the Bluetooth HID Device Profile API, allowing devices to operate as a mouse, gamepad, etc. However, some Android OEMs such as OnePlus, Motorola, LG have not included it in their Android 9 phones. That means users wanting to try apps like JoyCon Droid (allows you to use your device as a controller or USB gamepad bridge for the Nintendo Switch through Bluetooth) cannot use it without waiting forever for an official update that may never happen or by flashing a custom ROM such as LineageOS 16.0 or similar.

What I want to know is if it's possible to enable the API via an xposed module such as this one or even a Magisk module. If it is possible with an Xposed module, then the next best thing would be having it supported via TaiChi which can use xposed modules without root and also doesn't trip SafetyNet.

ralismark commented 5 years ago

If the API is implemented, just not enabled, then enabling it shouldn't be too hard -- something like what's done here is probably all that's needed. However, if it's not implemented at all, then it would probably require a significant amount of work to add. The first scenario is more likely, though the actual ROM needs to be checked to see which is the case/how it can be enabled.

Checking the Android 9 Bluetooth code, it appears that a similar config system is used. The service is declared in AndroidManifest.xml, but only enabled if @bool/profile_supported_hid_device is set. The value of that is declared in res/values/config.xml.

ralismark commented 4 years ago

It appears that some devices just don't have the Bluetooth HID Device API implemented. Supporting those would require significant work outside the scope of this project - though if it's just that the API/component is disabled, the BlueHID Xposed module should enable it.

Regarding TaiChi, it seems like it can load Xposed modules (and we shouldn't have issues with hooks being too long or too short), so BlueHID should directly work.