[3.3.0]merge
This commit is contained in:
@@ -18,11 +18,6 @@ public class MogoModule {
|
||||
*/
|
||||
private String mName;
|
||||
|
||||
/**
|
||||
* 广播接收者
|
||||
*/
|
||||
private String mBroadcastAction;
|
||||
|
||||
/**
|
||||
* @param path 模块加载路径
|
||||
* @param name 模块名称
|
||||
@@ -51,13 +46,5 @@ public class MogoModule {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getBroadcastAction() {
|
||||
return mBroadcastAction;
|
||||
}
|
||||
|
||||
public MogoModule setBroadcastAction( String broadcastAction ) {
|
||||
this.mBroadcastAction = broadcastAction;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ import java.util.List;
|
||||
*/
|
||||
public class MogoModulePaths {
|
||||
|
||||
private static final List<MogoModule> mMogoModules = new ArrayList<>();
|
||||
|
||||
// 不需要启动APP也能运行的模块
|
||||
private static final List<MogoModule> mMogoBaseModules = new ArrayList<>();
|
||||
|
||||
@@ -22,18 +20,6 @@ public class MogoModulePaths {
|
||||
|
||||
private static final List<MogoModule> mModuleFunctionServers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
public static void addModule(MogoModule module) {
|
||||
if (module == null || TextUtils.isEmpty(module.getPath().replace(" ", ""))) {
|
||||
throw new IllegalArgumentException("module path can't be empty or null or blank");
|
||||
}
|
||||
mMogoModules.add(module);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模块功能
|
||||
*
|
||||
@@ -70,10 +56,6 @@ public class MogoModulePaths {
|
||||
mMogoBaseModules.add(module);
|
||||
}
|
||||
|
||||
public static List<MogoModule> getModules() {
|
||||
return mMogoModules;
|
||||
}
|
||||
|
||||
public static List<MogoModule> getBaseModules() {
|
||||
return mMogoBaseModules;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,9 @@ import com.mogo.commons.module.intent.IntentManager;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.module.receiver.MogoReceiver;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.config.CloudPoiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MogoServices implements IMogoIntentListener {
|
||||
|
||||
@@ -43,7 +40,6 @@ public class MogoServices implements IMogoIntentListener {
|
||||
public void init(Context context) {
|
||||
mContext = context;
|
||||
MogoStatusManager.getInstance().setAIAssistReady(TAG, AIAssist.getInstance(mContext).hasFlush());
|
||||
CloudPoiManager.getInstance().updateFromConfig(context);
|
||||
|
||||
registerMogoReceiver(context);
|
||||
|
||||
@@ -51,30 +47,15 @@ public class MogoServices implements IMogoIntentListener {
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_UI, this);
|
||||
mIntentManager.registerIntentListener(MogoReceiver.ACTION_VOICE_READY, this);
|
||||
mIntentManager.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, this);
|
||||
|
||||
Intent intent = new Intent("com.freedom.ser.ACTION");
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void registerMogoReceiver(Context context) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
List<MogoModule> modules = MogoModulePaths.getModules();
|
||||
if (modules.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MogoReceiver receiver = new MogoReceiver(context);
|
||||
IntentFilter filter = new IntentFilter();
|
||||
if (!modules.isEmpty()) {
|
||||
for (MogoModule module : modules) {
|
||||
if (TextUtils.isEmpty(module.getBroadcastAction())) {
|
||||
continue;
|
||||
}
|
||||
filter.addAction(module.getBroadcastAction());
|
||||
}
|
||||
}
|
||||
|
||||
filter.addAction(MogoReceiver.VOICE_ACTION);
|
||||
// 小智语音
|
||||
filter.addAction(MogoReceiver.ACTION_VOICE_UI);
|
||||
|
||||
@@ -31,11 +31,6 @@ public class IntentHandlerFactory {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private final Map< String, IntentHandler > mHandlers = new HashMap<>();
|
||||
|
||||
private final IntentHandler DEFAULT = new EmptyIntentHandler();
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.module.intent.IntentManager;
|
||||
|
||||
@@ -45,9 +46,11 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
if (TextUtils.equals(VOICE_ACTION, action)) {
|
||||
String cmd = intent.getStringExtra(PARAM_COMMAND);
|
||||
if (!TextUtils.isEmpty(cmd)) {
|
||||
Log.i("emArrow","MogoReceiver cmd:" + cmd);
|
||||
mMogoIntentManager.invoke(cmd, intent);
|
||||
}
|
||||
} else {
|
||||
Log.i("emArrow","MogoReceiver action:" + action);
|
||||
mMogoIntentManager.invoke(action, intent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user