Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth Keyboard no longer detectabe as trigger after a few hours, need reboot #1401

Closed
2 tasks
HenryTheX opened this issue Jan 20, 2025 · 17 comments
Closed
2 tasks
Assignees
Labels
bug Something isn't working needs triage

Comments

@HenryTheX
Copy link

Developer TODO (don't remove)

  • write tests. put issue number in comment
  • update documentation

Discord message link/email recipient
[email protected]

Describe the bug
Bluetooth keyboard stop working the app nor system no longer detect trigger (already set to any device)

To Reproduce
use bluetooth keyboard as trigger, it works well
after a few hours, it stopped working
Android 15, Bluetooth ThinkPad TrackPoint X1 Fold bluetooth keyboard, MI MIX Fold 3 HyperOS 2.0
Battery mode set to no restriction, auto start, also keep in memroy.
Restart device would fix the issue, however still very wierd, they keyboard can still type and use normally but Key Mapper app can no longer see and detect key pressed, very strange.

Upload a backup of your keymaps. Follow the guide here
mappings_20250120-193417.zip

Expected behavior
the same bluetooth keyboard should be able to be used as trigger all the time instead of just working for awhile then stopped working as trigger. The keyboard can type normally no issues at all!

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Mi MIX Fold 3
  • Android version: Android 15

Additional context
Feel free to contact me happy to run live tests

@HenryTheX HenryTheX added bug Something isn't working needs triage labels Jan 20, 2025
@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

This is a known issue with the new update to HyperOS... Can you confirm that Button Mapper also doesn't work? We are pretty confident this is xiaomi's fault but have no idea how to fix it. Please join the issue here #1380

@sds100 sds100 closed this as completed Jan 20, 2025
@HenryTheX
Copy link
Author

Hi I'm running HyperOS 2.0.5, this app works.
Bluetooth keyboard presses as well as phone buttons can be detectable perfectly no issues. I dont think it's HyperOS issue.

However the Bluetooth trigger would no longer detectable the same Bluetooth Keyboard every now and then, the keyboard still works fine. That is wiered.
Would you like to run some live test with me to find out whats going on?

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

After these few hours, can Key Mapper still detect volume buttons or anything? I've had dozens of people report issues after updating to HyperOS so I find it very suspicious. Nevertheless, if its my fault or not, I must figure it out 😅 Is this problem at all reproducible? Like is it a specific number of hours later every time?

@HenryTheX
Copy link
Author

Thanks for your reply. There is no strict time just yet.
I cannot proactively reproduce. It seems to be random, system process management related. I remember most of the time it stopped detecting bluetooth keyboard, mostly I clear background apps, but not 100% sure, because most of the time when I clear background, this issue doesnt happen.
As I've lock the Key Mapper app in system task switcher, also set battery optimisation to no restriction, as well as auto start. This is everything I can do on MIUI (HyperOS to keep an app afloat in memory). It would be good to know the real reason though.

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

We may never know the real reason, Xiaomi don't like apps being in the background and they are a moving target with each update 😅 The guys at dontkillmyapp.com don't mention hyperos yet. It really freaks me out because i'm potentially going to be review bombed over the next year because of this.

The thing i don't understand is that some users report not being able to report volume buttons at all after updating to hyperos, some people have the issue a while after rebooting, and i tested on a HyperOS 2.0.1 phone in a store and i could record triggers straight away. Some people have the issue on HyperOS Android 14, Android 15. Only common denominator is "HyperOS".

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

Next time it stops working, can you restart the accessibility service, and try to record a trigger again?

@HenryTheX
Copy link
Author

HenryTheX commented Jan 20, 2025 via email

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

This is what other people seem to be reporting... no matter what they do, HyperOS refuses to send key events to accessibility services.

I just made a new testing build that may workaround the problem but you would have to use one of the Key Mapper keyboards instead of your own :/ I made an announcement on the discord server here describing the steps https://discord.com/channels/717499872219103263/717527256091721735/1330696739002519622

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

You seem to be knowledgeable and have experience with tinkering. Can you scour the internet to try and see if anyone outside the Key Mapper community has reported this issue? Perhaps ask on some Xiaomi forums. I want to be 99.99% confident that it isn't my fault before I put a message in the app that says Xiaomi broke the app and there is nothing we can do to fix it. I'm already getting more 1 star reviews because of this.

Edit: to prove my theorem can you try remapping some buttons with Button Mapper and see if the same happens after a few hours?

@HenryTheX
Copy link
Author

HenryTheX commented Jan 20, 2025 via email

@HenryTheX
Copy link
Author

HenryTheX commented Jan 20, 2025 via email

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

This is kind of a brain dump, and multiple questions are scattered through out - please answer them all cos they are clues 😅

I have a lot of research and testing to do but i think it may be possible to detect key events at the kernel level with Shizuku #1394. This is the ultimate solution (potentially, but will be some restriction or flaw...). This is not happening any time soon and would upend all assumptions i made in the app so far.

Do you have links to any documentation on this stuff from Xiaomi?

I understand that we should help the user but a disclaimer saying we are finding a work around but ultimately the user needs to talk to Xiaomi, it might stop a few people from review bombing if they are informed. We should probably start a thread in some Xiaomi forum as well?

This is potentially very serious because accessibility services are accessibility services. I was wondering whether Xiaomi have broken phones for people with accessibility needs as well? Does Talkback work? Maybe this way Xiaomi will listen to us, because I doubt a 3rd party key mapping app is much motivation for them to fix the problem, but making their phones discriminatory might be 😂 HSBC even blocked their app if any accessibility service was enabled... they eventually backtracked. I have no Xiaomi devices, and am completely outside that universe so I don't really know how people talk about these problems with Xiaomi. Is there some issue tracker, or forum where engineers inside Xiaomi respond?

When you open the Key Mapper app after it breaks, does the home screen say it has crashed or does it still show a green check mark that it is enabled? And, does the record trigger button still count down? If yes, then this is not an app killling problem, because the accessibility service is still running but the system is not wanting to send key events.

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

Did you join the discord server? If not, can you download this APK and see if it fixes the problem. I am targeting Android 15 in version 2.8.0, maybe that does something 🤷

keymapper-2.8.0-ci.156.zip

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

Do you also see this message "Accessibility service: onUnbind" in the logs at the bottom of the Key Mapper settings?

@HenryTheX
Copy link
Author

HenryTheX commented Jan 20, 2025 via email

@HenryTheX
Copy link
Author

HenryTheX commented Jan 20, 2025 via email

@sds100
Copy link
Collaborator

sds100 commented Jan 20, 2025

They are separate because some users have the production version from Google Play and also want to test in-development features temporarily. CI means "continuous integration" - a.k.a automatic builds from GitHub Actions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants