File tree Expand file tree Collapse file tree
main/java/ai/openclaw/app
test/java/ai/openclaw/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1378,7 +1378,7 @@ class NodeRuntime(
13781378 refreshExecApprovalsFromGateway()
13791379 }
13801380 } else {
1381- stopVoiceCaptureForBackground( )
1381+ setVoiceCaptureMode( VoiceCaptureMode . Off )
13821382 publishNodePresenceAliveBeacon(NodePresenceAliveBeacon .Trigger .Background , throttleRecentSuccess = true )
13831383 }
13841384 }
@@ -1875,11 +1875,6 @@ class NodeRuntime(
18751875 setVoiceCaptureMode(VoiceCaptureMode .Off )
18761876 }
18771877
1878- private fun stopVoiceCaptureForBackground () {
1879- if (_voiceCaptureMode .value == VoiceCaptureMode .Off ) return
1880- setVoiceCaptureMode(VoiceCaptureMode .Off )
1881- }
1882-
18831878 private fun stopActiveVoiceSession () {
18841879 talkMode.ttsOnAllResponses = false
18851880 talkMode.setEnabled(false )
Original file line number Diff line number Diff line change @@ -666,6 +666,24 @@ class GatewayBootstrapAuthTest {
666666 assertFalse(readField<MutableStateFlow <Boolean >>(runtime, " externalAudioCaptureActive" ).value)
667667 }
668668
669+ @Test
670+ fun backgroundingStopsActiveTalkModeCapture () {
671+ val app = RuntimeEnvironment .getApplication()
672+ shadowOf(app).grantPermissions(Manifest .permission.RECORD_AUDIO )
673+ val runtime = NodeRuntime (app)
674+
675+ runtime.setTalkModeEnabled(true )
676+ assertEquals(VoiceCaptureMode .TalkMode , runtime.voiceCaptureMode.value)
677+
678+ runtime.setForeground(false )
679+
680+ assertEquals(VoiceCaptureMode .Off , runtime.voiceCaptureMode.value)
681+ assertFalse(readField<MutableStateFlow <Boolean >>(runtime, " externalAudioCaptureActive" ).value)
682+ val talkMode = readField<Lazy <TalkModeManager >>(runtime, " talkMode\$ delegate" ).value
683+ assertFalse(talkMode.ttsOnAllResponses)
684+ assertFalse(talkMode.isEnabled.value)
685+ }
686+
669687 private fun waitForGatewayTrustPrompt (runtime : NodeRuntime ): NodeRuntime .GatewayTrustPrompt {
670688 repeat(50 ) {
671689 runtime.pendingGatewayTrust.value?.let { return it }
You can’t perform that action at this time.
0 commit comments