Status Update
Comments
ae...@google.com <ae...@google.com> #2
Branch: androidx-main
commit bbfbdb3b7ffc824bcb393595ebfcd4168d9ab934
Author: Matvei Malkov <malkov@google.com>
Date: Tue May 11 13:28:57 2021
Add Card overload with onClick to match Surface.
Most of the cards we have are usually clickable, so to match the Surface we added a Card overload that requires onClick.
Change-Id: Ia8744f372b7ecafd4e92d0fc58245ebc0972b18d
Relnote: BEHAVIOUR-BREAKING: Card now consumes clicks, making clicks added via Card(Modifier.clickable) to be a no-op. Please, use new experimental overload of a Card that accepts onClick.
Relnote: Added a new Card overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Card with the Modifier.clickable because the Card will not clip the ripple indication in those cases.
Bug: 183775620
Test: added for a new overload
M compose/material/material/api/public_plus_experimental_1.0.0-beta08.txt
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ElevationDemo.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/CardSamples.kt
M compose/material/material/samples/src/main/java/androidx/compose/material/samples/SurfaceSamples.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/CardTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Card.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
tp...@gmail.com <tp...@gmail.com> #3
Branch: androidx-main
commit dfbfcd90a67d66d7eab8a7381e85ae9f831cea4a
Author: Matvei Malkov <malkov@google.com>
Date: Wed Mar 31 17:25:02 2021
Add experimental support for a version of Surface that handles click and make a regular Surface to block touches behind it.
Clickable Surface allows us to handle many issues at once:
1. Allows to define clicks on the Surface layout node, making a11y to be correct
2. Allows to define clicks in the single layout node without the need to transfer indication hnadling to the node below (because of the clipping inside the surface)
3. Allows for a desired default behaviour in a non-clickable Surface when we block pointer events from going under the surface. Throughout the many components it is seens like a desiged behaviour and often leads to bugs (snackbar, Drawer, modal sheet & card being norable examples of surfaces that shouldn't allow touches behind it).
To make this work properly, I refactored ModalBottomSheetLayout to work with the sheet-based swipeable (instead of content-based), since sheet is not blocking clicks.
With this one overload we solve many issues so it seems like a worthy experiment.
Relnote: BEHAVIOUR-BREAKING: Surface now consumes clicks, making clicks added via Surface(Modifier.clickable) to be a no-op. Please, use new experimental overload of Surface that accepts onClick.
Relnote: Added a new Surface overload that handles clicks as well as other clickable functionality: indication, interactionSource, enabled/disabled. It wasn't possible to use a regular non-clickable Surface with the Modifier.clickable because the Surface will not clip the ripple indication in those cases.
Test: Added new for an overload
Fixes: 183775620
Change-Id: I73e6c76ed6389040d824a5dcc82dc84dc4fea0c7
M compose/material/material/api/public_plus_experimental_1.0.0-beta08.txt
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SnackbarHostTest.kt
M compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/SurfaceTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Button.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/FloatingActionButton.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Surface.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Switch.kt
tp...@gmail.com <tp...@gmail.com> #4
Managed to extract the composables from main project to replicate the issue in a sample project.
2021-11-22 16:56:00.237 2684-2684/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.terence.composeTest, PID: 2684
java.lang.NullPointerException
at androidx.compose.ui.platform.RenderNodeLayer.updateDisplayList(RenderNodeLayer.android.kt:245)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:760)
at android.view.View.draw(View.java:21654)
...
Crash reproduced on Huawei device: Huawei Y5p Android 10
Steps to reproduce
- Run the project
- Enter any 6 digit passcode
- App crashes shortly after showing loading screen
As mentioned earlier the same sample project is not crashing when running on other non Huawei devices e.g. tested on Pixel 3XL
Have trace down further to this extension function used in AnimatedVectorDrawableRepeating as workaround for auto starting avd drawables related to this issue on Avd repeating animations are not repeating.
fun ImageView.autoStartAnimation(autoStart: Boolean = false, loopAnim: Boolean = false) {
// Fix for java.lang.NullPointerException at androidx.compose.ui.platform.RenderNodeLayer.updateDisplayList(RenderNodeLayer.android.kt:245) from
// IndeterminateLoadingScreen with avd drawable happening on Huawei devices mostly
// Commented out post block for crash reproduction
// post {
if (drawable is Animatable) {
val animatable = drawable as Animatable
if (autoStart) {
if (!animatable.isRunning) {
if (loopAnim) {
doOnAttach {
when (animatable) {
is AnimatedVectorDrawableCompat -> {
val animationListener = object : Animatable2Compat.AnimationCallback() {
override fun onAnimationEnd(drawable: Drawable?) {
post { animatable.start() }
}
}.apply {
animatable.registerAnimationCallback(this)
}
doOnDetach {
animatable.unregisterAnimationCallback(animationListener)
}
}
is AnimatedVectorDrawable -> {
val animationListener = object : Animatable2.AnimationCallback() {
override fun onAnimationEnd(drawable: Drawable?) {
post { animatable.start() }
}
}.apply {
animatable.registerAnimationCallback(this)
}
doOnDetach {
animatable.unregisterAnimationCallback(animationListener)
}
}
}
}
}
animatable.start()
}
} else {
animatable.stop()
}
}
// }
}
@ExperimentalAnimationGraphicsApi
@Composable
fun AnimatedVectorDrawableRepeating(
modifier: Modifier = Modifier,
manualLoopAnim: Boolean = false, // used for when avd does not internally do repeating="infinite"
@DrawableRes id: Int
) {
AndroidView(
modifier = modifier,
factory = {
ImageView(it).apply {
scaleType = ImageView.ScaleType.FIT_CENTER
setImageResource(id)
autoStartAnimation(autoStart = true, loopAnim = manualLoopAnim)
}
},
update = {}
)
}
Please refer to sample project's IndeterminateLoadingScreen.kt for the above code snippets.
I managed to workaround the crash with a fix by wrapping the code in ImageView.autoStartAnimation with a post { } block. Based on testing, the last known versions combination
compose_version = '1.1.0-alpha05'
accompanist_version = '0.20.2'
isn't crashing even without adding the post block in the ImageView.autoStartAnimation extension function. Any combinations of newer versions other than above would be able to reproduce the crash if the post block is not present as demonstrated in the sample project.
tp...@gmail.com <tp...@gmail.com> #5
Hi all, some updates for this issue, from our crashlytics noticed that adding the post { } block still causes the same crash on 100% Android 7 Samsung devices when calling animatable.start() with AndroidView.
Crash is happening for Note 5 and S6, S6 edge and edge+ devices as per screenshot attached.
May I check if there are any updates regarding this issue?
ma...@gmail.com <ma...@gmail.com> #6
This also happens on OnePlus 7 Pro running LineageOS
th...@gmail.com <th...@gmail.com> #7
I am running into the same issue with my Compose app on Wear OS. Samsung Galaxy Watch4. Could this please be fixed?
Similar issue:
java.lang.NullPointerException
at androidx.compose.ui.platform.RenderNodeLayer.updateDisplayList(RenderNodeLayer.android.kt:292)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:857)
at android.view.View.draw(View.java:22879)
at android.view.View.updateDisplayListIfDirty(View.java:21744)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4537)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4509)
at android.view.View.updateDisplayListIfDirty(View.java:21698)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4537)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4509)
at android.view.View.updateDisplayListIfDirty(View.java:21698)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4537)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4509)
at android.view.View.updateDisplayListIfDirty(View.java:21698)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:559)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:565)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:642)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4270)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3983)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3231)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2048)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8575)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:998)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:983)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:7690)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
st...@google.com <st...@google.com> #8
Re
th...@gmail.com <th...@gmail.com> #9
I have not been able to create a sample for the crash with Wear Compose. What I did find out is that if I remove PositionIndicator
from my code the crash no longer occurs. See also:
st...@google.com <st...@google.com> #10
Thomas, is your code also using AnimatedVectorDrawables like the example in the original report?
We are using AVDs in a dialog sample, but I haven't seen that error - perhaps you could test it on your devices to see if it can trigger the exception?
th...@gmail.com <th...@gmail.com> #11
AnimatedVectorDrawables
work fine on the Galaxy Watch4. I am actually using the sample for the open on phone animation you linked in my project already, which works without any issues.
nj...@google.com <nj...@google.com> #12
I have tried the sample github project in
I recommend updating to the latest version of compose or providing a more minimal sample application for the team to look into.
tp...@gmail.com <tp...@gmail.com> #13
Are you running the sample on specific device? The github project is crashing only on Huawei devices running Android 10 or certain android 7 devices. I have tried it again on emulator running on Android 7 API 24 also able to reproduce the crash. Video as attached.
2022-01-13 14:09:57.183 3991-3991/com.terence.composeTest E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.terence.composeTest, PID: 3991
java.lang.NullPointerException
at androidx.compose.ui.platform.RenderNodeLayer.updateDisplayList(RenderNodeLayer.android.kt:245)
at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.android.kt:760)
at android.view.View.draw(View.java:17074)
at android.view.View.updateDisplayListIfDirty(View.java:16053)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3748)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3728)
at android.view.View.updateDisplayListIfDirty(View.java:16016)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:656)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:662)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:770)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2796)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2604)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2211)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1246)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6301)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
at android.view.Choreographer.doCallbacks(Choreographer.java:683)
at android.view.Choreographer.doFrame(Choreographer.java:619)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
2022
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit f4ad578674a55af824e19d6e921dcd68f5eeff82
Author: Nader Jawad <njawad@google.com>
Date: Wed Jan 12 16:10:47 2022
Add defensive null check
Add conditional let block within
logic to record drawing operations
in case the displaylist for a RenderNodeLayer
is attempted to be updated after the layer
has been destroyed
Fixes: 206677462
Test: re-ran compose tests
Change-Id: I838d3170547716fa35d6e9b630db995075e814d9
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.android.kt
to...@branchapp.com <to...@branchapp.com> #15
ri...@ffw.com <ri...@ffw.com> #16
th...@gmail.com <th...@gmail.com> #17
Thanks for the fix! I can confirm it works with the latest snapshot in my Wear OS app.
lc...@gmail.com <lc...@gmail.com> #18
Can this fix be ported to 1.1.0 version too? i see that its currently onl in 1.2.0-alpha02
fr...@instacart.com <fr...@instacart.com> #19
+1, this is forcing us to downgrade compose and kotlin, this needs to be in 1.1
be...@google.com <be...@google.com> #20
This fix has been cherry picked to 1.1.1 as well
na...@google.com <na...@google.com> #21
The following release(s) address this bug:
androidx.compose.ui:ui:1.3.0
Description
Hello, noticed a NPE crash in compose ui after updating from 1.1.0-alpha05 to 1.1.0-beta01. Crash happening in RenderNodeLayer.updateDisplayList and happening 100% on Android 10 Huawei devices as reported on crashlytics. Initially thought it was due to code obfuscation issue but managed to replicate it consistently on a non obfuscated build.
Noticed from the stacktrace that somehow drawBlock in updateDisplayList is null but not sure in what scenarios it could become null?