Allow a11y services to enter text via the path IMEs use
InputMethodService is the primary and a11y is the secondary. InputMethodService is not affected by a11y status. When the session from input method is established, app can start input (pass input context to input method). When an a11y session comes back, it will be passed to the app. When InputMethodManagerService binds to/start input with InputMethodService, it does the same to a11y services which requested IME functionalities. It is possible that input method can edit text before ally sessios are established. So the EditorInfo passed to a11y could be stale. So when an a11y session is passed to client, client will send a notification (input method doesn't have this extra notification) for the current selection. I think since the time for a11y session establish shouldn't be long, and we get the current state later, it should be fine for a11y services. When input method is disconnected from app (client) (even for input method switching), we cleared a11y and sessions too. When input method request sessions, we must rerequest sessions for a11y. This is mainly because when we unbindCurrentClientLocked(SWITCH_IME), we set active to false for the current client. Suppose we don't want to change the current structure of input method, an inactive client probably should clear accessibility sessions too. When we switch to a client which already has a session with input method, there might be some a11y sessions with this client, and some a11y services might be disabled or enabled while the client was switched out. We pass unchanged a11y sessions to client, and request sessions for newly enabled a11y services. When an a11y service is disabled, it removes its session from all clients in InputMethodManagerService. Test: type word through modified "switchToInputMethod". Tested session notification through logs. Tested client switching, input method switching, a11y service enabled/disable, multiple a11y services, a11y service enabled before device reboot. Also tested work profile. Bug: 187453053 Change-Id: Ia651a811093a939d00c081be1961e24ed3ad0356
Loading
Please register or sign in to comment