yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] _Dorime_:
I do not know if you are currently working with files, but can you please modify my libraries (if possible) meizu 16th, android 10.
[Android Software/Hacking General [Developers Only]] reas0n:
So...does it work for Android 12 on any custom ROM?
[Android Software/Hacking General [Developers Only]] zyhk:
Only recent crDroid on some devices and its GSI (using the AOSP bluetooth stack, not Qcomm offloading nor QTI ones) still. You can probably attempt the GSI on DSU with "Force-disable A2DP offload" option.
[Android Software/Hacking General [Developers Only]] pixel_peeper:
Hi, can someone help me understand something? Is the higher bitrate of sbc xq only possible in dual channel mode? My Sony WH XB-700 headphones seem to support dual channel but the option is grayed out in my dev options. Any workarounds? Because upon checking my bluetooth logs, it seems that they're only operating on the basic 328kbps even after flashing the 552 kbps mod.

I have attached my log for reference. Any help/insight would be appreciated. Thank you.
[Android Software/Hacking General [Developers Only]] Jesusemwen:
Hi, I'm using a Samsung Galaxy A03s, with Stock One UI 3.1. (Android 11) with the possibility of receiving an update to One UI 4.1 (Android 12) withing the coming months... I use multiple Bluetooth devices, but my main ones are my QCY T17 & QCY T17s...

I haven't achieved root yet, so I want to know how to go about getting my libs. patched. Thanks in advance

P.S.: I'm willing to get root if need be.
[Android Software/Hacking General [Developers Only]] Jesusemwen:
I can't find the btsnoop_hci.log file anywhere... the bt_stack.conf doesn't tell me anything.

(Just incase, I've attached the .conf file underneath.
[Android Software/Hacking General [Developers Only]] Jesusemwen:
Are you saying I must use a custom ROM to increase the SBC from stereo to Dual Channel
[Android Software/Hacking General [Developers Only]] MathePro:
Connection:

60:ab:67:07:33:5f (Mi A3) → 1c:52:16:42:27:2b (Mi True Wireless EBs Basic 2S)

Supported codecs:

Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..48)

Used for audio:

Audio SBC (44100 | JointStereo | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..48)
[Android Software/Hacking General [Developers Only]] golvelliuscs:
Hi ..

I am using a Lineage 16 microg treble build ... and a Huawei P9 .

I have been elaborating some test with 3 different bluettoth systems ..

Conclusion : If the bluetooth it's old and have only SBC then SBC-HD enable appears.

If the bluetooth system supports ACC or higher codecs .. then i have to go to development options and disable ( AAC) and enable SBC ( Dual channel) to enable ( SBC -HD) ...

Is this Correct?

Also when reconnect the bluetooth sbc is on STERO and i need to go to development options to re-enable it ...

Is there any utility that can be use to default this Bluetooth system to Dual Channel ..? So i do not need to reconfigure everytime i connect the bluetooth ?

Best regards
[Android Software/Hacking General [Developers Only]] Zdrawko0o:
My friend,

How to get btsnoophci.log in samsung android 13?

Thanks!
[Android Software/Hacking General [Developers Only]] klaberte:
Sorry for the very late reply. The answer to your question is yes and no. :)

Yes, higher bitrate for sbc is available via multiple configuration changes, including adjusting the bitpool, decreasing the subbands, and of course, from ValdikSS, force dual channel. If you have access to a Windows machine, you can install Alternative A2DP Driver (ahttps://www.bluetoothgoodies.com/a2dp/) and try out the various combinations of SBC tweaking. For me, it "just works".

No, it is very hard to make changes to your android phone to do something similar, even if you follow directions closely. Valdikss started this thread offering to make mods to the system files for early users, but he has long since moved on to other things. Quite a few of the posts in this thread are people trying (mostly unsuccessfully) to make changes to SBC on their Android device.

If you need more information, let me know.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Please try these. Didn't make unrestricted version since MTU limits are too bothersome to patch.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Try these please.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Use these.
[Android Software/Hacking General [Developers Only]] rohit3192:
Why not make some twrp patch that patch Bluetooth.default. so library?

There may be provision kept to back up original in case one wants to revert to original.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Because binary patching is not universal. It depends on compiler flags, optimization options, architecture tuning options, Bluetooth stack modifications.
[Android Software/Hacking General [Developers Only]] Meowdib:
Where are these files located on the Pixel 2? I'm running Pie and I don't see these at all:

/system/lib/hw/bluetooth.default.so and /system/lib64/hw/bluetooth.default.so

Where do I put the files given?
[Android Software/Hacking General [Developers Only]] ValdikSS:
/system/lib64/libbluetooth.so
[Android Software/Hacking General [Developers Only]] dontuse:
Hey, I really appreciate the work you've done here.

I'm just confused if I need to delete the default Bluetooth.default.so and/or replace it with the 576 or 486 file.

Thanks, this is also for the OnePlus 5 on oxygen os
[Android Software/Hacking General [Developers Only]] ValdikSS:
Just rename the original file, copy one of patched libraries to /system/lib(64)/hw and rename it to bluetooth.default.so.
[Android Software/Hacking General [Developers Only]] JonasVFC:
any idea on how to do this on windows?
[Android Software/Hacking General [Developers Only]] ValdikSS:
Microsoft Bluetooth Stack does not support Dual Channel, Toshiba stack stutters on my PC even with low bitrates, Bluesoleil crashes the kernel (blue screen) on A2DP activation on my PC.
[Android Software/Hacking General [Developers Only]] dontuse:
Awesome thanks!
[Android Software/Hacking General [Developers Only]] zinou213:
How about LG V20 ANSWER ???
[Android Software/Hacking General [Developers Only]] partcyborg:
Great post! This kind of stuff showing up in here from time to time reminds me that people still pull off awesome hacks in Android even to this day.

I'm curious if you are aware of any arbitrary limitations placed in even the aptx protocols that might make those devices benefit from similar modifications? I am definitely going to look into doing this for some older hardware I have, but I've already updated my main set of gear to something that supports aptx.

Thanks again for sharing such great work!
[Android Software/Hacking General [Developers Only]] ValdikSS:
LG V20 has a modified bluetooth stack, it doesn't even have bluetooth.default.so. I can't patch that.
[Android Software/Hacking General [Developers Only]] ValdikSS:
aptX and aptX HD is the same codec, with different encoding profiles. aptX splits audio into 4 frequency bands and uses (in case of 44.1 kHz) 8 bits for 0-5.5 kHz, 4 bits for 5.5-11 kHz, 2 bits for 11-16.5 and 2 bits for 16.5-22 kHz. aptX encoded data uses 4 times less bandwidth (8 bits + 4 bits + 2 bits + 2 bits / 4 frequencies = 4, compared to usual 16 bit audio), and that's why the bitrate is 352 kbit/s, it's just full PCM 44100 Hz * 16 bits * 2 channels = 1411 kbit/s, divided by 4 gives us 352 kbit/s.

aptX HD uses 2 more bits in every frequency: 10 bits for 0-5.5 kHz, 6 bits for 5.5-11 kHz, 4 bits for 11-16.5 and 4 bits for 16.5-22 kHz, which gives us 529 kbit/s for 44.1 kHz.

aptX and aptX HD have a strictly defined profiles which could not be changed without encoder and decoder modifications. Neither headphone manufacturer nor Bluetooth stack manufacturer can change them. This is a strong side of the codec, you always know what audio quality you will get with them, no buts.

On the contrary, SBC was designed to be versatile. It has a lot of configurable parameters, dynamic bitrate (encoder may decrease bitpool parameter if radio link is congested, Android doesn't do that, Linux Pulseaudio only decreases but does not increase back, Windows both decreases and increases very well) and does not have strictly defined profiles. It only has recommendations for "medium quality" and "high quality" audio in the A2DP specification, which were defined back in 2003. "High quality" audio is not so high by current standards, but most of Bluetooth stacks and headphone manufacturers decided to lock maximum available profile to the "high quality" profile, while there is no technical restrictions to use other, better parameters.

This is a weak side of SBC: you don't know what audio quality you will get before trying, and you can't see these parameters with usual software. SBC can produce very low quality audio to very high quality audio (on par or better than aptX HD), but you'll almost never get very high quality audio without disabling or circumventing artificial limitations.
[Android Software/Hacking General [Developers Only]] INSANEMODE:
any word on if this breaks safetynet since you are modifying /system?
[Android Software/Hacking General [Developers Only]] ValdikSS:
Most probably it will break Safetynet.
[Android Software/Hacking General [Developers Only]] partcyborg:
Thank you for the detailed explanation! It's not every day I learn something on xda these days, so really, thank you for that.

Am I correct in assuming that these extra knobs that Samsung provides in it's Oreo firmware are in relation to this variable nature of sbc? (See attached pic)

One final set of questions, if you dont mind: for my non aptx device, I also am given the option of AAC as a codec for BT. Given the stock libraries this sounds noticably better than SBC, but I imagine with your mods the converse would likely be true(?) Is AAC in this sense just packing the audio into AAC encoding for shipment over the air, same as the AAC audio files you might get from say the iTunes store? Given AAC is lossy (I highly doubt ALAC is included in there) I'd think SBC has the potential of being better if the data rate is higher, especially for things like playing FLACs (which I do all the time). If the pcm data can "fit" in the SBC stream will it be effectively lossless? I'm also assuming that it would technically be possible to expose and tweak the AAC encoding knobs (If that doesn't happen already), although it would be fruitless to do so if SBC does a better job anyway.
[Android Software/Hacking General [Developers Only]] ValdikSS:
You forgot to attach the picture.

AAC compared to SBC or aptX is a very complex codec with serious psycho acoustic model. SBC and aptX were designed to be used on a micro controllers with minimum CPU power, to conserve the battery. AAC decoding requires much more CPU power, but it's also gives much higher audio quality with the same bitrate. It is assumed that AAC 256 kbit/s, which is used in Bluetooth, is imperceptible from the original. But AAC was designed for storage, not for low-latency streaming, and may give higher latency compared to SBC or aptX.

I'd just use AAC if it's available.

Yes.

No, high-bitrate SBC can't produce truly lossless audio.
[Android Software/Hacking General [Developers Only]] partcyborg:
D'oh! Here it is. Sorry about that
[Android Software/Hacking General [Developers Only]] Locke706:
It's possible to mod the LG Stylo 2 plus ? If so I'm down to test.
[Android Software/Hacking General [Developers Only]] ValdikSS:
These options are for LDAC codec, not for SBC. I'm planning to make the same menu for SBC.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Follow the instruction in the second post.
[Android Software/Hacking General [Developers Only]] Collixsion:
I have a Xiaomi MI A1 and can test a Jaybird X3.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Use this 64-bit library.
[Android Software/Hacking General [Developers Only]] Collixsion:
This is the log I got with that _512 file.

There are no artifacts in audio.
[Android Software/Hacking General [Developers Only]] zinou213:
OK thank you so, LG V20 is not patchable or already patched ?
[Android Software/Hacking General [Developers Only]] ValdikSS:
Your device selected AAC as a codec. Is it possible to force SBC on your device? Try to find an option in Bluetooth device configuration (gear icon near headphones) or in developer settings.
[Android Software/Hacking General [Developers Only]] Collixsion:
It seems like every time it connects, it chooses AAC as default. So after connecting I changed AAC to SBC in dev settings. Here are the new logs and a screenshot of my bluetooth dev settings.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Thanks, Jaybird X3 supports 507 kbit/s SBC.
[Android Software/Hacking General [Developers Only]] bmg1001:
What are your opinions on the new aptX Adaptive codec? https://www.xda-developers.com/qualcomm-aptx-adaptive-bluetooth-audio-codec/
[Android Software/Hacking General [Developers Only]] ValdikSS:
That's good if it works as described, but all these features were already available in SBC, so Qualcomm is not an innovator here.

The bitrates are rather low, which means that aptX Adaptive is not a simple ADPCM anymore, but something more complex and more like current audio codecs with psycho acoustic model.

Interesting that aptX Low Latency haven't been available on any devices with OS as far as I know. I thought that was because Qualcomm doesn't want to provide encoder and decoder as a library to prevent software reverse engineering, but for Adaptive they have games in mind, so it would be available as a library.
[Android Software/Hacking General [Developers Only]] ShameemGuyin:
Hi, I have a supported bt headphone.

I want to apply the mod for my Moto G5 Plus.

OS: stock Oreo 8.1 32bit

https://drive.google.com/file/d/1nZ50Hg5ax5nK775BxyZ1uAT4ONg3s7ZX/view?usp=drivesdk
[Android Software/Hacking General [Developers Only]] ValdikSS:
Are your headphones listed as tested in the third message? If so, there's no need to re-test them.
[Android Software/Hacking General [Developers Only]] TotallyAnxious:
Im away from home for the weekend and don't have my laptop. But this would work for non headphones right? I have some aptx speakers and based off what I read I could get better sound quality via sbc assuming the speakers support a high enough bitrate. If so I'll go through the process once I get home.
[Android Software/Hacking General [Developers Only]] ValdikSS:
This works with any Bluetooth audio devices, not only with headphones. Most probably you won't hear any difference between aptX and high bitrate SBC, but sure, you can try.
[Android Software/Hacking General [Developers Only]] TotallyAnxious:
I was rereading all your posts and I realized I don't actually understand how I supposed to modify bluetooth.default.so. I don't have any of the non listed Bluetooth devices, so I'm fine patching it myself. But you only say to either send you the files or modify Android source code. How would modify the precompiled libs that come with the stock rom of my phone
[Android Software/Hacking General [Developers Only]] ValdikSS:
That's not trivial and requires some skills in ARM/AArch64 assembly. I wrote a manual in Russian for Android 5-7 and realized that nobody would follow these steps anyway, so didn't bother to translate it into English or write a manual for Android 8-9.
[Android Software/Hacking General [Developers Only]] ShameemGuyin:
Sorry to disturb you again. I also have a Sony bluetooth speaker SRS-XB20 which is not listed.

If you kindly provide the patch I could try it.

https://drive.google.com/folderview?id=1fJ7AW8hKoadTt_ABZ74bvIR9t8d7C1tn
[Android Software/Hacking General [Developers Only]] ValdikSS:
Unfortunately, these libraries contain Qualcomm modifications and hardware offloading. I don't know how to patch them.
[Android Software/Hacking General [Developers Only]] ShameemGuyin:
It's ok, thank you for time and effort.
[Android Software/Hacking General [Developers Only]] nekotitix:
Hi, I send you the btsnoop file on your website, I have the Seenheisee HD4.40BT who's on the third post, and I have the Xiaomi Mi Max 2 with android 7.1.1 on Miui 10 beta, 64 bit. I want to use the mod, please.

Thanks for your time and your hard work !
[Android Software/Hacking General [Developers Only]] ValdikSS:
You forgot to upload the library.
[Android Software/Hacking General [Developers Only]] nekotitix:
My bad :/

Here is it ! Thanks.
[Android Software/Hacking General [Developers Only]] nekotitix:
I tried all three, the 594 one work pretty well but I can't tell if there's a difference ^^

Thanks a lot guy ! I appreciate your work !
[Android Software/Hacking General [Developers Only]] ValdikSS:
LineageOS 15.1 (Android 8.1) patchset is ready.

https://review.lineageos.org/#/q/topic:bt-sbc-hd-dualchannel

This patchset adds "HD Audio: SBC" checkbox into Bluetooth device menu and Dual Channel item into Bluetooth channel mode inside developer menu.

The checkbox activates 452 kbit/s (44.1 kHz) Dual Channel for EDR 2 mbit/s devices, 551.3 kbit/s for EDR 3 mbit/s devices. Bitrate could be increased up to 596 kbit/s with a prop.
[Android Software/Hacking General [Developers Only]] ValdikSS:
LineageOS 16 (Android 9) patchset is also ready.

https://review.lineageos.org/#/q/topic:bt-sbc-hd-dualchannel-pie

Also submitted into AOSP code review, we'll see how it goes.

https://android-review.googlesource.com/q/topic:"bt-sbc-hd-dualchannel"
[Android Software/Hacking General [Developers Only]] danishhot:
Sounds' like an adventure!

Hi, I really appreciate your efforts! This s is next level audio tuning over Bluetooth! I've uploaded the files separately. Device is Redmi Note 4 SD. Plus, I've also shared my system info screenshot! I am using LOS 15.1 Oreo latest build with Franco kernel latest build as well.

Thank you!
[Android Software/Hacking General [Developers Only]] ValdikSS:
[MENTION=4250572]danishhot[/MENTION], please ask your firmware provider to build it with the following patchset:

Patch #1

Patchset #2
[Android Software/Hacking General [Developers Only]] danishhot:
Thank you :)
[Android Software/Hacking General [Developers Only]] SpiderSGS6:
Hello,

Model: Xiaomi Mi 8

ROM: Xiaomi.eu

MIUI: 10 (8.9.13 - Android Pie)

Changed file name by me - libbluetooth (x64) .so = /system/lib64/libbluetooth.so

I will make you correct the sound quality if you get. I have three Bluetooth audio devices :)
[Android Software/Hacking General [Developers Only]] ValdikSS:
[MENTION=8511665]SpiderSGS6[/MENTION], sorry, I'm no longer accepting libraries for patching. Please test on the PC.

Current results show that most devices correctly work with SBC Dual Channel and high bitrates. The test can be considered complete. Thanks for all who participated.

Bitrate/bitpool increasing and SBC Dual channel implementing patchset is available by the following links:

LineageOS 14.1 (Android 7.1.2)

LineageOS 15.1 (Android 8.1)

LineageOS 16.0 (Android 9)

AOSP Master (which will eventually become Android 9.1/10)

I consider this patchset as stable, without obvious flaws or known problems. It has been tested on various devices and in different conditions. "HD Audio: SBC" tick in Bluetooth device menu is not enabled by default, to prevent possible compatibility issues.

ROM builders could be asked to include this patchset in their builds, before LineageOS/AOSP code review is done. Alternatively, ROM builders may provide flashable zip file with Bluetooth stack and Settings.apk/Bluetooth.apk/framework built with this patchset.
[Android Software/Hacking General [Developers Only]] bokchoi2020:
Just curious, given that the SBC Bluetooth stack is also artificially limited on Linux, would you be able to submit a patch set there as well? Not sure how that works.

Anyhow, thanks for all this work. I think what you are doing is worthwhile and will benefit many people.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Yes, but it requires some additional work with MTU in BlueZ.

Here's Pulseaudio discussion: https://lists.freedesktop.org/archives/pulseaudio-discuss/2018-September/030489.html
[Android Software/Hacking General [Developers Only]] n00b_dr0id:
Nice work. I have Poco F1 and a Bluedio T monitor. Hopefully will get to test it.
[Android Software/Hacking General [Developers Only]] Zurk7:
If anybody can make a flashable for mi mix 2 i will be glad! and if you need any files just ask me that files and i will upload!

thanks btw
[Android Software/Hacking General [Developers Only]] OPOt585:
Has anyone got kz bluetooth adapters? (The old version )

Is there a way to fiddle with settings for quality ?
[Android Software/Hacking General [Developers Only]] n00b_dr0id:
Adaptor or cable? I have old BT cable and no there is no settings. Old cable supported APTx and the phone will detect and transit at max settings supported by the cable/headphone.
[Android Software/Hacking General [Developers Only]] OPOt585:
I have "KZ Wireless Bluetooth Module Upgrade Detachable Wire" it's more or less $8.00

I don't think it supports aptx since the new version 2 does and it's written on it.
[Android Software/Hacking General [Developers Only]] easy_mac:
Would it be possible to modify the .so for my 6P running resurrection remix 6.2.1 (8.1.0)

I have no idea how to apply the patch before building the ROM myself :/
[Android Software/Hacking General [Developers Only]] Brutale1090!:
Hi, is it possible to include it in an unlocked and rooted Mate 10 Pro with EMUI 8.0?
[Android Software/Hacking General [Developers Only]] eyupo92:
Uploaded 3 results

Hi.

I uploaded results for

1 ) Sony WH-1000XM2 headphones ::: https://www.sony.com/electronics/headband-headphones/wh-1000xm2

2 ) Fiio BTR3 BT adapter ::: https://www.fiio.com/btr3

3 ) TROND Bluetooth V4.1 Transmitter Receiver, 2-in-1 Wireless 3.5mm Audio Adapter, AptX Low Latency, Smart Codec Indicator, 2 Devices Simultaneously, for TV, iPod, Home Sound System ::: https://www.amazon.com/gp/product/B01K8ANDCI/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

On 2 and 3, I connected 1More Quad Driver earphones to the adapters. In all these 3 cases, the sound was clear and crisp.

Hope these help.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Wow, FiiO BTR3 is the beast! It supports aptX, aptX HD, aptX LL, AAC, MP3, LDAC and one more unidentified codec.

Thanks.
[Android Software/Hacking General [Developers Only]] eyupo92:
BTR3 sounds good too; it also works as USB DAC/AMP, improving sound from smartphones and PC/laptops. It costs 70-80 USD and is worth the price.

The unidentified codec should be ( HWA = LHDC ) codec by Huawei.
[Android Software/Hacking General [Developers Only]] ValdikSS:
Now we have 14 competitive A2DP codecs.
[Android Software/Hacking General [Developers Only]] matrixisreal:
And we are still missing the most logical one.

Opus
[Android Software/Hacking General [Developers Only]] grandgreed:
Xiaomi Redmi Note 4X with Behringer MPA40BT which uses Bluetooth 3.0

Stock

Connection:

e4:46:da:c5:07:87 (Redmi) → 00:1d:df:c7:d4:90 (BEHRINGER MPA40BT)

Supported codecs:

Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..53)

Used for audio:

Audio SBC (44100 | JointStereo | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)

Latest SBC Bitpool value: 53

Patched

Connection:

e4:46:da:c5:07:87 (Redmi) → 00:1d:df:c7:d4:90 (BEHRINGER MPA40BT)

Supported codecs:

Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..53)

Used for audio:

Audio SBC (44100 | DualChannel | block: 16 | subbands: 8 | allocation: Loudness | bitpool: 2..53)

Latest SBC Bitpool value: 53

Acoustics works well. High frequencies and in general have improved. The sound quality is noticeable better.

It is also curious to learn about changes from owners of other portable acoustics.