keymapperorg / KeyMapper

An Android app that change what the buttons do on your devices!
http://docs.keymapper.club
GNU General Public License v3.0
1.02k stars 151 forks source link

Failed to find accessibilty node! #771

Closed JonnyTech closed 3 years ago

JonnyTech commented 3 years ago

Developer TODO (don't remove)

Discord message link/email recipient

Describe the bug The subject message is shown when long pressing a button, the action is not performed. Other mappings work ok.

To Reproduce My phone has a menu buton and no recents button Map menu button to recents action. Map menu button long press to menu action. Long press menu button.

Upload a backup of your keymaps. mappings.zip

Expected behavior Action (show menu) should be performed.

Screenshots keymaperror

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

GL513 commented 3 years ago

What Xiaomi model do you have?

Do you have ADB on your phone? You can enable the accessibility service using that if needed. Also, possibly grant WRITE_SECURE_SETTINGS while you're at it, since KeyMapper can most of the time re-enable itself when the system removes the service due to no feedback, and that would be either because the app isn't running at all, or because of other things, such as battery optimization, or just spastic things like Samsung killing apps all the time, even with battery optimization. That could save you from having to enable it's accessibility service from ADB in the future.

running adb shell settings put secure enabled_accessibility_services io.github.sds100.keymapper/io.github.sds100.keymapper.service.MyAccessibilityService should fix this, and for more information about this you can visit https://docs.keymapper.club/user-guide/adb-permissions/#enabling-the-accessibility-service.

I understand if this doesn't work. Sometimes, restarting the phone, or even force restarting it (press and hold pwr+vol down until the screen turns off and the phone restarts) allows things to work.

sds100 commented 3 years ago

This issue isn't related to that. The way the open menu action works on non-rooted/no shizuku device is it looks for the menu button and then taps it for you instead of inputting the key event. But not all menus work with the way that I'm trying to detect them. This error shouldn't show up for this kind of action because it is normal that the menu can't always be found. E.g if there is no menu on screen at all.


From: GL513 @.> Sent: Sunday, August 29, 2021 1:31:50 PM To: sds100/KeyMapper @.> Cc: Seth Schroeder @.>; Assign @.> Subject: Re: [sds100/KeyMapper] Failed to find accessibilty node! (#771)

Do you have ADB on your phone? You can enable the accessibility service using that if needed. Also, possibly grant WRITE_SECURE_SETTINGS while you're at it, since KeyMapper can most of the time re-enable itself when the system removes the service due to no feedback, and that would be either because the app isn't running at all, or because of other things, such as battery optimization, or just spastic things like Samsung killing apps all the time, even with battery optimization. That could save you from having to enable it's accessibility service from ADB in the future.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/sds100/KeyMapper/issues/771#issuecomment-907776201, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD36JQW6CITPZSCI6XWWOETT7ILCNANCNFSM5C7SFO7A.

sds100 commented 3 years ago

fixed

JonnyTech commented 3 years ago

Thanks guys. Is there a prebuilt apk that I can try to test the fix? My phone is rooted. All other keypresses work fine so shows that accessibilty permission is granted correctly. Older versions of keymapper (v1.x iirc) worked as expected.

sds100 commented 3 years ago

Yeah, join the Discord server at www.keymapper.club and you can download the alpha builds in the #testing-builds channel. I'm going to try to get the first 2.4.0 beta out today with this fix as well

sds100 commented 3 years ago

Since you are rooted you should turn on the root permission setting in Key Mapper's settings. This will make the menu action work 100% reliably instead of using the accessibility nodes.

JonnyTech commented 3 years ago

Thanks, as I am not a Discord user, I shall wait for the beta release.

I thought that I had enabled root access but looks like it was only temporary. Adding it back fixed the issue.

Great work, really appreciate the quick responses.

sds100 commented 3 years ago

Cool, no problem. The builds in the Discord are just forwarded from GitHub Actions. You can get the "artifacts" from the automated builds by clicking on "Actions" at the top of the repo, going to the "develop" workflow, and then clicking on the latest run.

JonnyTech commented 3 years ago

👍