Android P adds support for using your phone as a Bluetooth Keyboard or Mouse
Back in 2014, a patch was submitted by a member of Qualcomm’s CodeAurora forums that adds support for the Bluetooth HID device role. That patch was committed in December of 2016, however the functionality remained disabled for subsequent Android releases. That appears to be changing with the release of Android P as we were sent a tip by XDA Member 500 Internal Server Error that two commits finally enable Bluetooth HIDD.
We confirmed ourselves that this Bluetooth HID profile has only recently been added, as a comparison of the supported Bluetooth profiles in Android 8.1 Oreo (branch oreo-mr1-release) versus the latest master shows that the boolean value enabling HIDD has been flipped to true.
Furthermore, the relevant APIs for developers to use have been unhidden, which means applications will be able to take advantage of this functionality on Android devices running the P release (starting with the Google Pixel and Pixel 2 devices).
So what exactly does this all mean?
Android P Bluetooth HID Device Profile Service
Bluetooth-enabled devices can offer support for what are called “Bluetooth Profiles.” You might be familiar with some of the more common ones, such as the Hands-Free Profile (HFP) and Advanced Audio Distribution Profile (A2DP), which are typically used for voice calls and music streaming respectively. Implementing the Human Interface Device (HID) Bluetooth profile allows for input devices such as mice, keyboard, joysticks, and more to work.
By default, Android (as in, the base build from the Android Open Source Project) does not implement support for HIDD in the Bluetooth stack. That means app developers cannot create apps utilizing the service to enable your smartphone to be used as a basic keyboard/mouse input device. There are root-enabled apps on the Play Store such as Bluetooth+ which patch the Bluetooth framework to enable HIDD, and when combined with another app such as True Mouse/KB, you can use your smartphone as an input device.
However, native support in AOSP means that all devices running Android P can be used as input devices over Bluetooth. We can see how this might be useful to potentially control workplace presentations or as a media remote whenever you don’t have access to a better solution. Companies such as Samsung and Huawei have been touting ways to use your smartphone as a mobile workstation, and while this feature pales in comparison to the ecosystem that these two companies offer, it’s a nice step forward in inter-connectivity between your Android device and your other devices.