Repository navigation
Let other apps provide Braille displays - #179
Merged
Merged
Conversation
Owner
|
Thanks for the binding-leak fix. The two concerns from before still stand, so this isn't mergeable yet:
It also conflicts in |
An app that the user grants fyi.quin.backtalk.permission.BRAILLE_DISPLAY, a runtime permission that can also be granted with adb shell pm grant, can give Backtalk a braille display through a service that only Backtalk can bind. Backtalk binds the service of every allowed app, which keeps it running. The app sends braille keys, which run the same commands as on any display or else type, and any display command by name, and gets the cells to show. It drives the same braille controller as a display connected through BRLTTY, through a small DisplayerInterface that Displayer now implements, so displays with keys only and displays with cells both work, one at a time. This is for hardware that Backtalk can't reach itself, such as the built-in keys and cells of a braille notetaker. docs/braille-display-api.md describes the API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While a display app is updated, Android can deliver onBindingDied more than once, including late calls for a binding that has already been replaced. Each one removed the current binding from the map without unbinding it and bound another, so one update could leave several bindings, each connecting as a host. A replaced binding now only unbinds itself when such a late call comes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y to BRLTTY A display from an app can read everything Backtalk shows and control the device, so a runtime permission, granted with one tap in a system dialog, was too easy to get. The permission is now a normal one that only lets an app ask, and Backtalk uses an app only once the user allows it in Backtalk, after a warning that says the app will be able to read the screen and control the device. Backtalk asks with a notification when it finds such an app, an app can open the warning itself, and Displays from other apps in braille display settings lists them, to allow or stop allowing each one. A notification says which app is in use while one is. A display from an app no longer starts or stops the braille controller while a display connected through BRLTTY is in use. BRLTTY's displays drive the controller through ExternalBrailleDisplays, so that they come first: while one is connected, displays from apps wait, one that is in use steps aside when it connects and comes back when it disconnects, and BRLTTY stopping a connection that never started a display no longer stops one from an app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
emassey0135
force-pushed
the
braille-display-api
branch
from
October 15, 2026 08:19
5f468b0 to
37c7483
Compare
Author
|
I fixed both issues. Now external Braille display apps are approved the same way as apps that speak through Backtalk, and the message in Backtalk's prompt is clear that this lets another app control your device. Also, connecting a display through BRLTTY now works and stays connected in preference to an app using this interface, and an app disconnecting should not disconnect a BRLTTY display. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets an app that the user allows give Backtalk a Braille display that Backtalk can't connect to on its own, such as the built-in keys and cells of a Braille notetaker, or a display behind its maker's own software. Backtalk uses it like a display connected through BRLTTY: its keys navigate and type with the same commands, and its cells show what Backtalk shows. A display with keys and no cells works too. docs/braille-display-api.md describes the API for app developers.
How it works
fyi.quin.backtalk.action.BRAILLE_DISPLAY, protected byfyi.quin.backtalk.permission.BIND_BRAILLE_DISPLAY, a signature permission that only Backtalk holds, so only Backtalk can bind it.BRAILLE_DISPLAYS_CHANGEDto have it look again.start(name, cellCount), then sendsbrailleKeys(dots, space), which run the command bound to them, as on any display, or else type, andcommand(name, argument)for its other keys, with any Braille display command named as inBrailleInputEvent, such asNAV_ITEM_NEXTorROUTEwith a cell. Backtalk sends the cells to show withshowCells. All calls are one-way.BdControlleras a BRLTTY display. Outside the newplatform/externalpackage, the changes are a smallDisplayerInterface, with the three methods thatBdControlleruses, whichDisplayernow implements, andBrailleDisplaygivingBrailleDisplayManagera pass-through controller fromExternalBrailleDisplays. Through it, the two kinds of display take turns, so a display from an app never starts or stops the controller during a BRLTTY session, and BRLTTY stopping a connection that never started a display doesn't stop one from an app. With no display from an app in use, it passes everything through unchanged.Approval
fyi.quin.backtalk.permission.BRAILLE_DISPLAYis a normal permission that only lets an app ask to be a display. Its description says that an app that's allowed can read the screen and control the device.fyi.quin.backtalk.action.ASK_BRAILLE_DISPLAY.Cost when no display app is installed
One search for display apps when Backtalk starts and when the user is unlocked, a permission check when an app changes, and a null check on each accessibility event. A BRLTTY display's calls to the controller go through one more method call. Nothing polls and nothing is bound.
Testing
Tested on an Orbit Speak (Android 11) with a display app for its built-in Braille keys, which has no cells: navigation, typing in contracted and uncontracted Braille, every chord, and the display reconnecting after Orbit's screen reader restarts and after a reboot. Phone and watch builds, unit tests and lint pass.
The approval was tested on an Orbit Speak and an Orbit Player: the notification, the warning, the notice while the display is in use, and allowing and stopping allowing it in settings. BRLTTY taking turns was tested on an Orbit Player whose own keys were the display from an app, with an Orbit Speak in its remote mode connected through BRLTTY over Bluetooth as an Orbit Reader 20: the Player's keys stopped while the Speak was connected, and came back when it disconnected.
Cell output hasn't been tested on hardware yet. I plan to test it with the Orbit Strata when that is released and I purchase one, and I might end up implementing this for the BrailleSense 7 when I get that to allow Backtalk to run on it.