Skip to content

Prompt user to enable keyboard accessibility service on app start#556

Open
IliyaBrook wants to merge 2 commits into
ClassicOldSong:moonlight-noirfrom
IliyaBrook:brook/physical-keyb-interception
Open

Prompt user to enable keyboard accessibility service on app start#556
IliyaBrook wants to merge 2 commits into
ClassicOldSong:moonlight-noirfrom
IliyaBrook:brook/physical-keyb-interception

Conversation

@IliyaBrook

Copy link
Copy Markdown

Problem

Android intercepts system shortcuts (Alt+Tab, Alt+Esc, Win key, Ctrl+Esc, etc.) at the SystemUI level, so they never reach the host PC during streaming. The repo already ships a KeyboardAccessibilityService that forwards these events when enabled, but nothing in the app tells the user the service exists or how to turn it on. New users with a physical keyboard simply experience broken shortcuts and don't know why. See for example #225 and similar reports across multiple devices — the underlying fix is already in the codebase, it just isn't discoverable.

Changes

  • On PcView.onResume(), if a physical keyboard is connected and the service is disabled, show a one-time dialog with three actions: Accessibility settings / App info / Don't show again. Opt-out is persisted in a new pref checkbox_suppress_keyboard_a11y_prompt.
  • Add two entries under Settings → Input Settings: a shortcut to open Accessibility settings, and the opt-out checkbox.
  • Minimise KeyboardAccessibilityService config: feedbackType FEEDBACK_SPOKENFEEDBACK_GENERIC (so it no longer appears as a screen reader in the OS list), eventTypes TYPES_ALL_MASKTYPE_WINDOW_STATE_CHANGED. No behavioural change — FLAG_REQUEST_FILTER_KEY_EVENTS is unaffected.
  • Translate the new strings into all 28 locales.
  • Add a Troubleshooting section to the README covering three escalation levels (in-app dialog → Allow restricted settings → ADB fallback).

Testing

Tested on Lenovo TB320FC (Lenovo Tab Plus, Android 15, ZUI).

Two notes worth flagging from real-world testing:

  1. The prompt is the actual user-facing fix. Without it the existing accessibility service is effectively undiscoverable for end users — that's the situation [Issue]: Honor MagicPad 2 keyboard not forwarding keyboard shortcuts #225 and similar issues describe.
  2. On this specific tablet, just toggling the service in Accessibility settings does not work. The toggle silently reverts because Android 13+ blocks it via "Restricted settings" for sideloaded apps, and Lenovo ZUI hides the "Allow restricted settings" menu entry entirely, so users have no way to unblock it from the UI. The only way I could actually enable the service on this device was via ADB:

@mateus2k2

Copy link
Copy Markdown

This is probably not the right place to report this, maybe it's even worth to open a new issue.

I use moonlight the most of the tv (Chromecast) both for playing game with a controller and with a mouse and keyboard, so it's very useful to have the accessibility option turn on to be able to use the windows key, alt tab, etc.

The problem is that every time I want to use my controller with moonlight there is a prompt to me to allow it or not in the app, and when the accessibility option is on the arrows and back button don't work on the remote, so I can't tap accept on the prompt, I assume moonlight captures all of those inputs so it doesn't work. The only way I made it work was to use a remote app on my phone that uses adb to click accept.

Don't know if there is a possible fix for this. Maybe detect when there is a system pop up and don't capture remote actions?

The popup is similar to this.

https://preview.redd.it/how-to-disable-pop-up-notification-on-android-bravia-tv-v0-g2w7o70vtjof1.jpeg?width=640&crop=smart&auto=webp&s=5d838ac86dee1c4045e222ee885c4fe56c2dea35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants