New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matrix.setValues doesn't accept value array with size >9 #8369
Comments
Workaround in https://r.android.com/2675858. |
@zach-klippenstein Thanks for filing this issue. I think it is caused by robolectric/shadows/framework/src/main/java/org/robolectric/shadows/ShadowLegacyMatrix.java Lines 429 to 431 in c3ef827
|
@zach-klippenstein If you can ensure RobolectricComposeTest.kt only run on macOS and Linux, you can enable native graphics with Config to use realistic implementation of Matrix(RNG use graphics libraries built from AOSP source code). |
Thanks for the suggestion, TIL! That could solve my immediate problem, but I also don't want to break downstream users of Compose who are running their own Robolectric tests and might be using Windows. |
I tried applying the annotation |
If the array is <9, and ArrayIndexOutOfBoundsException is still thrown. Tested by new tests in `ShadowMatrixTest`. Fixes robolectric#8369
If the array is <9, and ArrayIndexOutOfBoundsException is still thrown. Tested by new tests in `ShadowMatrixTest`. Fixes robolectric#8369
If the array is <9, and ArrayIndexOutOfBoundsException is still thrown. Tested by new tests in `ShadowMatrixTest`. Fixes #8369
@hoisie Could we have a 4.10.4 minor patch release? We can cherry-pick this one and other important commits to this release. In AndroidX part, the 4.10.3 integration has been reverted by https://android-review.googlesource.com/c/platform/frameworks/support/+/2623613 because of flaky crashes. I don't know whether related issues have been fixed or it is related to Robolectric only. @zach-klippenstein Maybe you can ask Aurimas for extra informations if you want the Robolectic 4.10.4 before 4.11. |
Reopen for later integration discussion. |
Just talked to Aurimas, we're finally on 4.10.3. It's not super urgent to have this fix available, we just need it for part of the implementation of the new Compose text field rewrite. Do you know roughly when 4.11 is targeting release? If it's some time in the next couple months we can probably wait for that. |
@zach-klippenstein I think 4.11 will be released after AOSP 14 source code released and the Android 14 support is integrated into Robolectric. |
I believe Android 14 source has been released. Do you have a rough ETA for when Robolectric might integrate it? |
We are in the process of releasing support for Android 14 (U). |
Description
If you call
android.graphics.Matrix.setValues
with an array of more than 9 elements, it throws anArrayIndexOutOfBoundsException
. This does not happen on Android, where it throws for less than 9 values, but accepts >9 values.This prevents an optimization in Jetpack Compose where we re-use a 4x4 array when converting between Compose's
Matrix
type and the system one.Steps to Reproduce
Create an
android.graphics.Matrix
, a 16-element array, and pass it tosetValues
.Robolectric & Android Version
Robolectric: 4.9.2, 4.10.3
Android: Every version Jetpack Compose tests on: 21, 26, 28, 30, 33.
Link to a public git repo demonstrating the problem:
https://r.android.com/2647564
The text was updated successfully, but these errors were encountered: