element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
Apache License 2.0
3.26k stars 676 forks source link

Element crashes with Speech to Text from Microsoft Swiftkey #5597

Open JokerGermany opened 2 years ago

JokerGermany commented 2 years ago

Steps to reproduce

Unfortunately didn't occour on every device

  1. Klick on the speech to text function of Microsoft Switkey
  2. Speak to your device
  3. click on finished https://youtu.be/-SLingtTR_c

Outcome

What did you expect?

keyboard closed and i can send the message

What happened instead?

Element crashed

Workarround

instead of clicking on finshed, click on the back arrow https://www.youtube.com/watch?v=-Kyuk4nvwfI

Your phone model

Vodafone Tab Prime 7 (VFD 1400)

Operating system version

Android 6.0.1

Application version and app store

Element 1.4.4, OLM 3.2.10 from Google Play store.

Homeserver

matrix.org

Will you send logs?

Yes

ouchadam commented 2 years ago

thanks for submitting the logs! looks like we've got some wrong threading going on

Thread: pool-22-thread-2, Exception: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6930)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:990)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:5099)
at android.view.View.invalidateInternal(View.java:12758)
at android.view.View.invalidate(View.java:12694)
at android.widget.TextView.invalidateRegion(TextView.java:5188)
at android.widget.TextView.invalidateCursor(TextView.java:5131)
at android.widget.TextView.spanChange(TextView.java:8090)
at android.widget.TextView$ChangeWatcher.onSpanAdded(TextView.java:10186)
at android.text.SpannableStringInternal.sendSpanAdded(SpannableStringInternal.java:315)
at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:138)
at android.text.SpannableString.setSpan(SpannableString.java:46)
at android.text.SpannableStringInternal.(SpannableStringInternal.java:52)
at android.text.SpannableString.(SpannableString.java:30)
at android.text.SpannableString.valueOf(SpannableString.java:41)
at org.matrix.android.sdk.internal.session.room.send.pills.TextPillsUtils.transformPills(TextPillsUtils.kt:1)
at org.matrix.android.sdk.internal.session.room.send.LocalEchoEventFactory.createTextContent(LocalEchoEventFactory.kt:4)
at org.matrix.android.sdk.internal.session.room.send.LocalEchoEventFactory.createTextEvent(LocalEchoEventFactory.kt:4)
at org.matrix.android.sdk.internal.session.room.send.DefaultSendService.sendTextMessage(DefaultSendService.kt:1)
at org.matrix.android.sdk.internal.session.room.DefaultRoom.sendTextMessage(DefaultRoom.kt)
at org.matrix.android.sdk.api.session.room.send.SendService$DefaultImpls.sendTextMessage$default(SendService.kt:1)
at im.vector.app.features.home.room.detail.composer.MessageComposerViewModel$handleSendMessage$1.invoke(MessageComposerViewModel.kt:15)
at im.vector.app.features.home.room.detail.composer.MessageComposerViewModel$handleSendMessage$1.invoke(MessageComposerViewModel.kt:1)

marking as uncommon due to occurring with a 3rd party keyboard , if this is reproducible in more scenarios I'll raise the occurrence