android / tv-samples

Multiple samples showing best practices in app development on Android TV.
Apache License 2.0
1.06k stars 339 forks source link

JetStream crashes on home screen #136

Closed chikoski closed 6 months ago

chikoski commented 1 year ago

Sometimes JetStream's home screen crashes when I move focus from the Iist in the ImmersiveList to other lists. The following is the stack trace:

 java.lang.IllegalStateException: node attached multiple times
                                                                                                        at androidx.compose.ui.Modifier$Node.markAsAttached$ui_release(Modifier.kt:264)
                                                                                                        at androidx.compose.ui.node.NodeChain.markAsAttached(NodeChain.kt:290)
                                                                                                        at androidx.compose.ui.node.LayoutNode.onReuse(LayoutNode.kt:1344)
                                                                                                        at androidx.compose.runtime.changelist.Operation$UseCurrentNode.execute(Operation.kt:319)
                                                                                                        at androidx.compose.runtime.changelist.Operations.executeAndFlushAllPendingOperations(Operations.kt:307)
                                                                                                        at androidx.compose.runtime.changelist.ChangeList.executeAndFlushAllPendingChanges(ChangeList.kt:77)
                                                                                                        at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:970)
                                                                                                        at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:999)
                                                                                                        at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1087)
                                                                                                        at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3566)
                                                                                                        at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3566)
                                                                                                        at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:632)
                                                                                                        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:622)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:498)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:471)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:462)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:446)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:862)
                                                                                                        at androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl.measure-0kLqBqw(LazyLayoutMeasureScope.kt:125)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyListMeasuredItemProvider.getAndMeasure(LazyListMeasuredItemProvider.kt:49)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyListMeasureKt.measureLazyList-qnDatfE(LazyListMeasure.kt:169)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke-0kLqBqw(LazyList.kt:324)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(LazyList.kt:190)
                                                                                                        at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$3$2$1.invoke-0kLqBqw(LazyLayout.kt:107)
                                                                                                        at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$3$2$1.invoke(LazyLayout.kt:100)
                                                                                                        at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:704)
                                                                                                        at androidx.compose.ui.node.InnerNodeCoordinator$LookaheadDelegateImpl.measure-BRTryo0(InnerNodeCoordinator.kt:81)
                                                                                                        at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$2.invoke-3p2s80s(AndroidOverscroll.kt:584)
                                                                                                        at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$2.invoke(AndroidOverscroll.kt:583)
                                                                                                        at androidx.compose.ui.layout.LayoutModifierImpl.measure-3p2s80s(LayoutModifier.kt:291)
                                                                                                        at androidx.compose.ui.node.LayoutModifierNodeCoordinator$LookaheadDelegateForLayoutModifierNode.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:64)
                                                                                                        at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$1.invoke-3p2s80s(AndroidOverscroll.kt:568)
                                                                                                        at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$1.invoke(AndroidOverscroll.kt:567)
                                                                                                        at androidx.compose.ui.layout.LayoutModifierImpl.measure-3p2s80s(LayoutModifier.kt:291)
                                                                                                        at androidx.compose.ui.node.LayoutModifierNodeCoordinator$LookaheadDelegateForLayoutModifierNode.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:64)
                                                                                                        at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
Daio-io commented 10 months ago

There are issues with a similar repro too - if you navigate around quickly (up and down) on the home screen: - which looks related to (https://issuetracker.google.com/issues/312677265#comment1)

java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
                                                                                                        at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255)
                                                                                                        at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
                                                                                                        at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
                                                                                                        at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
                                                                                                        at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
                                                                                                        at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237)
                                                                                                        at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
                                                                                                        at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:697)
rhenwinch commented 10 months ago

compose tv alpha9-10 weird issue here:

new stack trace:

java.lang.IllegalStateException: visitAncestors called on an unattached node
        at androidx.compose.ui.focus.FocusTargetNode.fetchFocusProperties$ui_release(FocusTargetNode.kt:251)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:170)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
        at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
        at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
        at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
        at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:166)
        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:231)
        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:226)
        at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
        at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:199)
        at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:692)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:490)
        at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1880)
        at android.app.Activity.dispatchKeyEvent(Activity.java:4156)
        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:404)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6278)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6144)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5626)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5814)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5871)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5847)
        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6005)
        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3263)
        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2827)
        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2818)
        at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3240)
        at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:335)
        at android.os.Looper.loopOnce(Looper.java:161)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

This used to work on alpha08 before. I can't rollback to alpha08 since it throws random NoMethodFound/NoClassFound errors.

GeorgiBurgazliev commented 9 months ago

Any progress on this issue? Removing the focusRestorer modifier prevents the app from crash..

FATAL EXCEPTION: main
                                                                                                    Process: com.google.jetstream, PID: 10839
                                                                                                    java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
                                                                                                        at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255)
                                                                                                        at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
                                                                                                        at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
                                                                                                        at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
                                                                                                        at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
                                                                                                        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
                                                                                                        at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
                                                                                                        at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237)
                                                                                                        at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
                                                                                                        at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215)
                                                                                                        at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696)
                                                                                                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                        at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:486)
                                                                                                        at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1889)
                                                                                                        at android.app.Activity.dispatchKeyEvent(Activity.java:4222)
                                                                                                        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
                                                                                                        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
                                                                                                        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
                                                                                                        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:400)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6500)
                                                                                                        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6366)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5826)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
2024-01-29 17:09:09.495 10839-10839 AndroidRuntime          com.google.jetstream                 E      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6014)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5857)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6071)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5830)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5857)
                                                                                                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5830)
                                                                                                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
                                                                                                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6047)
                                                                                                        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6227)
                                                                                                        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3741)
                                                                                                        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3261)
                                                                                                        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3252)
                                                                                                        at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3718)
                                                                                                        at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
                                                                                                        at android.os.MessageQueue.nativePollOnce(Native Method)
                                                                                                        at android.os.MessageQueue.next(MessageQueue.java:335)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:161)
                                                                                                        at android.os.Looper.loop(Looper.java:288)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:7898)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
rhenwinch commented 9 months ago

Best workaround I used for now is to use the custom focusRestorer factory and modify it to catch exceptions if ever focusRequester.restoreFocusedChild() throws one. If it does throw an error, then just return FocusRequester.Default instead of childFocusRequester

Until then, we just have to wait for a fix.

EDIT: This doesn't fully fix the crashes, but it should do the trick

ChetanPatelPlayBoxTV commented 9 months ago

Sometimes JetStream's home screen crashes when I move focus from the Iist in the ImmersiveList to other lists. The following is the stack trace:

 java.lang.IllegalStateException: node attached multiple times
                                                                                                      at androidx.compose.ui.Modifier$Node.markAsAttached$ui_release(Modifier.kt:264)
                                                                                                      at androidx.compose.ui.node.NodeChain.markAsAttached(NodeChain.kt:290)
                                                                                                      at androidx.compose.ui.node.LayoutNode.onReuse(LayoutNode.kt:1344)
                                                                                                      at androidx.compose.runtime.changelist.Operation$UseCurrentNode.execute(Operation.kt:319)
                                                                                                      at androidx.compose.runtime.changelist.Operations.executeAndFlushAllPendingOperations(Operations.kt:307)
                                                                                                      at androidx.compose.runtime.changelist.ChangeList.executeAndFlushAllPendingChanges(ChangeList.kt:77)
                                                                                                      at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:970)
                                                                                                      at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:999)
                                                                                                      at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1087)
                                                                                                      at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3566)
                                                                                                      at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3566)
                                                                                                      at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:632)
                                                                                                      at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:622)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:498)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:471)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:462)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:446)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:862)
                                                                                                      at androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl.measure-0kLqBqw(LazyLayoutMeasureScope.kt:125)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyListMeasuredItemProvider.getAndMeasure(LazyListMeasuredItemProvider.kt:49)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyListMeasureKt.measureLazyList-qnDatfE(LazyListMeasure.kt:169)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke-0kLqBqw(LazyList.kt:324)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(LazyList.kt:190)
                                                                                                      at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$3$2$1.invoke-0kLqBqw(LazyLayout.kt:107)
                                                                                                      at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$3$2$1.invoke(LazyLayout.kt:100)
                                                                                                      at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:704)
                                                                                                      at androidx.compose.ui.node.InnerNodeCoordinator$LookaheadDelegateImpl.measure-BRTryo0(InnerNodeCoordinator.kt:81)
                                                                                                      at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$2.invoke-3p2s80s(AndroidOverscroll.kt:584)
                                                                                                      at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$2.invoke(AndroidOverscroll.kt:583)
                                                                                                      at androidx.compose.ui.layout.LayoutModifierImpl.measure-3p2s80s(LayoutModifier.kt:291)
                                                                                                      at androidx.compose.ui.node.LayoutModifierNodeCoordinator$LookaheadDelegateForLayoutModifierNode.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:64)
                                                                                                      at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$1.invoke-3p2s80s(AndroidOverscroll.kt:568)
                                                                                                      at androidx.compose.foundation.AndroidOverscrollKt$StretchOverscrollNonClippingLayer$1.invoke(AndroidOverscroll.kt:567)
                                                                                                      at androidx.compose.ui.layout.LayoutModifierImpl.measure-3p2s80s(LayoutModifier.kt:291)
                                                                                                      at androidx.compose.ui.node.LayoutModifierNodeCoordinator$LookaheadDelegateForLayoutModifierNode.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:64)
                                                                                                      at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)

have you got any solution ?

ChetanPatelPlayBoxTV commented 9 months ago

There are issues with a similar repro too - if you navigate around quickly (up and down) on the home screen: - which looks related to (https://issuetracker.google.com/issues/312677265#comment1)

java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
                                                                                                      at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255)
                                                                                                      at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
                                                                                                      at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237)
                                                                                                      at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:697)

@Daio-io have you got any solution ?

ChetanPatelPlayBoxTV commented 9 months ago

compose tv alpha9-10 weird issue here:

new stack trace:

java.lang.IllegalStateException: visitAncestors called on an unattached node
        at androidx.compose.ui.focus.FocusTargetNode.fetchFocusProperties$ui_release(FocusTargetNode.kt:251)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:170)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
        at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
        at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
        at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
        at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
        at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:166)
        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:231)
        at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:226)
        at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
        at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:199)
        at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:692)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1964)
        at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:490)
        at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1880)
        at android.app.Activity.dispatchKeyEvent(Activity.java:4156)
        at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
        at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
        at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
        at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:404)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6278)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6144)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5626)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5814)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5871)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5847)
        at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6005)
        at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3263)
        at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2827)
        at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2818)
        at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3240)
        at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:335)
        at android.os.Looper.loopOnce(Looper.java:161)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

This used to work on alpha08 before. I can't rollback to alpha08 since it throws random NoMethodFound/NoClassFound errors.

@rhenwinch have you got any solution?

ChetanPatelPlayBoxTV commented 9 months ago

Any progress on this issue? Removing the focusRestorer modifier prevents the app from crash..

FATAL EXCEPTION: main
                                                                                                    Process: com.google.jetstream, PID: 10839
                                                                                                    java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
                                                                                                      at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255)
                                                                                                      at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
                                                                                                      at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237)
                                                                                                      at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696)
                                                                                                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1965)
                                                                                                      at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:486)
                                                                                                      at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1889)
                                                                                                      at android.app.Activity.dispatchKeyEvent(Activity.java:4222)
                                                                                                      at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120)
                                                                                                      at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85)
                                                                                                      at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138)
                                                                                                      at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:400)
                                                                                                      at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6500)
                                                                                                      at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6366)
                                                                                                      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5826)
                                                                                                      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
2024-01-29 17:09:09.495 10839-10839 AndroidRuntime          com.google.jetstream                 E    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                      at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6014)
                                                                                                      at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5857)
                                                                                                      at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6071)
                                                                                                      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5830)
                                                                                                      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
                                                                                                      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                      at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5857)
                                                                                                      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5830)
                                                                                                      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5883)
                                                                                                      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5849)
                                                                                                      at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6047)
                                                                                                      at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6227)
                                                                                                      at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3741)
                                                                                                      at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3261)
                                                                                                      at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3252)
                                                                                                      at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3718)
                                                                                                      at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
                                                                                                      at android.os.MessageQueue.nativePollOnce(Native Method)
                                                                                                      at android.os.MessageQueue.next(MessageQueue.java:335)
                                                                                                      at android.os.Looper.loopOnce(Looper.java:161)
                                                                                                      at android.os.Looper.loop(Looper.java:288)
                                                                                                      at android.app.ActivityThread.main(ActivityThread.java:7898)
                                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

@GeorgiBurgazliev do you get any solution ?

Daio-io commented 9 months ago

@ChetanPatelPlayBoxTV For now we are just throttling input to reduce scroll speed as a bit of a bandaid so we can upgrade Compose etc until a full solution is available. This seems to be working in our tests but it is not bullet proof.

We just use a preview key modifier and a throttle factor to handle

 onPreviewKeyEvent { previewKey ->
        if (keyCodes.contains(previewKey.key.nativeKeyCode))
            if (previewKey.nativeKeyEvent.repeatCount % throttleFactor != 0)
                return@onPreviewKeyEvent true

        return@onPreviewKeyEvent false
    }

Just wrapped in our own Modifier :)

ChetanPatelPlayBoxTV commented 9 months ago
throttleFactor 

@Daio-io what is ideal throttleFactor are you used? like throttleFactor = 2 or something else

randroid88 commented 8 months ago

Also seeing a crash on 4k emulator API 34 when moving the focus around rapidly:

java.lang.IllegalStateException: Searching for active node in inactive hierarchy

com.google.jetstream E FATAL EXCEPTION: main Process: com.google.jetstream, PID: 3554 java.lang.IllegalStateException: Searching for active node in inactive hierarchy at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.activeNode(TwoDimensionalFocusSearch.kt:383) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74) at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106) at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180) at androidx.tv.material3.CarouselKt$handleKeyEvents$1.invoke_ZmokQxo$handledHorizontalFocusMove(Carousel.kt:294) at androidx.tv.material3.CarouselKt$handleKeyEvents$1.invoke-ZmokQxo(Carousel.kt:312) at androidx.tv.material3.CarouselKt$handleKeyEvents$1.invoke(Carousel.kt:260) at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80) at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1966) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1966) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1966) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1966) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:478) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1894) at android.app.Activity.dispatchKeyEvent(Activity.java:4335) at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120) at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:392) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6945) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6811) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6229) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6286) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6252) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6417) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6260) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6474) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6233) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6286) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6252) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6260) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6233) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6286) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6252) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6450) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6661) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:4278) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3715) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3706) at android.view.inputmethod.InputMethodManager.-$$Nest$mfinishedInputEvent(Unknown Source:0) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:4255) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) 2024-03-17 20:42:46.207 3554-3554 AndroidRuntime com.google.jetstream E at android.os.Looper.loopOnce(Looper.java:162) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Daio-io commented 8 months ago

Looks like there is a potential fix in newer versions of Compose: https://issuetracker.google.com/issues/312677265#comment9 (not tested)

ChetanPatelPlayBoxTV commented 7 months ago

Hi @all @chikoski @Daio-io any update for solve this problem?

ChetanPatelPlayBoxTV commented 7 months ago

There are issues with a similar repro too - if you navigate around quickly (up and down) on the home screen: - which looks related to (https://issuetracker.google.com/issues/312677265#comment1)

java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
                                                                                                      at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255)
                                                                                                      at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185)
                                                                                                      at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74)
                                                                                                      at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70)
                                                                                                      at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237)
                                                                                                      at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80)
                                                                                                      at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215)
                                                                                                      at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:697)

@chikoski @Daio-io how to resolve this issue on android tv?

ChetanPatelPlayBoxTV commented 7 months ago

Hey Bro any update @chikoski @Daio-io @randroid88 @rhenwinch @GeorgiBurgazliev ?

gurureddydev commented 6 months ago

--------- beginning of crash 2024-05-05 12:56:16.879 11184-11184 AndroidRuntime com.guru.demoottapp E FATAL EXCEPTION: main Process: com.guru.demoottapp, PID: 11184 java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255) at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180) at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146) at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185) at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70) at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106) at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237) at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80) at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:476) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1861) at android.app.Activity.dispatchKeyEvent(Activity.java:4085) at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120) at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:390) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5960) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5828) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) 2024-05-05 12:56:16.880 11184-11184 AndroidRuntime com.guru.demoottapp E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5498) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5555) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5531) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5689) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3179) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2721) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2712) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3156) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:143) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 2024-05-05 13:00:22.895 11937-11937 InputEventSender com.guru.demoottapp E Exception dispatching finished signal. 2024-05-05 13:00:22.895 11937-11937 MessageQueue-JNI com.guru.demoottapp E Exception in MessageQueue callback: handleReceiveCallback 2024-05-05 13:00:22.904 11937-11937 MessageQueue-JNI com.guru.demoottapp E java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255) at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180) at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146) at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185) at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70) at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106) at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237) at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80) at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:476) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1861) at android.app.Activity.dispatchKeyEvent(Activity.java:4085) at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120) at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:390) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5960) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5828) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) 2024-05-05 13:00:22.904 11937-11937 MessageQueue-JNI com.guru.demoottapp E at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5498) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5555) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5531) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5689) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3179) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2721) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2712) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3156) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:143) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 2024-05-05 13:00:22.917 11937-11937 AndroidRuntime com.guru.demoottapp E FATAL EXCEPTION: main Process: com.guru.demoottapp, PID: 11937 java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:255) at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180) at androidx.compose.ui.focus.FocusTraversalKt.focusRect(FocusTraversal.kt:126) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.findBestCandidate-4WY_MpI(TwoDimensionalFocusSearch.kt:223) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:166) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:141) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:173) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.access$searchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:1) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:148) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt$generateAndSearchChildren$1.invoke(TwoDimensionalFocusSearch.kt:146) at androidx.tv.foundation.lazy.list.LazyLayoutBeyondBoundsModifierLocal.layout-o7g1Pn8(LazyBeyondBoundsModifier.kt:185) at androidx.compose.ui.focus.BeyondBoundsLayoutKt.searchBeyondBounds--OM-vw8(BeyondBoundsLayout.kt:45) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.generateAndSearchChildren-4C6V_qg(TwoDimensionalFocusSearch.kt:146) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:74) at androidx.compose.ui.focus.TwoDimensionalFocusSearchKt.twoDimensionalFocusSearch--OM-vw8(TwoDimensionalFocusSearch.kt:70) at androidx.compose.ui.focus.FocusTraversalKt.focusSearch-sMXa3k8(FocusTraversal.kt:106) at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:180) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:242) at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke(AndroidComposeView.android.kt:237) at androidx.compose.ui.input.key.KeyInputNode.onKeyEvent-ZmokQxo(KeyInputModifier.kt:80) at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:215) at androidx.compose.ui.platform.AndroidComposeView.dispatchKeyEvent(AndroidComposeView.android.kt:696) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1959) at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:476) at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1861) at android.app.Activity.dispatchKeyEvent(Activity.java:4085) at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:120) at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:85) at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:138) at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:390) at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5960) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5828) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) 2024-05-05 13:00:22.919 11937-11937 AndroidRuntime com.guru.demoottapp E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5498) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5555) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5531) at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5689) at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3179) at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2721) at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2712) at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3156) at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:143) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true

chikoski commented 6 months ago

This issue is fixed as #168 migrates androidx.compose.foundation:foundation to 1.7.0-beta01, which includes the fix for this issue.

GeorgiBurgazliev commented 5 months ago

@chikoski Is androidx.tv:tv-foundation deprecated? Should we migrate to androidx.compose.foundation:foundation ?