Skip to content

Commit

Permalink
fix(core.runtime): 去掉Application OnCreate时多余的一次BroadcastReceiver实例化
Browse files Browse the repository at this point in the history
并且插件Application OnCreate时构造静态广播BroadcastReceiver时应该由外部注入的AppComponentFactory构造。

fix Tencent#1034
  • Loading branch information
shifujun committed Aug 26, 2022
1 parent 6614007 commit abb72db
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ public void onCreate() {
for (Map.Entry<String, String[]> entry : mBroadcasts.entrySet()) {
try {
String receiverClassname = entry.getKey();
Class<?> clazz = mPluginClassLoader.loadClass(receiverClassname);
BroadcastReceiver receiver = ((BroadcastReceiver) clazz.newInstance());
mAppComponentFactory.instantiateReceiver(mPluginClassLoader, receiverClassname, null);
BroadcastReceiver receiver = mAppComponentFactory.instantiateReceiver(
mPluginClassLoader,
receiverClassname,
null);

IntentFilter intentFilter = new IntentFilter();
String[] receiverActions = entry.getValue();
Expand Down

0 comments on commit abb72db

Please sign in to comment.