Skip to content

armgit / andee

Public Imported from GitHub
0

Andee lives on your phone or Mac and uses any app like you do—no integrations, no root, any model; memory and passwords never leave your device | Andee 住进你的手机或 Mac,像你一样操作任何 App——无需集成、无需 Root、支持任意模型,记忆和密码绝不离开设备。

fix: suppress delayed voice error cards after exit

李融607a6ec24977
diff --git a/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt b/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
index 65fd59a..f73bf1c 100644
--- a/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
+++ b/app/src/main/java/net/kuafuai/andee/BodyCoreService.kt
@@ -1206,6 +1206,13 @@ class BodyCoreService : Service() {
* have left: the failure outlives the card timing out.
*/
private fun reportVoiceFailure(msg: String) {
+ // Serialize the error card with exit: an ASR callback can arrive while
+ // its socket is being closed, after the user has already left.
+ if (Looper.myLooper() != Looper.getMainLooper()) {
+ ui.post { reportVoiceFailure(msg) }
+ return
+ }
+ if (exitRequested) return
android.util.Log.w("Body", "voice failed: $msg")
if (voiceFailureReported) return
voiceFailureReported = true
@@ -1291,6 +1298,7 @@ class BodyCoreService : Service() {
* device that can be used.
*/
private fun showAnswerAsCard() {
+ if (exitRequested) return
val answer = lastAnswer ?: return
if (!window.isCompact()) return
net.kuafuai.andee.ui.CardUi.alert(answer) { }