LightBlog

vendredi 13 octobre 2017

Google Pixel 2 and Pixel 2 XL Add Bluetooth Battery Level Reporting

Before the first public release of Android Oreo, we spotted something interesting in the Android Open Source Project (AOSP). We discovered that Google was working on implementing Bluetooth battery level reporting so you can see the battery level of your connected Bluetooth devices without having to use a third-party application for each and every Bluetooth device. We speculated that this feature would go live in Android 8.1, but the devices expected to launch with this expected maintenance release—the Google Pixel 2 and Pixel 2 XL—launched with the current SDK version 26 (Android 8.0). Regardless, it appears that the Bluetooth battery level indicators we initially speculated about are now finally coming to Google devices.

We can verify this because of evidence we discovered in the system applications of the Google Pixel 2. We obtained access to the SystemUI and framework-res APK files of the pre-launch Verizon Google Pixel 2, and found the following strings in the SystemUI:

<string name="bluetooth_connected_battery_level">Connected, battery %1$s</string>
<string name="bluetooth_connected_no_a2dp_battery_level">Connected (no media), battery %1$s</string>
<string name="bluetooth_connected_no_headset_battery_level">Connected (no phone), battery %1$s</string>
<string name="bluetooth_connected_no_headset_no_a2dp_battery_level">Connected (no phone or media), battery %1$s</string>

The above strings show that the SystemUI (the package responsible for the navigation bar, status bar, quick settings panel, and more) has strings for showing the current battery level of a connected Bluetooth device.

Furthermore, in the Android Framework we found this new intent:

<protected-broadcast android:name="android.bluetooth.device.action.BATTERY_LEVEL_CHANGED"/>

A protected broadcast is a broadcast intent that can only by sent by system-level processes. The Android Framework will send a broadcast intent to applications that have the Bluetooth permission defined in the Android Manifest and have a broadcast receiver set up to monitor these events. This lines up with what we discovered this summer.

This means that your Google Pixel 2 and Pixel 2 XL will let apps know when the battery level changes on connected Bluetooth devices. Apps can then respond to these changes in whatever manner they want, such as with an updated notification.

LG Bluetooth Battery Level Indicator OnePlus Bluetooth Battery Level Indicator Samsung Bluetooth Battery Level Indicator

I haven’t yet been able to test pair a Bluetooth device to a Google Pixel 2 in store, but the existence of this code in the live build of the Pixel 2 indicates that this feature is ready to go live.



from xda-developers http://ift.tt/2wUvuN6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire