|
|
|
@ -527,10 +527,12 @@ object AgentService : CoroutineScope { |
|
|
|
try { |
|
|
|
delay(idleSeconds * 1000L) |
|
|
|
Log.d(TAG, "空闲检测触发自动停止,isActive: $isActive, isRecognitionActive: $isRecognitionActive, isTtsSpeaking: $isTtsSpeaking, isAiStreaming: $isAiStreaming, mode: $mode") |
|
|
|
if (isActive && isRecognitionActive && !isTtsSpeaking && !isAiStreaming && mode != "phone_call") { |
|
|
|
if (isActive && isRecognitionActive && !isTtsSpeaking && !isAiStreaming) { |
|
|
|
Log.d(TAG, "空闲检测触发自动停止,模式: $currentRecognitionMode") |
|
|
|
BleService.closeCodec() |
|
|
|
stopRecognition() |
|
|
|
BleService.closeCodec() |
|
|
|
if (mode != "phone_call"){ |
|
|
|
stopRecognition() |
|
|
|
} |
|
|
|
sendEvent( |
|
|
|
"auto_stop", |
|
|
|
mapOf( |
|
|
|
@ -540,10 +542,6 @@ object AgentService : CoroutineScope { |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
if (isActive && isRecognitionActive && !isTtsSpeaking && !isAiStreaming && mode == "phone_call") { |
|
|
|
Log.d(TAG, "空闲检测触发自动停止,模式: $currentRecognitionMode") |
|
|
|
startRecognition(false, mode) |
|
|
|
} |
|
|
|
} catch (e: CancellationException) { |
|
|
|
// 协程被取消,正常行为 |
|
|
|
} catch (e: Exception) { |
|
|
|
|