adolfintel / OpenPods

The Free and Open Source app for monitoring your AirPods on Android
https://fdossena.com/?p=openPods/index.frag
GNU General Public License v3.0
969 stars 164 forks source link

Beats X & Beats Flex Support #105

Closed ghost closed 3 years ago

ghost commented 3 years ago

I can confirm that my BeatsX headphones are working with this app. The percentage level is correct but it is shown only next to to the right airpod. I extracted a logcat from Android Studio to help you recognise them.

logcat output ``` 2020-10-15 12:14:55.657 17684-17684/? I/m.dosse.airpod: Late-enabling -Xcheck:jni 2020-10-15 12:14:55.672 17684-17684/? E/m.dosse.airpod: Unknown bits set in runtime_flags: 0x8000 2020-10-15 12:14:55.844 17684-17684/com.dosse.airpods W/m.dosse.airpod: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) 2020-10-15 12:14:55.844 17684-17684/com.dosse.airpods W/m.dosse.airpod: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) 2020-10-15 12:14:55.885 17684-17684/com.dosse.airpods W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@2f7884c 2020-10-15 12:14:55.943 17684-3373/com.dosse.airpods I/AdrenoGLES: QUALCOMM build : 35556ba, I9ca166462c Build Date : 08/07/19 OpenGL ES Shader Compiler Version: EV031.27.02.00 Local Branch : Remote Branch : Remote Branch : Reconstruct Branch : 2020-10-15 12:14:55.943 17684-3373/com.dosse.airpods I/AdrenoGLES: Build Config : S P 8.0.8 AArch64 2020-10-15 12:14:55.946 17684-3373/com.dosse.airpods I/AdrenoGLES: PFP: 0x016ee187, ME: 0x00000000 2020-10-15 12:14:55.961 17684-3373/com.dosse.airpods W/Gralloc3: mapper 3.x is not supported 2020-10-15 12:15:09.923 17684-17684/com.dosse.airpods W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@bf8253c 2020-10-15 12:15:20.538 17684-3357/com.dosse.airpods D/BluetoothAdapter: onBluetoothServiceUp: android.bluetooth.IBluetooth$Stub$Proxy@405951b 2020-10-15 12:15:22.073 17684-17684/com.dosse.airpods E/BluetoothDevice: BT not enabled. Cannot get remote device Uuids 2020-10-15 12:15:22.077 17684-17684/com.dosse.airpods I/chatty: uid=10242(com.dosse.airpods) identical 3 lines 2020-10-15 12:15:22.078 17684-17684/com.dosse.airpods E/BluetoothDevice: BT not enabled. Cannot get remote device Uuids 2020-10-15 12:15:22.221 17684-3357/com.dosse.airpods D/BluetoothHeadset: onBluetoothStateChange: up=true 2020-10-15 12:15:22.232 17684-17684/com.dosse.airpods D/AirPods: BT ON 2020-10-15 12:15:22.232 17684-17684/com.dosse.airpods D/AirPods: START SCANNER 2020-10-15 12:15:22.236 17684-17684/com.dosse.airpods D/BluetoothAdapter: isLeEnabled(): ON 2020-10-15 12:15:22.250 17684-3357/com.dosse.airpods D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=5 mScannerId=0 2020-10-15 12:15:22.327 17684-3357/com.dosse.airpods D/BluetoothHeadset: Proxy object connected 2020-10-15 12:15:22.328 17684-17684/com.dosse.airpods D/AirPods: BT PROXY SERVICE CONNECTED 2020-10-15 12:15:28.400 17684-17684/com.dosse.airpods D/AirPods: ACL CONNECTED 2020-10-15 12:15:32.331 17684-17684/com.dosse.airpods D/AirPods: -26db 2020-10-15 12:15:32.356 17684-17684/com.dosse.airpods D/AirPods: 071901052000F50F0101006DCEC004220A85312D826B428001201A 2020-10-15 12:15:33.074 17684-3465/com.dosse.airpods D/AirPods: Creating notification 2020-10-15 12:15:33.100 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:34.119 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:35.137 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:36.152 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:37.178 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:37.343 17684-17684/com.dosse.airpods D/AirPods: -28db 2020-10-15 12:15:37.353 17684-17684/com.dosse.airpods D/AirPods: 071901052000F50F0101007DBE339E1692937ADF30926FF680D0AC 2020-10-15 12:15:38.209 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:39.241 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:41.310 17684-3465/com.dosse.airpods I/chatty: uid=10242(com.dosse.airpods) Thread-3 identical 2 lines 2020-10-15 12:15:42.341 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:42.375 17684-17684/com.dosse.airpods D/AirPods: -29db 2020-10-15 12:15:42.383 17684-17684/com.dosse.airpods D/AirPods: 071901052000F50F0101007DBE339E1692937ADF30926FF680D0AC 2020-10-15 12:15:43.374 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:44.407 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:45.440 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:46.450 17684-3465/com.dosse.airpods D/AirPods: Left: 15 Right: 5 Case: 15 Model: airpods12 2020-10-15 12:15:47.378 17684-17684/com.dosse.airpods D/AirPods: ACL DISCONNECTED 2020-10-15 12:15:47.393 17684-17684/com.dosse.airpods D/AirPods: -26db 2020-10-15 12:15:47.399 17684-17684/com.dosse.airpods D/AirPods: 071901052000F50F0101007DBE339E1692937ADF30926FF680D0AC 2020-10-15 12:15:47.472 17684-3465/com.dosse.airpods D/AirPods: Removing notification 2020-10-15 12:15:57.484 17684-3357/com.dosse.airpods D/BluetoothHeadset: Proxy object disconnected 2020-10-15 12:15:57.485 17684-17684/com.dosse.airpods D/AirPods: BT PROXY SERVICE DISCONNECTED 2020-10-15 12:15:57.485 17684-3357/com.dosse.airpods D/BluetoothHeadset: Proxy object disconnected 2020-10-15 12:15:57.486 17684-17684/com.dosse.airpods D/AirPods: BT PROXY SERVICE DISCONNECTED 2020-10-15 12:15:57.775 17684-3357/com.dosse.airpods D/BluetoothHeadset: onBluetoothStateChange: up=false 2020-10-15 12:15:57.780 17684-17684/com.dosse.airpods D/AirPods: BT OFF 2020-10-15 12:15:57.782 17684-17684/com.dosse.airpods D/AirPods: STOP SCANNER 2020-10-15 12:15:57.783 17684-17684/com.dosse.airpods D/BluetoothAdapter: isLeEnabled(): BLE_TURNING_OFF 2020-10-15 12:15:57.784 17684-17684/com.dosse.airpods D/AirPods: BT OFF 2020-10-15 12:15:57.784 17684-17684/com.dosse.airpods D/AirPods: STOP SCANNER 2020-10-15 12:15:57.785 17684-17684/com.dosse.airpods D/BluetoothAdapter: isLeEnabled(): BLE_TURNING_OFF 2020-10-15 12:15:58.161 17684-3357/com.dosse.airpods D/BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@405951b ```
adolfintel commented 3 years ago

This is excellent. I need some way to distinguish them to show the proper images though.

I distinguish the Pro model from the regular one by looking at the 8th character in the hex string received from the headphones, I wonder if the value 5 could be used to identify Beats headphones.

ghost commented 3 years ago

It should be mentioned that all Beats headphones with W1 chip should work with your app so I think the numbers across Beats line (e.g. PowerBeats) are also different. Unfortunately i don't have any other model to test it, so let me know if there is anything more I can do to help you.

Marco98 commented 3 years ago

I own Beats Flex with a W1 chip and get the following hex string: 07190110200AF48F000100C4719F9CEFA2E3BA66FE1D459FC92FA0 If anyone needs any further information, I will be happy to provide it.

Electric1447 commented 3 years ago

@Marco98 I don't have those earphone, First, you need to filter and detect them. Then, you'll also need to get info from the hex string (battery%, charging, ect)

Marco98 commented 3 years ago

I've checked all states represented in the hex string and it seems pretty simple in comparison to the apples airpods:

As for detecting the right product, i am not sure but as @adolfintel pointed out that he distingushes it by hex char 8. AFAIK the following values for this char are known:

So with the current knowledge i think the easiest would be to add a third image as the beats flex and X look almost identical and show it in the notification when hex char 8 is either 0x0 or 0x5. Then it can just show the battery percentage from the 14th char, as there is only one battery in both discussed products. This should be enough to make this compatibility between openpods and beats x/flex look intended. I would love making you this available through a pr but i've never developed anything for android except through cordova/capacitor.

If you need anything more from me, i'll be more than happy to provide it.

Electric1447 commented 3 years ago

That's very useful info, When I'll have some time to work on this I'll post a debug apk here for you to test

Electric1447 commented 3 years ago

@adolfintel what is the hex value for airpods 1&2?

Electric1447 commented 3 years ago

@Marco98 it would be easy now to add beats support because I rewritten the app for easier support for future devices

adolfintel commented 3 years ago

@adolfintel what is the hex value for airpods 1&2?

I don't remember. When pro support was added, I used airpods12 as a fallback for all models that weren't the pro. I suggest you do the same, treat some models as special and use the original as fallback for all supported but unknown models.

Electric1447 commented 3 years ago

I still have my old airpods 2nd gen but I need someone to send a log with an airpods 1st gen

Electric1447 commented 3 years ago

The problem is from what I remember the airpods also used an hex code of 5

Electric1447 commented 3 years ago

I'll check in older issues if anyone posted logs

Electric1447 commented 3 years ago
Electric1447 commented 3 years ago

089fc199bbdcfacd964f4d525cd09bd895974cb0 still need to add assets though

Electric1447 commented 3 years ago

Added assets let me know if there is an issue.