mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-24 23:55:52 +03:00
[GH-ISSUE #112] [Android] XPosed module causes bluetooth to crash, and a few bugs in the UI #41
Labels
No labels
android
bug
documentation
enhancement
good first issue
help wanted
linux
pull-request
reverse-engineering
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librepods#41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fsoceityC on GitHub (Apr 28, 2025).
Original GitHub issue: https://github.com/kavishdevar/librepods/issues/112
Originally assigned to: @kavishdevar on GitHub.
Thank you very much for developing this software.
However, I encountered some issues while using it. Specifically, after connecting my AirPods Pro 2, the app freezes and shows a white screen. I've recorded a screen capture for you to check.
https://drive.google.com/file/d/1-18340XgRy8e5Qk22XaWIyGmrHf-Nzjy/view?usp=sharing
I'm using the latest version of KernelSU for root management and have already flashed the Bluetooth module.
My system is ColorOS 15, based on Android 15.
@fsoceityC commented on GitHub (Apr 28, 2025):
Additionally, I have already granted all the necessary permissions, including root access.
@kavishdevar commented on GitHub (Apr 28, 2025):
Hey!
Could you please share the logs? Use logcat to get all logs.
Force kill the app, disconnect airpods, open app, start logs, and the connect your airpods. Wait for a few seconds and then stop the logs.
Use
logcat >> /sdcard/aln.txtto save logs to a file@fsoceityC commented on GitHub (Apr 28, 2025):
I tried to reproduce the issue and captured the logs. Please check if they are helpful.
https://drive.google.com/file/d/1glQ8cfpI-mJaabLQ3gWgjek0AcRmLgj7/view?usp=sharing
Also, since I don't have any Apple devices, the firmware of my AirPods Pro 2 has never been updated.
@kavishdevar commented on GitHub (Apr 28, 2025):
Ah, seems like the module isn't actually taking any effect. Please try this LSPosed version. Uninstall the module, and the existing app, and then install this. you will need to give the app root permissions first, and then enable the recommended scopes in the LSPosed app. You might need to reboot after installing and going through the onboarding process.
aln-xposed.zip
Also, please share files by uploading it here - and not google drive. thanks!
@fsoceityC commented on GitHub (Apr 28, 2025):
Thank you for your reply. However, the LSP module still cannot function properly.
Here are the steps I followed: I extracted the installation package you sent, installed the APK, authorized it in LSPosed, granted it root access, rebooted the phone, opened the app, granted all the requested permissions, and then tried connecting my AirPods Pro 2.
However, after installing the module, my AirPods Pro 2 could no longer connect properly to the phone. In the system’s Bluetooth settings, it kept showing "Connecting."
When I tried to connect the earbuds, the app did trigger a pop-up, but the battery level still showed as 0%. I recorded a video and captured logs for your reference.
the logs:
aln logs on color os.txt
the captures:
https://github.com/user-attachments/assets/e5b8dc93-6b5c-4bfb-861c-aaba0d3e87c4
Additionally, before trying the LSP module, I had already tested the Magisk module on another phone, but it still didn’t work properly.
The steps I followed were: flashing the Bluetooth module, installing the APK, rebooting the phone, granting the necessary permissions to the APK, opening the app, and then turning on the AirPods Pro 2.
Although this phone didn't experience the white screen issue, it still constantly showed that the earbuds were not connected. A pop-up would appear, but the battery level was displayed as 0%. I recorded a video for your reference.
Similarly, I captured logs using ADB for your reference. Since I don't have any Android development experience, I followed instructions from GPT to learn how to capture the logs, so the log files might be quite large — I apologize for any inconvenience.
This phone is running hyperos 1.0, which is based on Android 13.
Additionally, I have confirmed that my AirPods Pro 2 are genuine.
the logs:
aln on hyper os.txt
the capture:
https://github.com/user-attachments/assets/a315c272-ffc0-46bf-aa11-62b3f6eae906
@kavishdevar commented on GitHub (Apr 28, 2025):
the logs are perfect. here's what you could try for the lsposed version:
run
su -c setprop persist.aln.cfg_req_offset ''. and reboot your phone.And for the hyperos, try this apk.
aln-xposed.zip
p.s. the app is called LibrePods now.
@fsoceityC commented on GitHub (Apr 28, 2025):
I tried running this command with root privileges and confirmed that the value is now empty. However, after rebooting, the issue still persists, with the exact same behavior as before (on Android 15).
new log:
aln logs su.txt
@fsoceityC commented on GitHub (Apr 28, 2025):
Additionally, I just tried updating the app (LibrePods) and confirmed that the value(persist.aln.cfg_req_offset) is still empty. However, it still doesn't work properly. I still can't connect to my earbuds — when trying to connect, the system’s Bluetooth service automatically restarts. The app does show a pop-up(sometime not show), but the battery level is not displayed. Overall, the symptoms are exactly the same as before.
P.S. The new app icon looks great!
LibrePods.txt
@fsoceityC commented on GitHub (May 3, 2025):
I did some more testing over the past couple of days and finally discovered the reason why the app isn't working — it seems to conflict with two specific modules:
Zygisk Next: https://github.com/Dr-TSNG/ZygiskNext
Shamiko: https://github.com/LSPosed/LSPosed.github.io/releases (a root-hiding module developed by the LSPosed team)
If Shamiko is enabled, AirPodsLikeNormal cannot function properly under any circumstances.
If Zygisk Next is enabled with the “Enforce DenyList” option checked, AirPodsLikeNormal also cannot work properly no matter what I try.
Only when Zygisk Next is enabled without the “Enforce DenyList” option checked, and the device is rebooted, can AirPodsLikeNormal function correctly.
However, disabling “Enforce DenyList” causes root to be detected by many apps, which leads to various security-sensitive apps (such as banking apps) no longer working properly.
I understand this may not be an issue directly caused by AirPodsLikeNormal itself, but I still wanted to ask: is there any possible workaround? Is there any way for AirPodsLikeNormal to work alongside these two modules?
Thank you very much for your help.
P.S. I tested both the latest release version (Magisk module) and the Xposed module you shared with me in this issue, and both have compatibility issues with the above-mentioned modules.
@kavishdevar commented on GitHub (May 3, 2025):
That's very weird. Honestly, I have never needed Shamiko for anything, so I had not tested it. But, I do have ZygiskNext installed; with the enforce denylist enabled and it did work.
And from the logs - the Bluetooth process kept on crashing with
BUS_ADRALN. So, I'm curious how ZN and Shamiko could possibly mess in a way that it crashes this way. In hindsight, it might be possible that the function(s) hooking might have different signatures; but it seems unlikely that OnePlus/Oppo would modify the stack to this extent.If you are able to, then could you please test out the latest nightly release with the root module with denylist enforced in ZN, but shamiko disabled? Thanks!
@fsoceityC commented on GitHub (May 3, 2025):
I tested the latest nightly version, and the issue still persists. When I enable Zygisk Next with the “Enforce DenyList” option checked (and Shamiko disabled), AirPodsLikeNormal still freezes with a white screen after launching.
However, when I disable the “Enforce DenyList” option and reboot the phone, AirPodsLikeNormal works successfully.
I recorded a video and captured logs—hopefully they’ll be helpful.
It seems that the nightly version didn’t include an updated module, so I only updated the app itself.
logs:
alnnightly1.txt
alnnightly2.txt
https://github.com/user-attachments/assets/5a86b599-8461-4e4e-af0f-6d316a0ccfd0
@kavishdevar commented on GitHub (May 3, 2025):
what's the second log? seems neither the module nor the xposed module were active.
Yeah, just the nightly app, with the root module from v0.0.3 (not xposed)
@fsoceityC commented on GitHub (May 4, 2025):
Both of these logs were captured while using the nightly version, during which the app failed to work properly—I recorded the issue twice.
I’ve confirmed that the Magisk module was activated. If the logs show it as not activated, I suspect it might be due to a conflict with the Zygisk Next module.
In this situation, as long as I disable the “Enforce DenyList” option in Zygisk Next and reboot the phone, AirPodsLikeNormal starts working normally.
@fsoceityC commented on GitHub (May 7, 2025):
The latest release still has this issue. Even after I disabled all other modules except for LSPosed and the Zygisk Next module (with “Respect denylist” unchecked), it still doesn't work.
All the tests mentioned below were performed with all unrelated Xposed modules disabled, root access granted to LibrePods, and only LSPosed and the Zygisk Next module enabled (again, with “Respect denylist” unchecked).
After enabling the module, my AirPods can no longer connect to my phone. Every time I try to connect them via Bluetooth, the Bluetooth service automatically restarts. Also, LibrePods shows a popup, but it doesn't display any battery level.
Here’s the log:
aln5-7.txt
Is there any chance this issue could be fixed? How can I help? I’m happy to assist with testing or provide logs.
@kavishdevar commented on GitHub (May 7, 2025):
I haven't really changed anything in the release. It's basically the same hook as I shared here before. And, as expected the problem remains the same - a SIGBUS (SIG_ADRALN). I would've loved to help with this. But I am just not sure why this is happening.
Also, does the app now not work even with ZN's Enforce denylist disabled and the Shamiko module disabled? Because I really haven't changed the xposed part of the code.
@fsoceityC commented on GitHub (May 7, 2025):
Yes, it’s really strange. I just tested the Xposed version you previously shared in this issue, and it no longer works either. My phone recently received a system update, and I’m not sure if that’s what caused it.
I really want to do something for help, but I don’t know much about Android development. If there’s anything I can do, please let me know.
@krugdenis commented on GitHub (May 7, 2025):
Hi, I'm having the same issues with the blank screen on the following device: M2012K11AG (Poco F3), Android 13 TKQ1.220829.002 (MIUI by xiaomi.eu 14.0.8.0.TKHCNXM), Magisk 28.1 + Zygisk - LSPosed v1.10.1 (7115) + ReZygisk v1.0.0 RC1.
Zygisk + Enforce DenyList are activated.
Airpods 4 ANC
When I toggle off the Endorce DenyList option in Magisk, aln/librepods opens and can detect my airpods, but nothing works inside the app
Is there anything I can do to help troubleshoot this problem?
@kavishdevar commented on GitHub (May 8, 2025):
Could you share logs? Just with
logcat >> /sdcard/l2c.txt.@kavishdevar commented on GitHub (May 8, 2025):
Possibly because of the update.
I would love to help too, but there isn't much I can do with heavily modified skins like hyperos... :(
But, given that it worked at least once, it probably means that a system update probably messed up something. You could try patching it yourself and disabling the xposed module because that is probably what is causing the problem (data type error) and see how that goes. (You could share the lib and I'll give you the root module.)
@kavishdevar commented on GitHub (May 8, 2025):
I had this issue on my CMF Phone too. I fixed it for me bysetprop persist.librepods.peer_info_req_offset "". I am not quite sure why this could be causing a problem, but do give it a try, @fsoceityC!Nevermind, I changed something else too that fixed, removing this prop is not going to fix it. Please try the latest release and let me know if it works. Thanks!
@fsoceityC commented on GitHub (May 9, 2025):
Thank you so much for your help—the latest version is amazing! It is working properly now.
I did notice a few bugs:
1.If I open the app first and then connect the earbuds, the AirPods popup still appears without showing any battery level. Also, the app still shows that the earbuds are not connected. I have to close and reopen the app for it to detect them properly. (So the earbuds need to be connected before launching the app.)
2.The in-ear detection feature only works while the app is in the foreground. If I switch it to the background for more than five seconds (without killing the process), removing the earbuds no longer pauses the music.
3.It seems that “Conversational Awareness” and the “Pause music while talking” feature aren’t working as expected.
4.I tried flashing the without patch version of the module, hoping it would enable battery display—but it still didn’t work. Then I uninstalled it and tried to flash the with patch version instead, but the installation failed. Maybe I misunderstood how to use it?
5.The Noise Control off option disappeared after a while.Now I only see three modes available. I remember there used to be four. I'm not sure if this is a bug.
Since the main issue is resolved now, should I open a new issue for these bugs?
Also, could you tell me how the main issue was fixed? I’d love to learn more about Android development.
Finally, thank you so much!
@kavishdevar commented on GitHub (May 9, 2025):
Great to see that!
Got it. I usually never keep my app open unless I need to poke around settings, so I completely missed this – will fix it in the next release. And, same for the popup. I made sure that it didn't show old saved battery information when the popup is shown. And only show it if the new battery info is available/sent by the AirPods.
They do not need to be, just the app (UI) doesn't need to be open. The service will detect it anyway.
Might be your OS. Try to disable battery optimizations.
What's exactly do you mean by "Conversational Awareness doesn't work"? Maybe try toggling that setting from the AirPods settings.
What do you mean by "battery display"? In the popup? Also, sicne the xposed version works, please do not use the
with-patchvariant. :)Not a bug! Just enable the
Off listening modesettings in the AirPods settings screen and it will show up in the main settings, and "Press and Hold" as well.Nah, It's alright. I think this would be a great opportunity to use the
Sub-issuesfeatures :DBasically I had added a few lines that uses the parameter passed to the
l2c_fcr_chk_chanfunction. It used to work for me, but it probably doesn't work because google might've changed something, or I accidentally messed up :|The culprit:
github.com/kavishdevar/librepods@58dfed97b3 (diff-2a24647fa5)Thank you for helping out with the logs!
@kavishdevar commented on GitHub (May 9, 2025):
@krugdenis try the latest release and let me know if it works.
@krugdenis commented on GitHub (May 9, 2025):
Tried it, the app no longer freezes, but airpods connected to bluetooth only after a few attempts.
Battery level and other options are inactive.
How can I filter the logcat output to provide you only what's needed to debug this?
Maybe it's because app supports only AirPods Pro (2nd Gen)
@kavishdevar commented on GitHub (May 9, 2025):
@krugdenis did you try rebooting after installing and going through the setup process? Also, try resetting hook offsets from the app settings.
Just do
logcat >> /sdcard/librepods.txt. Disconnect, force stop, start logs, open the app, and connect your airpods.No, it is not because of that. :]
Also, please create a new issue. Because this seems to be fixed for the OP.
@fsoceityC commented on GitHub (May 9, 2025):
Does this mean the app can auto-start? Even though I’ve granted it auto-start permission, I still have to manually open the app once after each reboot to make it work properly.
(It would be great if features like auto-start, background keep-alive, and hiding from the recent apps view could be added.)
This was indeed the issue, thanks for pointing it out.
The "Conversational Awareness" option is described in the app as reducing media volume and background noise when speaking.The "Pause Music" option is described as pausing music when speaking.However, with both options enabled, speaking does not trigger any of these effects.Sorry, it seems that only the "Pause Music While Talking" feature is not working. "Conversational Awareness" does work when using the Adaptive mode.According to the description on the release page, the purpose of the Magisk module is to send battery information to the system so that the battery status can be viewed in the system UI (this is the battery display I’m referring to). If the "without patch" version doesn’t work, I thought the "with patch" variant might be needed. Maybe I misunderstood how it’s supposed to work.
@fsoceityC commented on GitHub (May 9, 2025):
found a few more bugs:
Removing both earbuds disconnects the Bluetooth connection, and normally they should reconnect automatically when put back on. However, sometimes they fail to reconnect unless I manually turn Bluetooth off and on again. Could you add a toggle to disable the automatic disconnection when both earbuds are removed, and only keep the single-ear pause music behavior?
The UI in the control center seems to have incorrect proportions — I suspect this is a bug. Also, the top and bottom popups are quite unstable: sometimes they show up, sometimes they don’t, and their proportions look off as well. Could you provide a toggle to disable these popups?
EDIT: Removed redundant photo (It took too long to scroll :/ )
@kavishdevar commented on GitHub (May 9, 2025):
You can remove the app from recents. And there is a on boot listener, you can check the permissions. It should show run on boot.
Yeah, the Bluetooth stack gets pretty confused if device with A2DP profile available is connected, but it is not actually connected to audio. I'll add that option.
Weird. I'll do some testing. Thanks for pointing it out!
By "if the without patch doesn't work" I meant, if the XPosed backed hooking didn't work. After installing the module without patch, can you reboot and see if you are able to uninstall the app? System apps should not be uninstallable.
I suspect the status/packet AirPods send when transparency is enabled might be different that if adaptive. You might be able to see that status difference in the debug screen.
For reference, here's how the control center thingy looks on my device-
@fsoceityC commented on GitHub (May 9, 2025):
I can't close it — once I do, all features stop working. For example, in-ear detection stops functioning, and the battery display in the notification bar disappears as well.
(I also encountered a bug causing extremely high resource usage. I’ll open a separate issue for that.)
Yes, I checked — it cannot be uninstalled and has become a system app. However, the battery display still doesn’t show up in the system’s Bluetooth interface.
That looks much better!
@kavishdevar commented on GitHub (May 9, 2025):
Probably another hyperos thing. check dontkillmyapp.com. I am also quite new to Android development. I am not sure if there something specific that needs to be done app-side to prevent this. It works just fine on stock Android.
Could run
dumpsys package me.kavishdevar.librepods | grep BLUETOOTH_PRIVand tell me if it shows granted?@kavishdevar commented on GitHub (May 9, 2025):
Also, interestingly the volume doesn't change on NothingOS (I was previously using a custom ROM) when I start speaking. It might be the same problem as yours. I'll see what's wrong and fix in next release.
@krugdenis commented on GitHub (May 9, 2025):
Tried all the above and got a blank white screen issue again after reboot 😞
@krugdenis commented on GitHub (May 9, 2025):
I asked because when I run logcat using su it provides a log for the last 24h, too much noise and unneeded data in it. I can filter out only what's needed if you tell what's necessary in the output for the debug
@kavishdevar commented on GitHub (May 9, 2025):
I'll need all logs in the app's lifecycle. Any bluetooth fatal errors, xposed errors, and obviously the app logs. You can run
logcat -cto clear old logs and then run that command if you want a cleaner file.@kavishdevar commented on GitHub (May 10, 2025):
@fsoceityC fixed many issues. Download the build here.
check v.0.1.0-rc.2...main
@fsoceityC commented on GitHub (May 10, 2025):
Thank you for the update—really appreciate it!
This version of the app now successfully supports auto-start, and I no longer need to manually open it after rebooting the phone.
I'd like to report a few issues:
I think the in-ear detection logic is a bit off. If I had manually paused the music before wearing the earbuds (or after a phone reboot), putting them on still triggers automatic playback of the last track. Could it be adjusted so that only media paused by the in-ear detection feature gets automatically resumed?(Perhaps use a variable to track whether media was paused by the in-ear detection logic.)
Correction: this issue seems to occur specifically when reconnecting the AirPods from a previously disconnected state, or after removing both earbuds and putting them back on. It doesn't happen when only one earbud is removed.
For example: if music was manually paused → AirPods are connected → playback resumes automatically.
The control center UI still has proportion issues. This might be related to screen resolution and aspect ratio. My device has a 3168×1440 (2K) resolution.
Edit by owner: removed screenshot. It's the same.
My current OS is ColorOS, which is a variant of OxygenOS—not HyperOS.
Would it be possible to add an option to hide the app from the recent tasks view? That might help resolve this issue.
The "Pause Music" feature is now working (awesome!), but there’s still a bug. In Noise Cancellation mode, speaking pauses the music and stopping speech resumes it—this works as expected. However, in Transparency and Adaptive modes, speaking pauses the music, but stopping speech does not resume playback. (At this point, even pressing the earbud once does not resume music playback.)
In these cases, switching to any other mode manually triggers music to resume.
Have you considered adding a logging system? That way I could submit logs of the app’s state when a bug occurs (e.g., during abnormal high CPU usage).
@kavishdevar commented on GitHub (May 11, 2025):
I do keep track of the media. Just a small bug when none are worn originally. :) I have fixed that with
github.com/kavishdevar/librepods@db4ac84f30.I haven't worked on it yet. Please disable it from settings until then. I might not even fully fix it because it's not really something that even I don't use.
Removing from recents would not prevent colors/oos from killing the background service.
Weird, I'll reproduce and fix.
Not planning to add any major features as of now like this. But, I'll see how I difficult/easy it may be.
Try the latest build with a fix for the ear detection (after no pods are worn) here.
@kavishdevar commented on GitHub (Oct 15, 2025):
Someone in the issuetracker said that Oppo (so, I believe OxygenOS too) has fixed this issue in their skins. Is that correct?
@kavishdevar commented on GitHub (Oct 15, 2025):
Also, I will be working on the control center now, so that I can customize the amplification for hearing aid because, I believe not having the Tile do it's job without opening a dialog serves some real purpose.
@fsoceityC commented on GitHub (Oct 16, 2025):
Thank you very much for updating the project.
In fact, Oppo released a new system based on Android 16 yesterday, which already natively supports AirPods and Apple Watch(You can adjust various settings that were originally only adjustable on Apple devices, just like this project).
I think Oppo's developers have definitely been inspired by your project.Thank you very much.
@kavishdevar commented on GitHub (Oct 16, 2025):
That's nice! I was looking for any signs of the AirPods integration, but can't find any. There's only one image showing the AirPods 4 settings.
If you install ColorOS 16, could you please let me know if my app is able to connect without root? I believe it will not be able to given that the OS itself connects, and AirPods can't take two connections.
@fsoceityC commented on GitHub (Oct 16, 2025):
I just tested it. If the device isn’t rooted, it won’t be able to connect to the earphones.
When injected through the xposed framework, this app will conflict with the system. If I install your app, the airpods can be connected to it and controlled normally, but the AirPods control of the system will fail.
When not using Xposed framework injection, the built-in system controls can be used, including spatial audio (fixed), noise-cancellation mode switching, in-ear detection, and speech detection.