Status Update
Comments
ti...@google.com <ti...@google.com>
se...@candybytes.com <se...@candybytes.com> #2
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
ku...@gmail.com <ku...@gmail.com> #3
Exception java.lang.IndexOutOfBoundsException: offset(7) should be less than line limit(6)
at android.text.TextLine.measure (TextLine.java:353)
at android.text.Layout.getHorizontal (Layout.java:1213)
at android.text.Layout.getHorizontal (Layout.java:1190)
at android.text.Layout.getPrimaryHorizontal (Layout.java:1160)
at android.text.Layout.getPrimaryHorizontal (Layout.java:1149)
at ckl.d (ckl.java:1)
at ckl.a (ckl.java:38)
at clb.e (clb.java:1)
at cja.r (cja.java:7)
at cka.l (cka.java:5)
at cdl.addExtraDataToAccessibilityNodeInfo (cdl.java:15)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos (AccessibilityInteractionController.java:1104)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java:342)
at android.view.AccessibilityInteractionController.access$400 (AccessibilityInteractionController.java:75)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage (AccessibilityInteractionController.java:1460)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:223)
at android.app.ActivityThread.main (ActivityThread.java:7664)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)
26...@gmail.com <26...@gmail.com> #4
Exception java.lang.IndexOutOfBoundsException: offset(261) should be less than line limit(260)
at android.text.TextLine.measure (TextLine.java:389)
at android.text.Layout.getHorizontal (Layout.java:1246)
at android.text.Layout.getHorizontal (Layout.java:1222)
at android.text.Layout.getPrimaryHorizontal (Layout.java:1192)
at android.text.Layout.getPrimaryHorizontal (Layout.java:1181)
at androidx.compose.ui.text.android.LayoutHelper.getDownstreamHorizontal (LayoutHelper.kt:353)
at androidx.compose.ui.text.android.TextLayout.getLayoutHelper (TextLayout.kt:332)
at androidx.compose.ui.text.MultiParagraph.requireIndexInRange (MultiParagraph.java:750)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.addExtraDataToAccessibilityNodeInfo (AndroidComposeViewAccessibilityDelegateCompat.android.kt)
at android.view.AccessibilityInteractionController.populateAccessibilityNodeInfoForView (AccessibilityInteractionController.java:430)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java:363)
at android.view.AccessibilityInteractionController.-$$Nest$mfindAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage (AccessibilityInteractionController.java:1647)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7898)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
jo...@gmail.com <jo...@gmail.com> #5
Getting the same error on a OnePlus 8 Pro running Android 11:
java.lang.IndexOutOfBoundsException: offset(7) should be less than line limit(6)
android.text.TextLine.measure(TextLine.java:353)
android.text.Layout.getHorizontal(Layout.java:1213)
android.text.Layout.getHorizontal(Layout.java:1190)
android.text.Layout.getPrimaryHorizontal(Layout.java:1160)
android.text.Layout.getPrimaryHorizontal(Layout.java:1149)
androidx.compose.ui.text.android.LayoutHelper.getDownstreamHorizontal(LayoutHelper.java:90)
androidx.compose.ui.text.android.TextLayout.getPrimaryHorizontal(TextLayout.java:10)
androidx.compose.ui.text.android.TextLayout.getBoundingBox(TextLayout.java:41)
androidx.compose.ui.text.AndroidParagraph.getBoundingBox(AndroidParagraph.java:41)
androidx.compose.ui.text.MultiParagraph.getBoundingBox(MultiParagraph.java:40)
androidx.compose.ui.text.TextLayoutResult.getBoundingBox(TextLayoutResult.java:40)
androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.addExtraDataToAccessibilityNodeInfoHelper(AndroidComposeViewAccessibilityDelegateCompat.java:162)
androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.addExtraDataToAccessibilityNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.java:162)
android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:1104)
android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:342)
android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1460)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:223)
android.app.ActivityThread.main(ActivityThread.java:7701)
java.lang.reflect.Method.invoke(Method.java:0)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
de...@greyarea.no <de...@greyarea.no> #6
I am getting the same issue in firebase test lab; on Pixel 7 API 33. Unable to replicate it. Happens in a compose based ModalBottomSheetLayout with a parent Column, several child Rows and a LazyColumn that holds rows with text.
android.text.TextLine.measure (TextLine.java:389)
android.text.Layout.getHorizontal (Layout.java:1246)
android.text.Layout.getHorizontal (Layout.java:1222)
android.text.Layout.getPrimaryHorizontal (Layout.java:1192)
android.text.Layout.getPrimaryHorizontal (Layout.java:1181)
androidx.compose.ui.text.android.LayoutHelper.getDownstreamHorizontal (LayoutHelper.kt:353)
androidx.compose.ui.text.android.LayoutHelper.getHorizontalPosition (LayoutHelper.kt:236)
androidx.compose.ui.text.android.TextLayout.getPrimaryHorizontal (TextLayout.kt:503)
androidx.compose.ui.text.android.TextLayout.getBoundingBox (TextLayout.java:675)
androidx.compose.ui.text.AndroidParagraph.getBoundingBox (AndroidParagraph.android.kt:312)
androidx.compose.ui.text.MultiParagraph.getBoundingBox (MultiParagraph.java:488)
androidx.compose.ui.text.TextLayoutResult.getBoundingBox (TextLayoutResult.kt:527)
androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.addExtraDataToAccessibilityNodeInfoHelper (AndroidComposeViewAccessibilityDelegateCompat.java:1439)
androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.access$addExtraDataToAccessibilityNodeInfoHelper (AndroidComposeViewAccessibilityDelegateCompat.java:117)
androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.addExtraDataToAccessibilityNodeInfo (AndroidComposeViewAccessibilityDelegateCompat.android.kt:2460)
android.view.AccessibilityInteractionController.populateAccessibilityNodeInfoForView (AccessibilityInteractionController.java:430)
android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java:363)
android.view.AccessibilityInteractionController.-$$Nest$mfindAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java)
android.view.AccessibilityInteractionController$PrivateHandler.handleMessage (AccessibilityInteractionController.java:1647)
ja...@ntucenterprise.sg <ja...@ntucenterprise.sg> #7
We also started to receive this crash on error reports, after upgrading activity-compose
to 1.6.1.
Any update on this?
si...@google.com <si...@google.com> #8
Halil I vaguely remember that you fixed a similar issue recently or mentioned about it (a 1 off error for getHorizontalPosition).
Does this sound familiar?
java.lang.IndexOutOfBoundsException: measureLimit (120) is out of start (0) and limit (119) bounds
ha...@google.com <ha...@google.com> #9
Yes this is the same bug that we've investigated priorly. Both originate from AccessibilityDelegateCompat and use getBoundingBox
. The underlying issue is in the platform TextLayout but we can circumvent the issue by falling back to previous implementation for the last cursor position.
ha...@google.com <ha...@google.com> #10
I looked at this a bit more yesterday. Some of my findings include;
- This has always been buggy unfortunately. Previous getBoundingBox implementation also had a call to
getPrimaryHorizontal(offset)
that is the culprit from platform. getPrimaryHorizontal(offset)
always fails in a situation similar to following;- Text is ellipsized.
- Ellipsis region includes an LF character '\n'
- offset points to a character after this LF
- TextLine object in text layout is set with a start and limit on given text.
- Limit does not care about ellipsis but cares about LF characters. So, a text is always guaranteed to be partitioned into multiple lines in the existence of LF.
- Querying an ellipsized offset which would have been on a different line anyway causes a crash on TextLine since TextLine thinks that the given offset is out of bounds.
There is a comment in TextLayout.kt
that references a similar problem with platform text layout
jm...@gmail.com <jm...@gmail.com> #11
Is there a recommended work around for this? Our team is seeing a rather appreciable number of reports for this crash.
Thank you!
androidx.appcompat:appcompat:1.6.1
androidx.compose:compose-bom:2023.04.00
si...@empiriecom.com <si...@empiriecom.com> #12
we are also interested in a fix or workaround for this.
Best regards!
Versions used:
- androidx.activity:activity-compose:1.6.0
- androidx.compose.ui:ui:1.3.3
- androidx.compose.ui:ui-text:1.3.3
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit 9e49803f6ce45ec5a3a1899101485f13036c6432
Author: Halil Ozercan <halilibo@google.com>
Date: Wed May 10 17:23:14 2023
Fix getBoundingBox crashing for some ellipsized indices
This CL fixes a bug where getBoundingBox throws an index out of bounds error when the queried offset is in the ellipsized region and comes after a LINE_FEED(\n) character.
Additionally we are converging some exception types in AndroidParagraph to use `IllegalArgumentException` via `require` function, instead of `AssertionError`.
Fix:
Relnote: "`Paragraph` methods that used to throw `AssertionError` for out of bounds offsets now throw `IllegalArgumentException` as `MultiParagraph` does."
Test: :compose:ui:ui-text:cAT
Change-Id: I549d3ec936afbd941361690d1f16fadc4998670a
A compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationBoundingBoxTest.kt
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/ParagraphIntegrationTest.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/AndroidParagraph.android.kt
M text/text/src/main/java/androidx/compose/ui/text/android/LayoutHelper.kt
ha...@google.com <ha...@google.com> #14
We have attempted a blind fix since we couldn't reproduce the issue with the exact stacktrace. However, we still have high confidence that this fix should address the original issue.
Top of the stacktrace in all reported cases is a very isolated path that tells us that all crashes were highly likely resulted from querying a bounding box in an ellipsized region of a text layout. Attempted fix solves this particular issue.
wi...@dcsg.com <wi...@dcsg.com> #15
pr...@google.com <pr...@google.com> #16
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui-text:1.6.0-alpha01
androidx.compose.ui:ui-text-android:1.6.0-alpha01
Description
Version used: androidx.activity:activity-compose:1.5.0
Theme used: -
Devices/Android versions reproduced on: Nokia 1 Android 8.1 (SDK 27) 240DPI + 480 x 854
Description: This crash log came from pre-launch report. The crash occurred only with that small device noted above. The "reviews" section is the last widget in that LazyColumn shown in screenrecord. There are no any editable textfields in that page where the app crashes.
Screenrecord of the crash:
Stacktrace:
FATAL EXCEPTION: main
Process:
java.lang.IndexOutOfBoundsException: measureLimit (120) is out of start (0) and limit (119) bounds
at android.text.TextLine.handleRun(TextLine.java:990)
at android.text.TextLine.measureRun(TextLine.java:417)
at android.text.TextLine.measure(TextLine.java:307)
at android.text.Layout.getHorizontal(Layout.java:1094)
at android.text.Layout.getHorizontal(Layout.java:1072)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1043)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1033)
at u1.b.a(Unknown Source:4)
at u1.b.b(Unknown Source:6)
at u1.n.g(SourceFile:2)
at b2.a.c(Unknown Source:10)
at t1.u.b(SourceFile:7)
at androidx.compose.ui.platform.r$d.addExtraDataToAccessibilityNodeInfo(SourceFile:14)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:980)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:336)
at android.view.AccessibilityInteractionController.-wrap1(Unknown Source:0)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)