Status Update
Comments
ch...@google.com <ch...@google.com> #2
1. Have you saw crash in real device or only in simulators?
2. Do you use dynamic feature for language ID?
ch...@google.com <ch...@google.com> #3
Tested on Android 12 Emulator with custom executor, but cannot repro this issue.
ch...@google.com <ch...@google.com> #4
-
Second crash in the description is from a real device. Experienced it myself on two different Xiaomi phones, plus lots of crashes from users in the Google Play console.
-
Dynamic features are not used in the application.
As a wild guess, I have downgraded build tools from 31.0.0 to 30.0.3, compileSdk from 31 to 30, and moved all work with Language ID to the service in a separate process (just to be sure that crash can kill secondary process instead of main). This combination is in beta for 2 days by now and I don't see any SIGSEGV crashes.
ap...@google.com <ap...@google.com> #5
Hmm, I feel the crash might be something related to separate/secondary process.
I also changed compileSdk and targetSDK to 31 but still cannot repro this issue.
ch...@google.com <ch...@google.com> #6
On the contrary, there was no separate process before, when crashes started.
In the new build (with the aforementioned changes) I can see SIGSEGV crash, but only one instead of dozens and it has a bit different backtrace:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
liblanguage_id_jni.so (offset 0x11e000)
backtrace:
#00 pc 000000000003c7c0 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 000000000003b960 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 000000000003bb48 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 000000000003bafc /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 0000000000036c98 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 0000000000032714 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 0000000000031cac /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/split_config.arm64_v8a.apk!lib/arm64-v8a/liblanguage_id_jni.so (offset 0x11e000)
#00 pc 0000000000057438 /data/app/azagroup.reedy-mF7zTu2bv_ELlbFArwNgqA==/oat/arm64/base.odex (offset 0x57000)
Description
Meanwhile, the bounds are also limited to whatever the screen orientation of the shape is at the time. So if the caller was hoping to get the bounds once to calculate the size of the bounding view/composable and then rotate the shape within that area, they may find that the shape exceeds those bounds as it changes orientation. For a simple example, imagine a rectangle that is long in the x direction but short in the y direction, which would result in bounds that are similarly wide horizontally but short vertically, Rotating that rectangle would exceed the bounds in the Y direction quickly as the corners of the rectangle rotated outside of the original bounds.
It seems like we should provide more functionality for bounds calculations in two ways:
1) Exact bounds: Approximate bounds are sufficient for many purposes, and have the advantage of being cheap to compute (we are simply doing a bunch of float compares against all points in a shape). But if a caller wants the exact bounds for some reason, we should be able to calculate those by checking the bounds of the actual curves instead of just the points that created those curves. For example, in the attached screenshot of the clover, exact bounds would look closer to the yellow box than the green box, where the bounds met the outline of the clover's curves.
2) Max bounds: If a caller intends to rotate or otherwise change the orientation of a shape, we could calculate the max bounds. This is essentially the farthest point on any of the curves from the center, doubled, in both directions. For example, if the farthest point on a curve were (100, 100) away from the center, then the max bounds would be (-100, -100), (100, 100).
The caller can come up with these values already; they have access to the same underlying cubics that we would use to calculate these new bounds values. But it seems like the kind of utility that the library should provide directly to make it easier to position these shapes in a UI, where bounds help determine placement and sizing of the views/composables which contain these shapes.