Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Dispatching rotary event while focus system is invalidated. #2469

Open
Digipom opened this issue Nov 29, 2024 · 3 comments

Comments

@Digipom
Copy link

Digipom commented Nov 29, 2024

Migrating from horologist 0.5.27 to 0.6.20 seems to break rotary events, even without changing any code. This still happens if I update all the other compose dependencies to the latest (1.7.5), but it also happens with compose 1.7.0. This was not crashing on compose 1.6.8 with horologist 0.5.27.

0.5.27 -> does not crash.
0.6.20 -> crashes
0.7.0-alpha -> crashes
0.7.5-alpha -> crashes

Stacktrace (1.7.5):

 FATAL EXCEPTION: main
Process: my app, PID: 12464
java.lang.IllegalStateException: Dispatching rotary event while focus system is invalidated.
	at androidx.compose.ui.focus.FocusOwnerImpl.dispatchRotaryEvent(FocusOwnerImpl.kt:302)
	at androidx.compose.ui.platform.AndroidComposeView.handleRotaryEvent(AndroidComposeView.android.kt:1847)
	at androidx.compose.ui.platform.AndroidComposeView.dispatchGenericMotionEvent(AndroidComposeView.android.kt:1794)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at com.android.internal.policy.DecorView.superDispatchGenericMotionEvent(DecorView.java:506)
	at com.android.internal.policy.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1927)
	at android.app.Activity.dispatchGenericMotionEvent(Activity.java:4347)
	at com.android.internal.policy.DecorView.dispatchGenericMotionEvent(DecorView.java:470)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processGenericMotionEvent(ViewRootImpl.java:6990)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6704)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6106)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6163)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6129)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6334)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6137)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6391)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6110)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6163)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6129)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6137)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6110)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9306)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9257)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9226)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9438)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
	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:7962)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

Stacktrace (1.8.0-alpha06):

 FATAL EXCEPTION: main
Process: com.myapp, PID: 15417
java.lang.IllegalStateException: Dispatching rotary event while focus system is invalidated.
	at androidx.compose.ui.focus.FocusOwnerImpl.dispatchRotaryEvent(FocusOwnerImpl.kt:319)
	at androidx.compose.ui.platform.AndroidComposeView.handleRotaryEvent(AndroidComposeView.android.kt:1964)
	at androidx.compose.ui.platform.AndroidComposeView.dispatchGenericMotionEvent(AndroidComposeView.android.kt:1911)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at android.view.ViewGroup.dispatchGenericFocusedEvent(ViewGroup.java:2573)
	at android.view.View.dispatchGenericMotionEvent(View.java:15342)
	at com.android.internal.policy.DecorView.superDispatchGenericMotionEvent(DecorView.java:506)
	at com.android.internal.policy.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1927)
	at android.app.Activity.dispatchGenericMotionEvent(Activity.java:4347)
	at com.android.internal.policy.DecorView.dispatchGenericMotionEvent(DecorView.java:470)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processGenericMotionEvent(ViewRootImpl.java:6990)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6704)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6106)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6163)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6129)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6334)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6137)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6391)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6110)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6163)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6129)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6137)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6110)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9306)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9257)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9226)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9438)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
	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:7962)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)

Crashing here:

override fun dispatchRotaryEvent(
        event: RotaryScrollEvent,
        onFocusedItem: () -> Boolean
    ): Boolean {
        **check(!focusInvalidationManager.hasPendingInvalidation()) {**
            "Dispatching rotary event while focus system is invalidated."
        }
@Digipom
Copy link
Author

Digipom commented Nov 29, 2024

@yschimke
Copy link
Collaborator

Do you have a simple repro? I haven't seen that exception before

@Digipom
Copy link
Author

Digipom commented Nov 29, 2024

@yschimke It's 100% reproducible in my app but I have no idea how to make the test case. Sometime after the initial report I saw that the Compose team fixed it on their end (not yet released) -- could probably close this or gate it on that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants