【buyuntao】sendIntent2Process code structure optimization, startPluginProcess lock optimization.

This commit is contained in:
buyuntao 2018-11-14 15:37:36 +08:00
parent bdcb90d8b3
commit bc2e700240

View File

@ -177,9 +177,7 @@ class PmHostSvc extends IPluginHost.Stub {
@Override
public IPluginClient startPluginProcess(String plugin, int process, PluginBinderInfo info) throws RemoteException {
synchronized (this) {
return mPluginMgr.startPluginProcessLocked(plugin, process, info);
}
return mPluginMgr.startPluginProcessLocked(plugin, process, info);
}
@Override
@ -340,7 +338,6 @@ class PmHostSvc extends IPluginHost.Stub {
syncInstalledPluginInfo2All(pi);
}
return pi;
}
@ -484,28 +481,27 @@ class PmHostSvc extends IPluginHost.Stub {
if (LOG) {
LogDebug.d(PLUGIN_TAG, "sendIntent2Process target=" + target + " intent=" + intent);
}
if (TextUtils.equals(target, IPC.getPluginHostProcessName())) {
intent.setExtrasClassLoader(getClass().getClassLoader());
if (sync) {
LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
} else {
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
}
sendIntent2PluginHostProcess(intent, sync);
return;
}
if (TextUtils.isEmpty(target)) {
intent.setExtrasClassLoader(getClass().getClassLoader());
if (sync) {
LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
} else {
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
}
sendIntent2PluginHostProcess(intent, sync);
}
PluginProcessMain.sendIntent2Process(target, intent, sync);
}
private void sendIntent2PluginHostProcess(Intent intent, boolean sync) {
intent.setExtrasClassLoader(getClass().getClassLoader());
if (sync) {
LocalBroadcastHelper.sendBroadcastSyncUi(mContext, intent);
} else {
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
}
}
@Override
public void sendIntent2Plugin(String target, Intent intent) throws RemoteException {
sendIntent2Plugin(target, intent, false);