优化后的代码
This commit is contained in:
parent
102afa291d
commit
c62a0c48d6
@ -261,16 +261,6 @@ class VoiceController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================= Idle 超时 ================= */
|
|
||||||
|
|
||||||
fun checkIdleTimeout() {
|
|
||||||
if (state != VoiceState.WAIT_SPEECH) return
|
|
||||||
if (waitSpeechFailStartMs == 0L) return
|
|
||||||
if (System.currentTimeMillis() - waitSpeechFailStartMs > idleTimeoutSeconds * 1000) {
|
|
||||||
Log.d(TAG, "⏱ WAIT_SPEECH idle timeout → WAIT_WAKEUP")
|
|
||||||
resetAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ================= Reset ================= */
|
/* ================= Reset ================= */
|
||||||
|
|
||||||
|
|||||||
@ -303,7 +303,6 @@ class MainActivity : BaseViewModelActivity<ActivityMainBinding, MainViewModel>()
|
|||||||
|
|
||||||
voiceController?.acceptAudio(raw)
|
voiceController?.acceptAudio(raw)
|
||||||
}
|
}
|
||||||
voiceController?.checkIdleTimeout()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user