summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetsProvider.cpp
diff options
context:
space:
mode:
author Sally <sallyyuen@google.com> 2023-08-21 20:42:16 +0000
committer Sally <sallyyuen@google.com> 2023-08-21 20:42:16 +0000
commit1224a2f0a0b69e6ad5e35e1e7a14b50404688677 (patch)
tree97f2c224af6689d85eecacc8338169a70e288210 /libs/androidfw/AssetsProvider.cpp
parenta07524903e0339aed42d1838aaf065a24ccd5dbe (diff)
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
Diffstat (limited to 'libs/androidfw/AssetsProvider.cpp')
0 files changed, 0 insertions, 0 deletions