Changes to the signature of PluginManagerImpl.

Bug: 194781951
Test: manual
Change-Id: Iafc5232dfdb1cc1c554de925c2f0d2ad5f6439e2
This commit is contained in:
Dave Mankoff 2021-08-13 10:01:42 -04:00
parent 0a39f6daec
commit 13f50b9898
2 changed files with 13 additions and 20 deletions

View File

@ -14,34 +14,17 @@
package com.android.launcher3.uioverrides.plugins; package com.android.launcher3.uioverrides.plugins;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.content.Context; import android.content.Context;
import android.os.Looper;
import com.android.launcher3.Utilities; import com.android.launcher3.Utilities;
import com.android.systemui.shared.plugins.PluginInitializer; import com.android.systemui.shared.plugins.PluginInitializer;
public class PluginInitializerImpl implements PluginInitializer { public class PluginInitializerImpl implements PluginInitializer {
@Override @Override
public Looper getBgLooper() { public String[] getPrivilegedPlugins(Context context) {
return MODEL_EXECUTOR.getLooper();
}
@Override
public void onPluginManagerInit() {
}
@Override
public String[] getWhitelistedPlugins(Context context) {
return new String[0]; return new String[0];
} }
@Override
public PluginEnablerImpl getPluginEnabler(Context context) {
return new PluginEnablerImpl(context);
}
@Override @Override
public void handleWtfs() { public void handleWtfs() {
} }

View File

@ -16,6 +16,8 @@ package com.android.launcher3.uioverrides.plugins;
import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS; import static android.content.pm.PackageManager.MATCH_DISABLED_COMPONENTS;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -24,6 +26,7 @@ import android.content.pm.ResolveInfo;
import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.systemui.plugins.Plugin; import com.android.systemui.plugins.Plugin;
import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.PluginListener;
import com.android.systemui.shared.plugins.PluginInstanceManager;
import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.plugins.PluginManager;
import com.android.systemui.shared.plugins.PluginManagerImpl; import com.android.systemui.shared.plugins.PluginManagerImpl;
import com.android.systemui.shared.plugins.PluginPrefs; import com.android.systemui.shared.plugins.PluginPrefs;
@ -31,6 +34,7 @@ import com.android.systemui.shared.plugins.PluginPrefs;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.Set; import java.util.Set;
public class PluginManagerWrapper { public class PluginManagerWrapper {
@ -47,8 +51,14 @@ public class PluginManagerWrapper {
private PluginManagerWrapper(Context c) { private PluginManagerWrapper(Context c) {
mContext = c; mContext = c;
PluginInitializerImpl pluginInitializer = new PluginInitializerImpl(); PluginInitializerImpl pluginInitializer = new PluginInitializerImpl();
mPluginManager = new PluginManagerImpl(c, pluginInitializer); mPluginEnabler = new PluginEnablerImpl(c);
mPluginEnabler = pluginInitializer.getPluginEnabler(c); PluginInstanceManager.Factory instanceManagerFactory = new PluginInstanceManager.Factory(
c, c.getPackageManager(), MODEL_EXECUTOR.getLooper(), pluginInitializer);
mPluginManager = new PluginManagerImpl(c, instanceManagerFactory,
pluginInitializer.isDebuggable(),
Optional.ofNullable(Thread.getDefaultUncaughtExceptionHandler()), mPluginEnabler,
new PluginPrefs(c), pluginInitializer.getPrivilegedPlugins(c));
} }
public PluginEnablerImpl getPluginEnabler() { public PluginEnablerImpl getPluginEnabler() {