Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 1224a2f0 authored by Sally's avatar Sally
Browse files

Call assumeLayout for accessibility

When some accessbility actions are performed, if the text is not
of type SPANNABLE, TextView will set the type to SPANNABLE.
This may null the layout. In this case, when TextView performs
the accessibility action
MOVEMENT_BY_GRANULARITY the following sequence happens:
1) TextView is requested to perform the MOVEMENT_BY_GRANULARITY action
by TalkBack
2) TextView ensures that its text is iterable to accessibility
3) The text is not spannable. TextView sets the text to spannable,
which nulls the layout.
4) TextView checks that it can perform the action. Since it has a
null layout, it can't perform the action
5) TextView returns false to performing of the action

Moving by granularity always fails, at least on the first attempt, for
these texts. To solve this, we call assumeLayout to set the layout of the
TextView in between 3 and 4.

assumeLayout javadocs say "Make a new Layout based on the
already-measured size of the view, on the assumption that it was
measured correctly at some point." We assume the current measurements
are appropriate. If there are edge cases we can handle them as they
appear.

Bug: 257396548
Test: manual, add test in TextViewTest
Change-Id: I9c6f1f7b4b61e05892d04dfd59062d1fdcc1c390
parent a0752490
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment