florisboard: Crash on landscape mode

Short description

Today i wanted to test the new features that you made on Smartbar rework PR to see new option overflow menu everything is good and works great i like it but it have a small bug when you use phone in landscape mode(horizontal mode) and click on overflow menu the keyboard stops working and suddenly crash.

Steps to reproduce

  1. Go to ‘Any app in landscape mode’
  2. Click on ‘Overflow menu’
  3. See crash

Environment information

  • FlorisBoard 0.4.0-debug-7be6c13 (88)
  • Device: Samsung SM-G781B (r8qxeea)
  • Android: 12 (cn=S sdk=31)

Attached logs and stacktrace files

Detailed info (Debug log header)
======= SYSTEM INFO =======
Time                : 2022-08-22T13:09:52.780406Z
Manufacturer        : samsung
Model               : SM-G781B
Product             : r8qxeea
Android             : 12 (cn=S sdk=31) [SP1A.210812.016.G781BXXS4FVF3]
ABIs                : [arm64-v8a, armeabi-v7a, armeabi]
Memory              : 3.77 GiB (68.65% used, 5.50 GiB max)
Font scale          : 0.9
Locales             : en-GB

======= APP INFO =======
Package             : dev.patrickgold.florisboard.debug
Name                : FlorisBoard Debug
Version             : 0.4.0-debug-7be6c13 (88)
Build type          : debug
Build commit hash   : 7be6c135ef7fb54624c1ab62b1a7f14efd823bb4
Java heap memory    : 36.91 MiB (14.42% used, 256.00 MiB max)
Native heap memory  : 30.94 MiB (96.19% used, 32.17 MiB max)

======= FEATURE CONFIG =======
Smartbar enabled            : true
Suggestions enabled         : false
Inline autofill enabled     : true
Glide enabled               : false
Internal clipboard enabled  : false

1661173784145.stacktrace
java.lang.IllegalArgumentException: Requested element count -2 is less than zero.
	at kotlin.collections.CollectionsKt___CollectionsKt.takeLast(_Collections.kt:914)
	at dev.patrickgold.florisboard.ime.smartbar.quickaction.QuickActionsOverflowPanelKt.QuickActionsOverflowPanel(QuickActionsOverflowPanel.kt:55)
	at dev.patrickgold.florisboard.ime.text.TextInputLayoutKt$TextInputLayout$1.invoke(TextInputLayout.kt:63)
	at dev.patrickgold.florisboard.ime.text.TextInputLayoutKt$TextInputLayout$1.invoke(TextInputLayout.kt:55)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2363)
	at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:2653)
	at dev.patrickgold.florisboard.ime.text.TextInputLayoutKt.TextInputLayout(TextInputLayout.kt:84)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2$3$1$1.invoke(FlorisImeService.kt:605)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2$3$1$1.invoke(FlorisImeService.kt:598)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2$3.invoke(FlorisImeService.kt:598)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2$3.invoke(FlorisImeService.kt:571)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at dev.patrickgold.florisboard.lib.snygg.ui.SnyggSurfaceKt$SnyggSurface$1.invoke(SnyggSurface.kt:99)
	at dev.patrickgold.florisboard.lib.snygg.ui.SnyggSurfaceKt$SnyggSurface$1.invoke(SnyggSurface.kt:52)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at dev.patrickgold.florisboard.lib.snygg.ui.SnyggSurfaceKt.SnyggSurface(SnyggSurface.kt:49)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2.invoke(FlorisImeService.kt:563)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$2.invoke(FlorisImeService.kt:562)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at dev.patrickgold.florisboard.FlorisImeService.ImeUi(FlorisImeService.kt:562)
	at dev.patrickgold.florisboard.FlorisImeService.access$ImeUi(FlorisImeService.kt:137)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$3.invoke(Unknown Source:6)
	at dev.patrickgold.florisboard.FlorisImeService$ImeUi$3.invoke(Unknown Source:10)
	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
	at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2363)
	at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2630)
	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3217)
	at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3195)
	at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:336)
	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3195)
	at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3160)
	at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:748)
	at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876)
	at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107)
	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485)
	at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454)
	at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
	at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
	at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
	at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106)
	at android.view.Choreographer.doCallbacks(Choreographer.java:866)
	at android.view.Choreographer.doFrame(Choreographer.java:792)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8669)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@7295976, androidx.compose.ui.platform.MotionDurationScaleImpl@d213b77, StandaloneCoroutine{Cancelling}@c4ec3e4, AndroidUiDispatcher@391104d]

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I found a semi-reliable way to reproduce the crash:

  1. Open an app and focus a text field.
  2. Click the Settings icon from the Smartbar
  3. Open the Android activity view and slide FlorisBoard away
  4. Click on the app with the text field again
  5. Immediately even before the the keyboard has any chance to show lock your device
  6. Unlock it again
  7. See crash every second time or so (method not always works)

Above linked commit now forces the observers of the KeyboardManager on the Main thread and the bug should not occur anymore. I’ve tested it using my method a lot of times and with different apps and after the fix I was not able to reproduce the crash at all anymore, so I hope it is now fixed.

Thanks for your bug report on a version that isn’t even released 😃

The first crash has been fixed, in landscape the overflow panel has no actions to show which it didn’t expect and then crashed.

The second crash you commented is something I experienced once too but cannot reproduce since then, do you have any concrete way to reproduce this?