dicio-android icon indicating copy to clipboard operation
dicio-android copied to clipboard

ExternalPopupInputDevice Error

Open uultimaa7 opened this issue 7 months ago • 3 comments

Receiving the "error loading" message after wake word activation, using Whisper as voice input.

[04-25 00:42:44.422 10235:8505:8505 E/ExternalPopupInputDevice] at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1849) at android.app.Activity.dispatchTouchEvent(Activity.java:4011) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:423) at android.view.View.dispatchPointerEvent(View.java:14212) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5649) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5452) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4955) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5008) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4974) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5114) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4982) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5171) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4955) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5008) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4974) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4982) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4955) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7672) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7641) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7602) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7797) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:336) at android.os.Looper.loop(Looper.java:174) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

uultimaa7 avatar Apr 24 '25 23:04 uultimaa7

[04-25 00:42:43.656 1000:1014:1014 E/Layer] [Surface(name=AppWindowToken{30afe77 token=Token{d644876 ActivityRecord{4d28f11 u0 org.stypox.dicio/.MainActivity t178}}})/@0x1ca63b2 - animation-leash#0] No local sync point found

[04-25 00:42:44.422 10235:8505:8505 E/ExternalPopupInputDevice] Could not start STT activity java.lang.IllegalArgumentException: An activity for result request is already active at org.stypox.dicio.di.ActivityForResultManager.launch(ActivityForResultManager.kt:37) at org.stypox.dicio.io.input.external_popup.ExternalPopupInputDevice.startListening(ExternalPopupInputDevice.kt:135) at org.stypox.dicio.io.input.external_popup.ExternalPopupInputDevice.onClick(ExternalPopupInputDevice.kt:92) at org.stypox.dicio.di.SttInputDeviceWrapperImpl.onClick(SttInputDeviceWrapper.kt:168) at org.stypox.dicio.ui.home.HomeScreenKt.HomeScreen$lambda$6$lambda$5(HomeScreen.kt:101) at org.stypox.dicio.ui.home.HomeScreenKt.$r8$lambda$9JBlhe67jU_I92rVStFJ_qe5_HM(Unknown Source:0) at org.stypox.dicio.ui.home.HomeScreenKt$$ExternalSyntheticLambda3.invoke(D8$$SyntheticClass:0) at androidx.compose.foundation.ClickableNode$clickPointerInput$3.invoke-k-4lQ0M(Clickable.kt:639) at androidx.compose.foundation.ClickableNode$clickPointerInput$3.invoke(Clickable.kt:633) at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(TapGestureDetector.kt:255) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:175) at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:164) at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:466) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:500) at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:489) at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:364) at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:719) at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(SuspendingPointerInputFilter.kt:598) at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:620) at androidx.compose.foundation.AbstractClickableNode.onPointerEvent-H0pRuoY(Clickable.kt:1044) at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:387) at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:373) at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:373) at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:373) at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:229) at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:144) at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:120) at androidx.compose.ui.platform.AndroidComposeView.sendMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1994) at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1945) at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:1829) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:465)

uultimaa7 avatar Apr 24 '25 23:04 uultimaa7

This should be possible. Is there something else I need to do other than the steps listed in v3.0 release notes? This is on Android 10.

Allow using external Speech-To-Text apps as input devices #294 (thanks @woheller69!)

Select this in the settings as a replacement for Vosk, which often does not provide good enough Speech-To-Text

Any app that opens a popup when receiving the ACTION_RECOGNIZE_SPEECH intent should work

Examples of apps that are known to work: woheller69's whisperIME, Kõnele, Futo Voice Input but even "Speech Recognition and Synthesis from Google"

uultimaa7 avatar Apr 25 '25 11:04 uultimaa7

I have the same issue. Running Dicio 3.1 with Whisper IME 3.3 on CalyxOS.

Unb0rn avatar Jun 23 '25 17:06 Unb0rn

Thanks for reporting, this might be related to a hack I used, see https://github.com/Stypox/dicio-android/issues/311#issuecomment-3037064029 . The error message says "An activity for result request is already active", which likely means there is a bug that causes the activity result requester to issue a request twice or something like that. As I can't reproduce, any help with fixing is very much appreciated.

Stypox avatar Jul 04 '25 21:07 Stypox

I think the error message is correct. The app works fine once it's launched, but then, closing it and re-opening causes this "error loading" thing. Force closing it through the app settings and re-opening solves the problem until next close. Maybe some service in background doesn't stop doing something?

Unb0rn avatar Jul 05 '25 07:07 Unb0rn

Same issue on my end on GrapheneOS.

The app works fine once it's launched, but then, closing it and re-opening causes this "error loading" thing. Force closing it through the app settings and re-opening solves the problem until next close.

This is consistent with my experience and debugging.

nwithan8 avatar Sep 05 '25 16:09 nwithan8

Originally posted by @RastislavKish in #344

Whisper loading error when using assistant button

Hello,

first of all, thank you for developing Dicio! 😁 As the proprietary solutions are getting more and more intrusive, I think having a privacy-respecting, open-source voice assistant is now more important than ever.

I'm using Dicio 3.2 setup as my system assistant together with Whisper+ IME from F-Droid. It works quite well, but unfortunately only if I use it from the app. If I press the assistant button on my phone, it works the first time, but afterwards the app displays an STT loading error. I need to terminate the app through the system settings to make it work again.

Reproduction steps

With Dicio setup as the system assistant and to use an external STT, Whisper+ IME in this case:

  1. Press the assistant button. Dicio launches and recognition starts normally. Ask "What time is it?"
  2. Press the back button to return back to the system.
  3. Press the assistant button again.

Expected behavior

The recognition starts as usual, like in step 1.

Actual behavior

The app displays "Error loading" where the "Start listening" button usually is, and no recognition takes place.

Note this bug does not occur when launching the app from the app menu and using the start listening button.

Error log

Looking at the Android log, I found the following from Dicio:

E ExternalPopupInputDevice: Could not start STT activity
E ExternalPopupInputDevice: java.lang.IllegalStateException: Attempting to launch an unregistered ActivityResultLauncher with contract androidx.activity.result.contract.ActivityResultContracts$StartActivityForResult@5c511b2 and input Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }. You must ensure the ActivityResultLauncher is registered before calling launch().
E ExternalPopupInputDevice: 	at androidx.activity.result.ActivityResultRegistry$register$2.launch(ActivityResultRegistry.kt:123)
E ExternalPopupInputDevice: 	at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.kt:37)
E ExternalPopupInputDevice: 	at org.stypox.dicio.di.ActivityForResultManager.launch(ActivityForResultManager.kt:41)
E ExternalPopupInputDevice: 	at org.stypox.dicio.io.input.external_popup.ExternalPopupInputDevice.startListening(ExternalPopupInputDevice.kt:135)
E ExternalPopupInputDevice: 	at org.stypox.dicio.io.input.external_popup.ExternalPopupInputDevice.tryLoad(ExternalPopupInputDevice.kt:79)
E ExternalPopupInputDevice: 	at org.stypox.dicio.di.SttInputDeviceWrapperImpl.tryLoad(SttInputDeviceWrapper.kt:158)
E ExternalPopupInputDevice: 	at org.stypox.dicio.MainActivity.onAssistIntentReceived(MainActivity.kt:64)
E ExternalPopupInputDevice: 	at org.stypox.dicio.MainActivity.onCreate(MainActivity.kt:116)
E ExternalPopupInputDevice: 	at android.app.Activity.performCreate(Activity.java:8897)
E ExternalPopupInputDevice: 	at android.app.Activity.performCreate(Activity.java:8859)
E ExternalPopupInputDevice: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1470)
E ExternalPopupInputDevice: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4039)
E ExternalPopupInputDevice: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4217)
E ExternalPopupInputDevice: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
E ExternalPopupInputDevice: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
E ExternalPopupInputDevice: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:99)
E ExternalPopupInputDevice: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2630)
E ExternalPopupInputDevice: 	at android.os.Handler.dispatchMessage(Handler.java:106)
E ExternalPopupInputDevice: 	at android.os.Looper.loopOnce(Looper.java:222)
E ExternalPopupInputDevice: 	at android.os.Looper.loop(Looper.java:314)
E ExternalPopupInputDevice: 	at android.app.ActivityThread.main(ActivityThread.java:8788)
E ExternalPopupInputDevice: 	at java.lang.reflect.Method.invoke(Native Method)
E ExternalPopupInputDevice: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
E ExternalPopupInputDevice: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090)

Environment

Xiaomi Redmi note 12 pro 5G, Android 14, Dicio 3.2, Whisper+ IME version 1.3

Stypox avatar Sep 21 '25 20:09 Stypox