-
diff --git a/app/functions/tts.gradle b/app/functions/tts.gradle
index 4d0abe06d9..cffb706413 100644
--- a/app/functions/tts.gradle
+++ b/app/functions/tts.gradle
@@ -8,15 +8,15 @@ project.dependencies {
d8xxImplementation rootProject.ext.dependencies.ttszhi
d80xImplementation rootProject.ext.dependencies.ttszhi
f8xxImplementation rootProject.ext.dependencies.ttszhi
- fPadLenovoImplementation rootProject.ext.dependencies.ttszhi
+ fPadLenovoImplementation rootProject.ext.dependencies.ttspad
f80xImplementation rootProject.ext.dependencies.ttszhi
f8AmapImplementation rootProject.ext.dependencies.ttszhi
em4Implementation rootProject.ext.dependencies.ttszhi
e8xxImplementation rootProject.ext.dependencies.ttszhi
fochtaxiImplementation rootProject.ext.dependencies.ttszhi
fochbusImplementation rootProject.ext.dependencies.ttszhi
- fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.ttszhi
- fPadLenovoOchBusImplementation rootProject.ext.dependencies.ttszhi
+ fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.ttspad
+ fPadLenovoOchBusImplementation rootProject.ext.dependencies.ttspad
phoneImplementation rootProject.ext.dependencies.ttszhi
} else {
bydautoImplementation project(':tts:tts-di')
@@ -27,15 +27,15 @@ project.dependencies {
d8xxImplementation project(':tts:tts-zhi')
d80xImplementation project(':tts:tts-zhi')
f8xxImplementation project(':tts:tts-zhi')
- fPadLenovoImplementation project(':tts:tts-zhi')
+ fPadLenovoImplementation project(':tts:tts-pad')
f80xImplementation project(':tts:tts-zhi')
f8AmapImplementation project(':tts:tts-zhi')
em4Implementation project(':tts:tts-zhi')
e8xxImplementation project(':tts:tts-zhi')
fochtaxiImplementation project(':tts:tts-zhi')
fochbusImplementation project(':tts:tts-zhi')
- fPadLenovoOchTaxiImplementation project(':tts:tts-zhi')
- fPadLenovoOchBusImplementation project(':tts:tts-zhi')
+ fPadLenovoOchTaxiImplementation project(':tts:tts-pad')
+ fPadLenovoOchBusImplementation project(':tts:tts-pad')
phoneImplementation project(':tts:tts-zhi')
}
}
\ No newline at end of file
diff --git a/config.gradle b/config.gradle
index 45564447f1..78f1bf7a1f 100644
--- a/config.gradle
+++ b/config.gradle
@@ -216,6 +216,7 @@ ext {
ttsbase : "com.mogo.tts:tts-base:${TTS_BASE_VERSION}",
ttsdi : "com.mogo.tts:tts-di:${TTS_DI_VERSION}",
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
+ ttspad : "com.mogo.tts:tts-pad:${TTS_ZHI_VERSION}",
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
// mogomodulemachinevision : "com.mogo.module:module-machine-vision:${MOGO_MODULES_MVISION_VERSION}",
diff --git a/gradle.properties b/gradle.properties
index 6257d2ee0d..0da7be3e55 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -127,6 +127,7 @@ CRASHREPORT_UPGRADE_VERSION=2.0.12
TTS_BASE_VERSION=2.0.12
TTS_DI_VERSION=2.0.12
TTS_ZHI_VERSION=2.0.12
+TTS_PAD_VERSION=2.0.12
TTS_NOOP_VERSION=2.0.12
# 自研地图
MAP_CUSTOM_VERSION=2.0.12
diff --git a/settings.gradle b/settings.gradle
index 108f29c378..2df7d09d03 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -9,6 +9,7 @@ include ':foudations:mogo-base-websocket-sdk'
include ':tts:tts-base'
include ':tts:tts-di'
include ':tts:tts-zhi'
+include ':tts:tts-pad'
include ':tts:tts-noop'
include ':test:crashreport'
include ':test:crashreport-bugly'
diff --git a/tts/tts-pad/.gitignore b/tts/tts-pad/.gitignore
new file mode 100644
index 0000000000..42afabfd2a
--- /dev/null
+++ b/tts/tts-pad/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/tts/tts-pad/build.gradle b/tts/tts-pad/build.gradle
new file mode 100644
index 0000000000..6c10fe8722
--- /dev/null
+++ b/tts/tts-pad/build.gradle
@@ -0,0 +1,54 @@
+apply plugin: 'com.android.library'
+apply plugin: 'com.alibaba.arouter'
+
+android {
+ compileSdkVersion rootProject.ext.android.compileSdkVersion
+ // buildToolsVersion rootProject.ext.android.buildToolsVersion
+ defaultConfig {
+ minSdkVersion rootProject.ext.android.minSdkVersion
+ targetSdkVersion rootProject.ext.android.targetSdkVersion
+ versionCode Integer.valueOf(VERSION_CODE)
+ versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+
+ javaCompileOptions {
+ annotationProcessorOptions {
+ arguments = [AROUTER_MODULE_NAME: project.getName()]
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+ implementation rootProject.ext.dependencies.androidxappcompat
+ implementation rootProject.ext.dependencies.arouter
+ annotationProcessor rootProject.ext.dependencies.aroutercompiler
+
+ api rootProject.ext.dependencies.aiassist
+ api rootProject.ext.dependencies.aiassistReplace
+
+ if (Boolean.valueOf(RELEASE)) {
+ implementation rootProject.ext.dependencies.ttsbase
+ implementation rootProject.ext.dependencies.mogoutils
+ } else {
+ implementation project(":tts:tts-base")
+ implementation project(":foudations:mogo-utils")
+ }
+}
+
+apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
\ No newline at end of file
diff --git a/tts/tts-pad/consumer-rules.pro b/tts/tts-pad/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tts/tts-pad/gradle.properties b/tts/tts-pad/gradle.properties
new file mode 100644
index 0000000000..5d81ca81ca
--- /dev/null
+++ b/tts/tts-pad/gradle.properties
@@ -0,0 +1,3 @@
+GROUP=com.mogo.tts
+POM_ARTIFACT_ID=tts-pad
+VERSION_CODE=1
diff --git a/tts/tts-pad/proguard-rules.pro b/tts/tts-pad/proguard-rules.pro
new file mode 100644
index 0000000000..481bb43481
--- /dev/null
+++ b/tts/tts-pad/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/tts/tts-pad/src/main/AndroidManifest.xml b/tts/tts-pad/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..70631ddf64
--- /dev/null
+++ b/tts/tts-pad/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+ /
+
\ No newline at end of file
diff --git a/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java b/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java
new file mode 100644
index 0000000000..3598d85479
--- /dev/null
+++ b/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java
@@ -0,0 +1,480 @@
+package com.mogo.tts.pad;
+
+import android.content.Context;
+import android.content.Intent;
+import android.text.TextUtils;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.mogo.tts.base.IMogoTTS;
+import com.mogo.tts.base.IMogoTTSCallback;
+import com.mogo.tts.base.MogoTTSConstants;
+import com.mogo.tts.base.PreemptType;
+import com.mogo.utils.AppUtils;
+import com.mogo.utils.logger.Logger;
+import com.zhidao.auto.platform.voice.VoiceClient;
+import com.zhidao.voicesdk.MogoVoiceManager;
+import com.zhidao.voicesdk.MogoVoiceManagerImpl;
+import com.zhidao.voicesdk.callback.OnConnStatusListener;
+import com.zhidao.voicesdk.callback.OnTtsListener;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/10/12
+ *
+ * 描述
+ */
+@Route( path = MogoTTSConstants.API_PATH )
+class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
+
+ private static final String TAG = "ZhiTTS";
+ private String mLastQAndASpeakText;
+
+ private boolean mHasFlush = false;
+ private boolean mInitReady = false;
+ private Context mContext;
+
+ public synchronized void release() {
+ Logger.d( TAG, "release" );
+ if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
+ for ( String cmd : mCmdMap.keySet() ) {
+ try {
+ mVoiceClient.unRegisterCustomWakeupCmd( cmd );
+ } catch ( Exception e ) {
+ }
+ }
+ }
+ mQAndAMap.clear();
+ mVoiceClient.release();
+ mSpeakVoiceMap.clear();
+ mCacheUnWakeupCommands.clear();
+ mContext = null;
+ }
+
+ private VoiceClient mVoiceClient;
+ private MogoVoiceManager mogoVoiceManager;
+ // 免唤醒指令
+ private Map< String, List< IMogoTTSCallback > > mCmdMap = new HashMap<>();
+ // 问答指令
+ private Map< String, IMogoTTSCallback > mQAndAMap = new HashMap<>();
+ // 单独的语音播放
+ private Map< String, IMogoTTSCallback > mSpeakVoiceMap = new HashMap<>();
+
+ private Map< String, String[] > mCacheUnWakeupCommands = new ConcurrentHashMap<>();
+
+ private void initFlushStatus() {
+ if ( !mHasFlush ) {
+ mHasFlush = isVoiceServiceReady( mContext );
+ }
+ }
+
+ /**
+ * 初始化
+ */
+ private void initSpeech( Context context ) {
+ mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
+ mogoVoiceManager.init( context, new OnConnStatusListener() {
+ @Override
+ public void onSuccess() {
+ mInitReady = true;
+ }
+
+ @Override
+ public void onFailed() {
+
+ }
+ } );
+ }
+
+ /**
+ * 是否语音注册成功
+ *
+ * @return
+ */
+ @Override
+ public boolean hasFlush() {
+ return mHasFlush;
+ }
+
+ @Override
+ public void onCmdSelected( String cmd ) {
+ if ( !mCmdMap.containsKey( cmd ) ) {
+ return;
+ }
+ Logger.d( TAG, "received command: %s", cmd );
+
+ Iterator< IMogoTTSCallback > iterator = null;
+ try {
+ List< IMogoTTSCallback > cmdCallBacks = mCmdMap.get( cmd );
+ iterator = new ArrayList<>( cmdCallBacks ).iterator();
+ } catch ( Exception e ) {
+
+ }
+ while ( iterator != null && iterator.hasNext() ) {
+ IMogoTTSCallback callBack = iterator.next();
+ if ( callBack != null ) {
+ callBack.onCmdSelected( cmd );
+ }
+ }
+ }
+
+ @Override
+ public void onCmdAction( String speakText ) {
+ if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
+ IMogoTTSCallback cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
+ if ( cmdCallBack != null ) {
+ cmdCallBack.onCmdAction( speakText );
+ }
+ }
+ }
+
+ @Override
+ public void onCmdCancel( String speakText ) {
+ if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
+ IMogoTTSCallback cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
+ if ( cmdCallBack != null ) {
+ cmdCallBack.onCmdCancel( speakText );
+ }
+ }
+ }
+
+ @Override
+ public void onSpeakEnd( String speakText ) {
+ if ( mQAndAMap.containsKey( speakText ) ) {
+ mLastQAndASpeakText = speakText;
+ IMogoTTSCallback cmdCallBack = mQAndAMap.get( speakText );
+ if ( cmdCallBack != null ) {
+ cmdCallBack.onSpeakEnd( speakText );
+ return;
+ }
+ }
+ IMogoTTSCallback callBack = mSpeakVoiceMap.remove( speakText );
+ if ( callBack != null ) {
+ callBack.onSpeakEnd( speakText );
+ }
+ }
+
+ @Override
+ public void onSpeakSelectTimeOut( String speakText ) {
+ if ( mQAndAMap.containsKey( speakText ) ) {
+ if ( TextUtils.equals( speakText, mLastQAndASpeakText ) ) {
+ mLastQAndASpeakText = null;
+ }
+ IMogoTTSCallback cmdCallBack = mQAndAMap.remove( speakText );
+ if ( cmdCallBack != null ) {
+ cmdCallBack.onSpeakSelectTimeOut( speakText );
+ return;
+ }
+ }
+ IMogoTTSCallback callBack = mSpeakVoiceMap.remove( speakText );
+ if ( callBack != null ) {
+ callBack.onSpeakSelectTimeOut( speakText );
+ }
+ }
+
+ /**
+ * 语音播报
+ *
+ * @param text
+ */
+ public void speakTTSVoice( String text, IMogoTTSCallback callBack ) {
+ try {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mSpeakVoiceMap.put( text, callBack );
+ mVoiceClient.speakDefault( text );
+ }
+ } catch ( Exception e ) {
+ }
+ }
+
+ /**
+ * 语音播报
+ *
+ * @param text
+ */
+ public void speakTTSVoice( String text ) {
+ try {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mVoiceClient.speakDefault( text );
+ }
+ } catch ( Exception e ) {
+ }
+ }
+
+ /**
+ * 语音播报
+ *
+ * @param text 播报内容
+ * @param type 播报策略
+ */
+ public void speakTTSVoice( String text, PreemptType type, IMogoTTSCallback callBack ) {
+ try {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mSpeakVoiceMap.put( text, callBack );
+ VoiceClient.PreemptType preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_NONE;
+ if ( type != null ) {
+ switch ( type ) {
+ case PREEMPT_TYPE_NEXT:
+ preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_NEXT;
+ break;
+ case PREEMPT_TYPE_FLUSH:
+ preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_FLUSH;
+ break;
+ case PREEMPT_TYPE_IMMEDIATELY:
+ preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY;
+ break;
+ case PREEMPT_TYPE_IMMEDIATELY_WITHOUT_CANCEL:
+ preemptType = VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE;
+ break;
+ }
+ }
+ mVoiceClient.speakTypeText( text, preemptType );
+ }
+ } catch ( Exception e ) {
+ }
+ }
+
+ /**
+ * 问答类型语音注册:默认确认和取消
+ *
+ * @param tts 播报内容
+ */
+ public void speakQAndACmd( String tts, IMogoTTSCallback callBack ) {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mQAndAMap.put( tts, callBack );
+ mVoiceClient.speakTtsAndRegistCmd( tts );
+ }
+ }
+
+ /**
+ * 问答类型语音注册
+ *
+ * @param tts 播报内容
+ * @param okCmds 确认命令唤醒词
+ * @param cancelCmds 取消命令唤醒词
+ */
+ public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoTTSCallback callBack ) {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mQAndAMap.put( tts, callBack );
+ mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
+ }
+ }
+
+ /**
+ * 注册免唤醒命令
+ *
+ * @param cmd
+ * @param cmdWords
+ * @param callBack
+ */
+ public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoTTSCallback callBack ) {
+ if ( !mCmdMap.containsKey( cmd ) ) {
+ mCmdMap.put( cmd, new ArrayList<>() );
+ }
+ mCmdMap.get( cmd ).add( callBack );
+
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
+ mCacheUnWakeupCommands.remove( cmd );
+ }
+ Logger.i( TAG, "cache un wakeup command2. %s", cmd );
+ mCacheUnWakeupCommands.put( cmd, cmdWords );
+ }
+
+ /**
+ * 注册免唤醒命令
+ *
+ * @param cmd
+ * @param cmdWords
+ */
+ private void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
+ initFlushStatus();
+ if ( mHasFlush ) {
+ mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
+ mCacheUnWakeupCommands.remove( cmd );
+ }
+ Logger.i( TAG, "cache un wakeup command. %s", cmd );
+ mCacheUnWakeupCommands.put( cmd, cmdWords );
+ }
+
+ /**
+ * 注销免唤醒命令
+ *
+ * @param cmd
+ */
+ public synchronized void unregisterUnWakeupCommand( String cmd ) {
+ mCmdMap.remove( cmd );
+ try {
+ mVoiceClient.unRegisterCustomWakeupCmd( cmd );
+ } catch ( Exception e ) {
+ }
+ mCacheUnWakeupCommands.remove( cmd );
+ }
+
+ /**
+ * 注销免唤醒命令
+ *
+ * @param cmd
+ */
+ public synchronized void unregisterUnWakeupCommand( String cmd, IMogoTTSCallback callBack ) {
+ if ( mCmdMap.containsKey( cmd ) ) {
+ List< IMogoTTSCallback > callBacks = mCmdMap.get( cmd );
+ if ( callBacks != null ) {
+ callBacks.remove( callBack );
+ }
+ if ( callBacks.isEmpty() ) {
+ mCmdMap.remove( cmd );
+ try {
+ mVoiceClient.unRegisterCustomWakeupCmd( cmd );
+ } catch ( Exception e ) {
+ }
+ mCacheUnWakeupCommands.remove( cmd );
+ }
+ }
+ }
+
+ public static void startAssistant( Context context ) {
+ startAssistant( context, 1 );
+ }
+
+ /**
+ * @param context
+ * @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入
+ */
+ public static void startAssistant( Context context, int status ) {
+ final Intent intent = new Intent();
+ intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
+ intent.setAction( "pvetec.intent.action.txz.switch" );
+ intent.putExtra( "window_start_cancel", status );
+ intent.putExtra( "extra_switch_type", "window_start_cancel" );
+ Logger.d( TAG, "status = %d", status );
+ context.sendBroadcast( intent );
+ }
+
+ public synchronized void flush() {
+ if ( mCacheUnWakeupCommands.isEmpty() ) {
+ return;
+ }
+ mHasFlush = true;
+ Logger.d( TAG, "flush cache voice command when voice service ready." );
+ final Map< String, String[] > tmp = new HashMap<>( mCacheUnWakeupCommands );
+ for ( String cmd : tmp.keySet() ) {
+ registerUnWakeupCommand( cmd, tmp.get( cmd ) );
+ }
+ }
+
+ private boolean isVoiceServiceReady( Context context ) {
+ if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.zhidao.speech" ) )) {
+ return true;
+ } else if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.txz" ) )
+ && AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.adapter" ) ) ) {
+ Logger.d( TAG, "txz is voiceServiceReady" );
+ return true;
+ }
+ return true;
+ }
+
+ public void speakTTSAndDuck( String text ) {
+ speakTTSAndDuck( text, null );
+ }
+
+ public void speakTTSAndDuck( String text, IMogoTTSCallback callBack ) {
+ try {
+ if ( mInitReady ) {
+ mSpeakVoiceMap.put( text, callBack );
+ mogoVoiceManager.toSpeak( text, -3, this );
+ }
+ } catch ( Exception e ) {
+ }
+ }
+
+ public void shutUp( String ttsId, String text ) {
+ try {
+ mSpeakVoiceMap.remove( text );
+ mogoVoiceManager.shutUp( ttsId );
+ } catch ( Exception e ) {
+
+ }
+ }
+
+ /**
+ * 打断上一条正在播报的语音内容,仅在Speech上生效,TXZ为空实现
+ * 语音SDK生效版本从1.0.8.4版本起
+ */
+ public void breakOffSpeak() {
+ mVoiceClient.breakOffSpeak();
+ }
+
+ public void clearTTSCallback( String text ) {
+ try {
+ mSpeakVoiceMap.remove( text );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onTtsStart( String ttsId, String text ) {
+ IMogoTTSCallback callBack = mSpeakVoiceMap.get( text );
+ if ( callBack != null ) {
+ callBack.onTTSStart( ttsId, text );
+ }
+ }
+
+ @Override
+ public void onTtsFinish( String ttsId, String text ) {
+ IMogoTTSCallback callBack = mSpeakVoiceMap.remove( text );
+ if ( callBack != null ) {
+ callBack.onTTSEnd( ttsId, text );
+ }
+ }
+
+ @Override
+ public void onTtsError( String ttsId, String text ) {
+ IMogoTTSCallback callBack = mSpeakVoiceMap.remove( text );
+ if ( callBack != null ) {
+ callBack.onTTSError( ttsId, text );
+ }
+ }
+
+ @Override
+ public void init( Context context ) {
+ if ( context != null ) {
+ mContext = context.getApplicationContext();
+ mVoiceClient = new VoiceClient( mContext );
+ mVoiceClient.setCallBack( this );
+ initFlushStatus();
+ initSpeech( context );
+ Logger.w( TAG, "voice is ready = %s", mHasFlush );
+ }
+ }
+
+ @Override
+ public void startAIAssist( Context context ) {
+ startAssistant( context, 1 );
+ }
+
+ @Override
+ public void startAIAssist( Context context, int status ) {
+ final Intent intent = new Intent();
+ intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
+ intent.setAction( "pvetec.intent.action.txz.switch" );
+ intent.putExtra( "window_start_cancel", status );
+ intent.putExtra( "extra_switch_type", "window_start_cancel" );
+ Logger.d( TAG, "status = %d", status );
+ context.sendBroadcast( intent );
+ }
+}
diff --git a/tts/tts-zhi/src/main/AndroidManifest.xml b/tts/tts-zhi/src/main/AndroidManifest.xml
index a70d8aa41b..70631ddf64 100644
--- a/tts/tts-zhi/src/main/AndroidManifest.xml
+++ b/tts/tts-zhi/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.mogo.tts.pad">
/
\ No newline at end of file
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/pad/ZhiTTS.java
similarity index 99%
rename from tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java
rename to tts/tts-zhi/src/main/java/com/mogo/tts/pad/ZhiTTS.java
index c2670b9f89..ef0bac205b 100644
--- a/tts/tts-zhi/src/main/java/com/mogo/tts/zhi/ZhiTTS.java
+++ b/tts/tts-zhi/src/main/java/com/mogo/tts/pad/ZhiTTS.java
@@ -1,4 +1,4 @@
-package com.mogo.tts.zhi;
+package com.mogo.tts.pad;
import android.content.Context;
import android.content.Intent;