Disconnect plugins on the main thread.

Fixes: 146033031
Test: atest SystemUITests && manual
Change-Id: Icc5612b2d7129e146ec02df04e473d340b0d8b40
This commit is contained in:
Dave Mankoff
2020-04-27 15:31:56 -04:00
parent cd220824de
commit 308c90f77c

View File

@@ -257,12 +257,8 @@ public class PluginInstanceManager<T extends Plugin> {
if (DEBUG) Log.d(TAG, "queryAll " + mAction);
for (int i = mPlugins.size() - 1; i >= 0; i--) {
PluginInfo<T> plugin = mPlugins.get(i);
mListener.onPluginDisconnected(plugin.mPlugin);
if (!(plugin.mPlugin instanceof PluginFragment)) {
// Only call onDestroy for plugins that aren't fragments, as fragments
// will get the onDestroy as part of the fragment lifecycle.
plugin.mPlugin.onDestroy();
}
mMainHandler.obtainMessage(
mMainHandler.PLUGIN_DISCONNECTED, plugin).sendToTarget();
}
mPlugins.clear();
handleQueryPlugins(null);