From 676cd588524b211f4a07c587cb9deef39063d16b Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Tue, 1 Dec 2020 15:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AF=AD=E9=9F=B3sdk?= =?UTF-8?q?=E6=B3=A8=E9=94=80=E6=97=B6=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../roadcondition/service/VoiceController.kt | 7 ++++++- .../src/main/java/com/mogo/tts/zhi/ZhiTTS.java | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/VoiceController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/VoiceController.kt index c37f8a140d..556ad10664 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/VoiceController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/VoiceController.kt @@ -2,6 +2,7 @@ package com.zhidao.roadcondition.service import com.mogo.commons.AbsMogoApplication import com.zhidao.auto.platform.voice.VoiceClient +import java.lang.Exception /** * @description 声音控制类 @@ -45,7 +46,11 @@ object VoiceController { * @param customType 命令 */ fun unRegisterCustomWakeupCmd(customType: String) { - voiceClient.unRegisterCustomWakeupCmd(customType) + try { + voiceClient.unRegisterCustomWakeupCmd(customType) + } catch (e:Exception){ + + } } /** diff --git a/tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java b/tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java index 808886f611..c2670b9f89 100644 --- a/tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java +++ b/tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java @@ -45,7 +45,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener { Logger.d( TAG, "release" ); if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) { for ( String cmd : mCmdMap.keySet() ) { - mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + try { + mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + } catch ( Exception e ) { + } } } mQAndAMap.clear(); @@ -314,7 +317,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener { */ public synchronized void unregisterUnWakeupCommand( String cmd ) { mCmdMap.remove( cmd ); - mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + try { + mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + } catch ( Exception e ) { + } mCacheUnWakeupCommands.remove( cmd ); } @@ -331,7 +337,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener { } if ( callBacks.isEmpty() ) { mCmdMap.remove( cmd ); - mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + try { + mVoiceClient.unRegisterCustomWakeupCmd( cmd ); + } catch ( Exception e ) { + } mCacheUnWakeupCommands.remove( cmd ); } }