add voice ui status listener
This commit is contained in:
@@ -259,6 +259,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_POWER_CONNECTED, this );
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_POWER_DISCONNECTED, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_NWD_ACC, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_UI, this );
|
||||
}
|
||||
|
||||
private void registerAIReceiver( Context context ) {
|
||||
@@ -285,6 +286,8 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
// acc On
|
||||
filter.addAction( Intent.ACTION_POWER_CONNECTED );
|
||||
filter.addAction( Intent.ACTION_POWER_DISCONNECTED );
|
||||
// 小智语音
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_UI );
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
Logger.i( TAG, "register voice receiver." );
|
||||
@@ -612,6 +615,13 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( command ) ) {
|
||||
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
|
||||
mStatusManager.setAccStatus( getModuleName(), state == 1 );
|
||||
} else if ( MogoReceiver.ACTION_VOICE_UI.equals( command ) ) {
|
||||
String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS );
|
||||
if ( TextUtils.equals( val, MogoReceiver.VALUE_DISMISS ) ) {
|
||||
mStatusManager.setVoiceUIShow( TAG, false );
|
||||
} else if ( TextUtils.equals( val, MogoReceiver.VALUE_SHOW ) ) {
|
||||
mStatusManager.setVoiceUIShow( TAG, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
// 诺威达 acc 状态
|
||||
public static final String PARAM_ACC_STATUS = "extra_mcu_state";
|
||||
|
||||
// 小智语音唤醒UI
|
||||
public static final String ACTION_VOICE_UI = "com.zhidao.xiaozhi.wake.status";
|
||||
public static final String PARRAM_WAKE_STATUS = "WAKE_STATUS";
|
||||
public static final String VALUE_DISMISS = "dismiss";
|
||||
public static final String VALUE_SHOW = "show";
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
public MogoReceiver( Context context ) {
|
||||
|
||||
Reference in New Issue
Block a user