Debian Codegraph @

Documents/README.Android

raw
1 ~~~~~~~~~~~~~~~~~
2 BRLTTY on Android
3 ~~~~~~~~~~~~~~~~~
4
5 .. |SDK build tools version| replace:: 29.0.3
6 .. |NDK version| replace:: r21e (21.4.7075529)
7 .. |JDK version| replace:: 1.7
8
9 .. _BRLTTY on Google Play: https://play.google.com/store/apps/details?id=org.a11y.brltty.android
10
11 .. include:: prologue.rst
12
13 Using BRLTTY
14 ============
15
16 Activation and Configuration
17 ----------------------------
18
19 Go to ``Settings`` -> ``Accessibility`` -> ``Downloaded Apps`` -> ``BRLTTY``
20 in order to start/stop ``BRLTTY``, adjust its settings, and select your braille device(s).
21
22 If you'll be connecting to your braille device via Bluetooth,
23 see `Connecting Via Bluetooth`_.
24
25 If you'll be connecting to your braille device via USB,
26 see `Connecting Via USB`_.
27
28 If your braille device has a braille keyboard,
29 see `Using a Braille Keyboard`_.
30
31 Starting and Stopping BRLTTY
32 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
34 BRLTTY isn't a regular Android application - it's an accessibility service.
35 As such, it can't be started and stopped in the usual way, i.e. from the launcher.
36 In fact, it won't even show up within the ``All Apps`` list.
37
38 BRLTTY must be started and stopped from the ``Accessibility Settings`` screen.
39 To get there, launch the ``Settings`` application, and then tap on ``Accessibility`` (near the bottom).
40 This screen contains a "Downloaded Apps" section which lists all of the
41 accessibility services that are currently installed on the device.
42 For each of them, there's an associated indicator that shows
43 either ``On`` if it's currently running or ``Off`` if it isn't.
44
45 Find ``BRLTTY`` and tap on it. This brings up a window with a few items in it.
46 One is a "switch" for turning BRLTTY on and off. Another is a button that
47 takes you to BRLTTY's ``Settings`` screen. You can go through BRLTTY's
48 settings, making changes as desired, as well as define your braille device(s),
49 either before starting BRLTTY or while it's running.
50
51 Connecting Your Braille Device
52 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
54 Connecting Via Bluetooth
55 ````````````````````````
56
57 In order to use a Bluetooth braille device, you'll need to first "pair" it with
58 your Android device. Go into ``Settings`` -> ``Bluetooth``. If your braille
59 device is already listed within the ``Paired Devices`` section of that screen
60 then it has already been paired. If you still need to pair it then tap
61 ``Search for Devices``. This will add an ``Available Devices`` section to the
62 screen. If your braille device isn't listed then you'll probably need to
63 perform a model-specific action on it in order to make it visible
64 (also known as discoverable) - see its manual for details. After doing that,
65 tap ``Search for Devices`` again. Tap on your braille device to begin the
66 Bluetooth Pairing Request, enter its PIN (see its manual for details), and tap
67 ``OK``.
68
69 There's an additional step that became mandatory in Android 12 (API level 31).
70 You need to explicitly tell Android that BRLTTY is allowed to connect to Bluetooth devices.
71 To do this, go to BRLTTY's `Actions Screen`_ and tap **Allow Bluetooth Connections**.
72 If you don't see this button then this step has already been performed.
73
74 Connecting Via USB
75 ``````````````````
76
77 In order to use a USB braille device, you'll need a special cable known as a
78 "Micro USB Host Adapter". The reason for this is that the USB port on an
79 Android device usually acts as a "device" (rather than as a "host") port. This
80 is so that, for example, you can control your Android device from your
81 computer. The Micro USB Host Adapter has a special plug, known as an OTG
82 (on-the-go) connector, that, when inserted into the Android device's USB port,
83 instructs Android to act as the USB host.
84
85 The Micro USB Host Adapter also allows you to connect any other USB
86 device (keyboard, mouse, printer, hub, etc) to your Android device. Be aware,
87 though, that if any such device, including your braille device, draws power via
88 its USB port then your Android device's battery will become the source of that
89 power. If portability isn't an issue, you may wish to consider using your Micro
90 USB Host Adapter to connect your Android device to a powered hub so that your
91 USB devices will draw power from the hub rather than from your Android device's
92 battery. You may also wish to consider disabling USB charging on any devices
93 that offer this capability.
94
95 Defining Your Braille Device
96 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97
98 You don't actually need to define your braille device, but BRLTTY will connect
99 to it much faster if you do. If you don't, BRLTTY will search through all of
100 the devices that have been connected via either Bluetooth or USB
101 (see `Connecting Your Braille Device`_) for one that it recognizes. If there's
102 more than one, it'll select the first one that it finds.
103
104 To define your braille device, go to BRLTTY's ``Settings`` screen, tap on
105 ``Manage Devices``, and then on ``Add Device``. From there, find your braille
106 device, and then tap ``Add``. To find your braille device:
107
108 1) Select its communication method (Bluetooth, USB).
109
110 2) Select your device from the list that's presented.
111
112 3) Select the correct braille driver.
113 This step is optional, i.e. you can usually leave it set to ``autodetect``.
114 Going through the effort of selecting the correct driver, however,
115 ensures a fast and reliable connection.
116
117 After you've added your braille device to BRLTTY, tap on ``Selected Device``
118 and select it from the list of devices that BRLTTY knows about.
119
120 Using a Braille Keyboard
121 ~~~~~~~~~~~~~~~~~~~~~~~~
122
123 Braille device keyboard input is supported, but, like all Android input
124 methods, it must be explicitly enabled, and then explicitly selected. Android
125 doesn't permit BRLTTY to do either of these automatically on your behalf.
126 Although it's inconvenient, Android imposes this manual process so that you're
127 very consciously aware of which input methods can process, and which input
128 method is currently processing, whatever you're typing. Such applications,
129 after all, handle extremely sensitive personal data (such as passwords, credit
130 card numbers, etc), so it's crucial that you make your own decisions regarding
131 which of them you're willing to trust.
132
133 If you type on your braille device's keyboard when BRLTTY's input method is
134 either disabled or enabled but not selected, then BRLTTY will alert you to this
135 fact via a message on your braille display. You may wish to enable BRLTTY's
136 keyboard support ahead of time, but you probably don't want to select it ahead
137 of time. The reason for this is that Android only allows exactly one input
138 method to be in use at a time. When you explicitly select BRLTTY's input
139 method, therefore, you're also implicitly deselecting the on-screen keyboard.
140
141 You can enable BRLTTY's keyboard support in one of the following ways:
142
143 * Launch Android's ``Settings`` application and tap on ``Language and Input``.
144 The ``Keyboard and Input Methods`` section of this screen shows the
145 ``Default`` (currently selected) input method, and contains a check box for
146 each installed input method. An input method is enabled if its check box is
147 checked, so, to enable BRLTTY's keyboard support, check the box labelled
148 ``BRLTTY Input Service``. Once it's been enabled, you can select it at any
149 time by adjusting the ``Default`` setting.
150
151 * If BRLTTY is running then switching between input methods is much easier.
152 Go to BRLTTY's `Actions screen`_ and tap ``Switch Input Method``. This
153 brings up Android's Input Method Picker, which presents a set of radio
154 buttons - one for each enabled input method. If there's no radio button for
155 BRLTTY's input method then it hasn't been enabled yet. To enable it, tap the
156 button labelled ``Set up input methods``. This screen contains a check box for
157 each installed input method. Check the box labelled ``BRLTTY Input Service``.
158 Then tap the ``Back`` button to return to the ``Language and Input`` screen,
159 find the ``Keyboard and Input Methods`` section, and set the ``Default``
160 input method to BRLTTY's input method.
161
162 Actions Screen
163 ~~~~~~~~~~~~~~
164
165 BRLTTY's Actions screen presents several common actions that you may wish to perform:
166
167 * Switch Input Method
168 * Allow Bluetooth Connections
169 * BRLTTY Settings
170 * View User Guide
171 * Browse Web Site
172 * Browse Community Messages
173 * Post Community Message
174 * Manage Community Membership
175 * Update Application
176 * About Application
177
178 You can get to this screen using any of the following methods:
179
180 * From your braille device via global action #5.
181 See `Global Actions`_ for details.
182
183 * From your braille device via Space + Dots12345678.
184
185 * Via ``Settings`` -> ``Accessibility`` -> ``BRLTTY`` -> ``Settings``.
186
187 * From the notifications shade.
188 Open it by dragging the status bar downward:
189
190 + With two fingers (if Explore by Touch is active).
191 + With one finger (if Explore by Touch isn't active).
192
193 Then find BRLTTY's service notification and tap it.
194
195 * Via the Accessibility button on the system navigation bar.
196 This capability was introduced in Android 8.0 (Oreo).
197 The button may not be visible for a number of reasons, for example:
198
199 + The device's system navigation bar isn't rendered via software.
200 + An application has chosen to hide the system navigation bar.
201
202 Customized Data Files
203 ~~~~~~~~~~~~~~~~~~~~~
204
205 You can customize any of BRLTTY's data files,
206 e.g. a text, contraction, or key table or subtable.
207 To do this, add a file with the same name directly into a folder named ``brltty``
208 at the top-level of your Android device's primary shared/external storage area.
209 This area might be internal (on the device itself)
210 or external (on a removable storage device, e.g. an SD card).
211 Normally, it's the area that ``/sdcard`` is symbolically linked to.
212
213 BRLTTY won't be aware of your customized data files
214 if this area has been mounted by a computer.
215
216 It's safe to include the original data file from your customized copy.
217 If you're only adding lines, therefore, then your customized copy
218 need only contain those additions and the include statement.
219
220 Navigating the Screen
221 ---------------------
222
223 Using Multiple Hosts
224 ~~~~~~~~~~~~~~~~~~~~
225
226 BRLTTY only remains connected to your braille device while your Android device
227 is unlocked or while its screen is on. If your Android device is locked and its
228 screen is off then BRLTTY automatically disconnects from your braille device.
229 This is so that you can easily share your braille device amongst multiple
230 hosts.
231
232 Pressing your Android device's power button (or similar action) to wake it up,
233 even though it may still be locked, is sufficient to cause BRLTTY to
234 automatically reconnect to your braille device. This allows you to enter your
235 password or PIN via your braille keyboard.
236
237 You can continue using your braille device even though your Android device's
238 screen may have turned off, as long as its lock timer hasn't yet expired.
239 Pressing keys on your braille device resets your Android device's lock timer in
240 the same way that pressing its keys, touching its screen, etc does. This means
241 that your Android device will stay awake and unlocked even though you're only
242 controlling it from your braille device, and that it'll also still
243 automatically lock once you're no longer using it.
244
245 Accessibility Focus
246 ~~~~~~~~~~~~~~~~~~~
247
248 The "accessibility focus" feature of Android is used for cursor tracking and
249 routing. It's a soft cursor, not visible on the screen, that can be
250 programmatically associated with any screen element. All screen readers that
251 use it to define the current element for actions (like tapping) will implicitly
252 cooperate reasonably seamlessly with one another.
253
254 The cursor is usually placed on the first character of the screen element that
255 currently has accessibility focus. The one exception to this is within an
256 input area. If that area has input focus then the cursor is placed at
257 the location within it where input will be inserted.
258
259 When a home screen folder is opened, BRLTTY automatically sets accessibility
260 focus to that folder's first entry. This eliminates the need to search for it.
261
262 The Cursor Routing Keys
263 ~~~~~~~~~~~~~~~~~~~~~~~
264
265 The cursor routing keys of your braille device perform their usual function when
266 within an input area if it has input focus - the key above a given
267 character brings the cursor to that character. In any other context, however, a
268 cursor routing key performs an action on the screen element under it. Starting
269 with the leftmost routing key over a screen element, which we'll call key #1,
270 these actions are as follows:
271
272 1) Bring accessibility focus (cursor)
273 2) tap (click)
274 3) hold (long click)
275 4) scroll backward (up or left)
276 5) scroll forward (down or right)
277 6) context click
278 7) accessibility actions
279
280 A range control (progress bar, volume slider, etc) can be adjusted up/down
281 via the scroll forward/backward actions.
282
283 Input Areas
284 ~~~~~~~~~~~
285
286 When an input area has input focus, BRLTTY's attribute underlining
287 feature is used to highlight the selected text region.
288
289 Widget Representations
290 ~~~~~~~~~~~~~~~~~~~~~~
291
292 Check Boxes
293 ```````````
294
295 A check box is rendered as a three-cell symbol:
296
297 1) dots 123478 (the left side of the box)
298 2) dots 2356 (the check mark)
299 3) dots 145678 (the right side of the box)
300
301 The check mark is present if the box is checked and absent if it isn't.
302 If the check box has a label then it appears to the right of the symbol.
303 The braille representations are:
304
305 * ⣏⠶⣹ checked
306 * ⣏ ⣹ not checked
307
308 Radio Buttons
309 `````````````
310
311 A radio button is rendered as a three-cell symbol:
312
313 1) dots 2348 (the left side of the button)
314 2) dots 2356 (the check mark)
315 3) dots 1567 (the right side of the button)
316
317 The check mark shows which of the radio buttons is currently selected.
318 The label for each radio button appears to the right of its symbol.
319 The braille representations are:
320
321 * ⢎⠶⡱ selected
322 * ⢎ ⡱ not selected
323
324 Switches
325 ````````
326
327 A (two-position) switch is rendered as a three-cell symbol:
328
329 1) dots 4568 (the left side of the switch)
330 2) dots 1478 (the top and bottom of the switch)
331 3) dots 1237 (the right side of the switch)
332
333 Dots 25 are added to the middle cell if the switch is on,
334 and dots 36 are added to the middle cell if the switch is off.
335 In other words, the switch is up when on and down when off.
336 The label for the switch's current state appears to the right of the symbol.
337 The braille representations are:
338
339 * ⢸⣛⡇ on
340 * ⢸⣭⡇ off
341
342 Range Controls
343 ``````````````
344
345 A range control is one which can be adjusted (rather than set or edited).
346 They include widgets like progress bars, volume sliders, etc.
347 They're rendered as a three-value summary::
348
349 * An at sign followed by the current setting.
350 * The minimum and maximum settings, separated by a dash, within parentheses.
351
352 The developer of an application can choose which value range a given control uses.
353 For example, a 16-position volume control currently set to 75% might look like this::
354
355 @11 (0 - 15)
356
357 It could, however, also look like this::
358
359 @75% (0% - 100%)
360
361 Disabled Controls
362 `````````````````
363
364 If a control is currently disabled then the word ``disabled``,
365 enclosed within parentheses, appears to the right of its label.
366 For example::
367
368 Connect (disabled)
369
370 When There's No Text
371 ````````````````````
372
373 A screen element that has no text of its own,
374 and that BRLTTY doesn't explicitly support,
375 is normally not rendered.
376 Examples of these include:
377
378 * A graphic (e.g. an image view).
379 * A container used to construct the screen's layout (e.g. a frame layout).
380
381 It's still necessary to render it, however, if it implements
382 an action (e.g. a tap) which the user needs to be able to perform.
383
384 If the application's developer has provided descriptive text
385 then that text is rendered.
386 If not, then BRLTTY renders a generic description within (parentheses).
387 It contains the widget's type, and, if available, its source code identifier.
388
389 Global Actions
390 ~~~~~~~~~~~~~~
391
392 Android supports a number of global actions that can be performed by pressing
393 special hardware buttons and/or by touching reserved areas on the screen.
394 BRLTTY also offers a way to perform these actions from your braille device.
395 While a better way may be developed in the future, this is how it can be done
396 right now.
397
398 * Since Android doesn't use the keyboard function keys
399 (commonly named ``F1`` through ``F12``),
400 BRLTTY uses them to perform the global actions.
401 The way a braille device emulates keyboard function keys
402 differs from model to model,
403 so you should check the BRLTTY documentation for your braille device.
404 The most common way is to press the corresponding cursor routing key
405 along with some other key or key combination.
406 For braille devices that have a braille keyboard,
407 the most common key to be used in conjunction with a cursor routing key
408 in order to emulate a keyboard function key is the space bar.
409
410 * If your braille device has a braille keyboard
411 then you can perform the global actions
412 via chords that also include dots 7 and 8.
413 For example, Space + Dots78 + Dots125 (h) goes to the home screen.
414
415 .. table:: Global Android Actions
416
417 ======= ========= ===================================== =====================
418 FN-Key Chord78+ Action As of Android Release
419 ------- --------- ------------------------------------- ---------------------
420 ``F1`` 125 (h) go to the Home screen 4.1 (Jelly Bean)
421 ``F2`` 12 (b) tap the Back button 4.1 (Jelly Bean)
422 ``F3`` 1345 (n) go to the Notifications screen 4.1 (Jelly Bean)
423 ``F4`` 1235 (r) tap the Recent Apps (Overview) button 4.1 (Jelly Bean)
424 ``F5`` 123456 go to BRLTTY's `Actions screen`_ \*
425 ``F6`` 23 move to the first item \*
426 ``F7`` 2 move to the previous item \*
427 ``F8`` 5 move to the next item \*
428 ``F9`` 56 move to the last item \*
429 ``F10`` 134 (m) tap the Menu button \*
430 ``F11`` 36 return to the active window 4.0 (Kitkat)
431 ``F12`` 3 switch to the previous window 4.0 (Kitkat)
432 ``F13`` 6 switch to the next window 4.0 (Kitkat)
433 ``F14`` 2345 (t) show the window title 6.0 (Nougat)
434 ``F15`` 24 (i) show various device status indicators \*
435 ``F16`` 234 (s) go to the Quick Settings screen 4.2 (Jelly Bean MR1)
436 ``F17`` 135 (o) go to the Device Options screen 5.0 (Lollipop)
437 ======= ========= ===================================== =====================
438
439 Text Selection and the Clipboard
440 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
441
442 As with the `global actions`_,
443 if your braille device has a braille keyboard
444 then you can perform text selection actions
445 via chords that also include dots 7 and 8.
446 For example, Space + Dots78 + Dots14 (c)
447 copies the selected text to Android's clipboard.
448 This works as of Android release 4.3 (Jelly Bean MR2).
449
450 .. table:: Text Selection and Clipboard Actions
451
452 ======== =======================================
453 Chord78+ Action
454 -------- ---------------------------------------
455 1 (a) select all of the text
456 4 clear the text selection
457 14 (c) copy the selected text to the clipboard
458 1236 (v) paste the text on the clipboard
459 1346 (x) cut the selected text to the clipboard
460 ======== =======================================
461
462 The text selection extends inclusively
463 from its first endpoint through its second one.
464 The attribute underlining feature (see the Show Attributes preference)
465 is used to show which text has currently been selected.
466 It may be helpful to set the attribute underline to blink
467 if the cursor isn't set to blink, and vice versa.
468
469 In addition to being able to select all of the text,
470 there are ways to select a specific portion of the text.
471 Exactly how this is done depends on which braille device you're using.
472 There is, however, one way to do it that works
473 on any braille device that has cursor routing keys.
474
475 The cursor routing key where the cursor is
476 normally doesn't serve any useful purpose.
477 If, however, you enable the Start Text Selection preference
478 (which can be found within the Navigation Options submenu),
479 then it enters `text selection mode`_
480 with that character being both the first and second endpoints.
481 This method has the constraint that the first endpoint of the text selection
482 must be a character that the cursor can get to.
483
484 .. _Text Selection Mode:
485
486 When in text selection mode,
487 pressing a cursor routing key changes the second endpoint of the selection.
488 This may be done any number of times.
489 The second endpoint may be either after or before the first one.
490
491 Commands
492 ````````
493
494 HOST_COPY
495 Copy the selected text to the host clipboard
496 and then deselect it.
497
498 HOST_CUT
499 Copy the selected text to the host clipboard
500 and then delete it.
501
502 HOST_PASTE
503 Insert the text on the host clipboard after the screen cursor.
504
505 TXTSEL_ALL
506 Select all of the text.
507
508 TXTSEL_CLEAR
509 Clear (deselect) the current text selection.
510
511 TXTSEL_SET
512 Select a specific portion of the text.
513 This command requires that both endpoints of the text
514 are within the current braille window.
515 The key combination needs two cursor routing (or equivalent) keys.
516 We recommend a long press of two cursor routing keys
517 (if the braille device supports it).
518
519 TXTSEL_START
520 Enter `text selection mode`_ with that character being both endpoints.
521 With this method, the first endpoint of the text selection can be anywhere,
522 i.e. it isn't constrained to be a character that the cursor can get to.
523 The key combination needs a cursor routing (or equivalent) key.
524 We recommend a long press of a cursor routing key
525 (if the braille device supports it).
526
527 Web Pages
528 ~~~~~~~~~
529
530 Element Annotations
531 ```````````````````
532
533 A number of elements within a web page are annotated
534 in order to help distinguish them from the surrounding text.
535 Each annotation is placed immediately before
536 the text of the element that it describes.
537 It consists of a three-letter tag,
538 optionally followed by descriptive data,
539 all enclosed within (parentheses).
540 Here are some examples:
541
542 .. table:: Web Page Element Annotation Examples
543
544 ================= ====================================================
545 Example Meaning
546 ----------------- ----------------------------------------------------
547 (btn) Submit a Submit button
548 (lnk https://...) the target URL of a link
549 (tbl 4x9) the start of a table with four columns and nine rows
550 (col 2@3) the second column of the third row of a table
551 ================= ====================================================
552
553 The following table lists all of the annotations:
554
555 .. table:: Web Page Element Annotations
556
557 ========== ===================================== ===========
558 Annotation Meaning Data
559 ---------- ------------------------------------- -----------
560 btn button
561 cap table caption
562 col column in table row coordinates
563 frm start of form
564 hdg heading (unspecified level)
565 hd1 level one heading
566 hd2 level two heading
567 hd3 level three heading
568 hd4 level four heading
569 hd5 level five heading
570 hd6 level six heading
571 hdr header of table column coordinates
572 lnk target of link URL
573 lsi list item coordinates
574 lsm list marker
575 lst start of list dimensions
576 pop combo box (single or Multiple choice)
577 pwd password field
578 row start of table row
579 tbl start of table dimensions
580 txt text field or area
581 \-------- horizontal divider
582 ========== ===================================== ===========
583
584 Structural Navigation
585 `````````````````````
586
587 Pressing Dots2578 enters Structural navigation mode.
588 When in this mode,
589 a web page, when being browsed with Chrome, can be structurally navigated
590 by pressing dot combinations on your braille device.
591 Press Dots78 (without Space) to return to the default key bindings.
592
593 When in this mode,
594 combinations of dots 1 through 6 specify the type of element
595 that you'd like to navigate to.
596 Adding dot 7 means move to the previous element of that type,
597 and adding dot 8 means move to the next element of that type.
598 If neither dot 7 nor dot 8 is added then the current direction is used.
599
600 The current direction defaults to (starts out as) ``next``.
601 Pressing dot 7 by itself sets it to ``previous``,
602 and pressing dot 8 by itself sets it to ``next``.
603
604 If the key table for your braille device defines
605 a key to be the Left Alt (meta) modifier
606 then you don't need to switch to/from structural navigation mode.
607 Just hold that key while pressing
608 the desired structural navigation dot combination.
609
610 The following element types are supported
611 (where possible, a hopefully easy-to-remember character has been chosen):
612
613 .. table:: Structurally Navigable Web Page Elements
614
615 ====== ==== =====================================
616 Dots Char Go to the Previous/Next
617 ------ ---- -------------------------------------
618 1 a article
619 12 b button
620 14 c control
621 145 d ARIA landmark
622 15 e editable text
623 124 f focusable item
624 1245 g graphic
625 125 h heading (any level)
626 24 i list item
627 123 l link (visited or unvisited)
628 134 m media
629 135 o list (ordered or unordered)
630 1235 r radio button
631 234 s section
632 2345 t table
633 136 u unvisited link
634 1236 v visited link
635 1346 x check box
636 1356 z combo box (single or multiple choice)
637 2 1 level one heading
638 23 2 level two heading
639 25 3 level three heading
640 256 4 level four heading
641 26 5 level five heading
642 235 6 level six heading
643 ====== ==== =====================================
644
645 When BRLTTY Crashes
646 -------------------
647
648 We hope, of course, that BRLTTY won't crash. If it does, though, we want to
649 know about it.
650
651 If BRLTTY does crash, you'll get a dialog with a message like this::
652
653 Unfortunately, BRLTTY has stopped.
654
655 This dialog will stay on the screen until you dismiss it by tapping its ``OK``
656 button. Android will then try to automatically restart BRLTTY, so don't be
657 overly concerned if this dialog comes up again. Android will eventually give up
658 if, after a few automatic restart attempts, it decides that BRLTTY simply won't
659 stay running.
660
661 If this ever happens, then, if you can, connect your device to your host via
662 USB as soon as possible in order to capture a debug log. To capture a debug
663 log, use this command::
664
665 adb logcat -v time -d >/path/to/logfile
666
667 The ``-v time`` option means to add a timestamp to each log record. The ``-d``
668 option means to dump the current Android system log. The ``adb logcat`` command
669 writes the log to its standard output, so you need to redirect its standard
670 output (with ``>``) to wherever you'd like the log to be written.
671
672 The reason for capturing the log as soon as possible after a problem is that
673 Android imposes limits on its log storage so that the log can't consume too
674 much of your device's resources. If the log becomes too large, Android
675 automatically removes older entries from it. If you wait too long, therefore,
676 the part of it that shows how BRLTTY crashed may already have been
677 automatically removed.
678
679 Known Issues
680 ------------
681
682 Serial devices aren't supported. Even though Android devices don't have serial
683 ports, serial devices still can be connected via a USB to Serial adapter. Users
684 who have older, serial-only braille devices should still be able to use them
685 with their Android devices.
686
687 Installing BRLTTY
688 =================
689
690 BRLTTY has been designed to run on at least Android 4.1 (Jelly Bean).
691 While it does run on Android 4.0 (Ice Cream Sandwich),
692 many of its highly desirable features won't work.
693
694 BRLTTY can be installed via Google Play.
695 You can either search for it by name
696 or go directly to `BRLTTY on Google Play`_.
697
698 Required Permissions
699 --------------------
700
701 BRLTTY requires access to a number of privileged
702 Android operating system capabilities.
703 The required permissions are as follows:
704
705 .. include:: android-permissions.rst
706
707 The Old Way
708 -----------
709
710 Before it was on Google Play, BRLTTY had to be installed and updated manually.
711 For now, this way still works.
712
713 These instructions are from the perspective of a Firefox user on Windows,
714 but the process should be much the same when using a different web browser and/or operating system.
715
716 On Your Computer
717 ~~~~~~~~~~~~~~~~
718
719 1) Go to `BRLTTY's web site`_.
720
721 2) Find the ``Download`` link and press Enter on it.
722
723 3) Go to the ``Android`` section, down-arrow from there to the link that says
724 ``Latest APK``, and press Enter on it.
725
726 4) You'll be prompted to open or save the file at this point. Save it.
727
728 5) Go to your ``Downloads`` folder (or wherever you save downloads), and
729 find the ``brltty-latest.apk`` file.
730
731 6) If the file has been saved on your computer as ``brltty-latest.zip``,
732 then press the ``Context`` key, arrow to and press Enter on ``Rename``,
733 and change the file extension from ``zip`` to ``apk``. Don't worry if you
734 get a warning about the possibility of rendering the file unusable. Go
735 ahead with the rename.
736
737 On Your Android Device
738 ~~~~~~~~~~~~~~~~~~~~~~
739
740 1) Go into ``Settings`` -> ``Security``, and ensure that ``Unknown Sources``
741 is enabled. This option says something like:
742
743 Allow the installation of apps from unknown sources
744
745 This is a one-time step. Once the box has been checked, it stays checked.
746
747 2) Copy the ``apk`` file to your device. There are a number of ways to do this:
748
749 * The easiest way may be to email it to yourself as a file attachment so
750 that it will go to the email on your Android device.
751
752 * Another option is to save the file in Dropbox on your computer, and
753 then wait for it to show up in Dropbox on your Android device.
754
755 * Another option is to connect your Android device to your computer via
756 a USB cable, and then to copy the file to it in the same way that
757 you'd copy a file to a thumb drive.
758
759 3) Tap the ``brltty-latest.apk`` file to start its installation, and answer any
760 prompts. If you use the Dropbox method, you might need to tap on the file
761 twice - once to download it, and a second time to install it.
762
763 4) Tap ``OK`` when installation is complete.
764
765 Building BRLTTY
766 ===============
767
768 Preparing Your Host Environment
769 -------------------------------
770
771 BRLTTY is currently being built using:
772
773 * Version |SDK build tools version| of the Android SDK build tools.
774 * Version |NDK version| of the Android NDK.
775 * Version |JDK version| of OpenJDK.
776
777 You need the Android SDK (Software Development Kit) for:
778
779 * installing an application onto your device
780 * removing an application from your device
781
782 You can get it from `The Android SDK Web Page`_.
783
784 You need the Android NDK (Native Development Kit) if you want to do your own
785 builds. You can get it from `The Android NDK Web Page`_.
786
787 The SDK initially only includes support for the current Android API
788 (Application Programming Interface) level. BRLTTY, however, needs to support
789 earlier API levels so that it can run on older releases of Android. Support for
790 any missing API levels is added whenever the SDK is updated. To do this, use
791 the following command::
792
793 android update sdk -u
794
795 The ``-u`` option, which is the short form of the ``--no-ui`` option, means to
796 bypass the graphical interface.
797
798 There may be password prompts for installing packages that are provided by
799 various vendors. Any of these can be easily skipped.
800
801 The 64-bit versions of the SDK and NDK depend on 32-bit system libraries. If
802 you're using a 64-bit version then you need to first ensure that these are
803 installed on your system. This at least includes:
804
805 * libc6 (or glibc)
806 * libz (or zlib)
807 * libstdc++6 (or libstdc++)
808 * libncurses
809
810 If you're using a modern Debian GNU/Linux system (``Wheezy`` or later), you can
811 install these packages for a foreign architecture (in this case, i386) with the
812 following commands (as root)::
813
814 dpkg --add-architecture i386
815 apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386 libc6:i386
816
817 Installing and Preparing the BRLTTY Source Tree
818 -----------------------------------------------
819
820 Choose the directory that should contain BRLTTY's source tree (which needn't
821 yet exist). Then extract the latest BRLTTY source into it with the following
822 command::
823
824 git clone https://github.com/brltty/brltty.git /path/to/brltty
825
826 The directory operand (of ``git clone``) is optional. If you don't specify it
827 then the directory named ``brltty`` within the current working directory is
828 assumed.
829
830 Next, you need to prepare the source tree. This is done as follows::
831
832 cd /path/to/brltty
833 ./autogen
834
835 At this point, the source tree is essentially just like what you'd get were you
836 to unpack an officially released BRLTTY archive. It doesn't yet know anything
837 about the specifics of your system. It also doesn't yet know anything about the
838 platform you intend to build BRLTTY for.
839
840 Adding information to BRLTTY's source tree regarding the specifics of your
841 system, as well as of your intent to build BRLTTY for Android, is done as
842 follows::
843
844 export ANDROID_NDK=/path/to/Android/NDK
845 ./cfg-android -q
846
847 The ``-q`` option, which is the short form of the ``configure`` command's
848 ``--quiet`` option, means to not display any progress information (there's
849 usually quite a lot of it) - only warnings and errors are displayed.
850
851 All of the options you give to the ``cfg-android`` command are passed directly
852 through to the ``configure`` command. So, while ``cfg-android`` supplies a
853 default set of options to ``configure``, it's easy for you to do your own
854 customization.
855
856 Building BRLTTY for Android
857 ---------------------------
858
859 In order to be able to build an Android application, a number of Android build
860 tools need to be added to your command search path. This is done via the
861 following command::
862
863 export PATH="/path/to/Android/SDK/tools:/path/to/Android/SDK/platform-tools:$PATH"
864
865 The final step is to build the BRLTTY service for Android. This is done as
866 follows::
867
868 cd /path/to/brltty/Android/Application
869 make -s
870
871 The ``-s`` option of the ``make`` command, which is short for its ``--silent``
872 option, means to not display any progress information (there's usually quite a
873 lot of it) - only warnings and errors are displayed.
874
875 The result of the build is the file ``BRLTTY_App-debug.apk``. It will be in the
876 ``bin/`` subdirectory of BRLTTY's Android Application directory::
877
878 /path/to/brltty/Android/Application/bin/BRLTTY_App-debug.apk
879
880 ``apk`` is the file extension used for an installable Android package.
881
882 Preparing Your Android Device
883 -----------------------------
884
885 You need ``USB Debugging`` to be enabled. This is done from the ``Developer
886 Options`` screen. You can get to it from the ``Settings`` screen.
887
888 Launch the ``Settings`` application, and look, near the bottom, for ``Developer
889 Options``. If you can't find it, the most likely cause is a new feature that
890 was introduced in Android 4.2 (Jelly Bean). If you need to enable it, tap on
891 ``About Phone``, which, again, can be found near the bottom of the ``Settings``
892 screen. Then, on the ``About Phone`` screen, look for the ``Build Number``
893 line. Tap on ``Build Number`` seven times and your device will officially
894 declare you to be a developer. You should then be able to find ``Developer
895 Options`` on the ``Settings`` screen.
896
897 There's a check box at the top-right of the ``Developer Options`` screen. It
898 needs to be checked so that all of the other controls on that screen will be
899 enabled. After doing that, check the ``USB Debugging`` check box (which can be
900 found within the ``Debugging`` section). This enables the ``adb`` (Android
901 Debug Bridge) tool to perform functions on your Android device.
902
903 Installing BRLTTY on Your Android Device
904 ----------------------------------------
905
906 In order to install BRLTTY onto your device, or to remove it from your device,
907 you need to be in BRLTTY's Android Application directory::
908
909 cd /path/to/brltty/Android/Application
910
911 You also need to connect your device to your host via USB.
912
913 To install BRLTTY, use this command::
914
915 make -s install
916
917 To remove BRLTTY, use this command::
918
919 make -s uninstall
920
921 The ``make install`` command will fail if BRLTTY is already installed. If
922 you're wanting to upgrade BRLTTY, however, then removing it first is probably
923 what you don't want to be doing. This is because removing BRLTTY also causes
924 its settings to be lost. What you should do instead is reinstall it. You can do
925 this with the following command::
926
927 make -s reinstall
928
929 If you've obtained your Android package file (``apk``) for BRLTTY from some
930 other source (rather than building it for yourself), then it may have a different name
931 than the make file is expecting. It's useful, therefore, to know what the
932 actual host commands are for installing and removing Android applications.
933
934 The host command for installing an Android application is::
935
936 adb install /path/to/file
937
938 The host command for reinstalling an Android application is::
939
940 adb install -r /path/to/file
941
942 The host command for removing an Android application is::
943
944 adb uninstall application.package.name
945
946 So, to remove BRLTTY, the host command is::
947
948 adb uninstall org.a11y.brltty.android
949
950 If any of these ``make`` or ``adb`` commands fails with an error like ``device
951 not found``, it's probably because your host's USB device permissions are
952 requiring root access. The solution to this problem is to restart the ``adb``
953 server such that it is running as root. With this done, you yourself will still
954 be able to use ``adb`` as a regular user.
955
956 The commands to restart the ``adb`` server such that it's running as root are
957 as follows::
958
959 su
960 cd /path/to/Android/SDK/platform-tools
961 ./adb kill-server
962 ./adb start-server
963 exit
964