use of com.android.launcher3.uioverrides.plugins.PluginManagerWrapper in project android_packages_apps_Launcher3 by crdroidandroid.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!pluginPermissionApps.contains(packageName)) {
continue;
}
Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
if (!plugins.containsKey(key)) {
plugins.put(key, new ArrayList<>());
}
plugins.get(key).add(Pair.create(name, info));
}
}
PreferenceDataStore enabler = manager.getPluginEnabler();
plugins.forEach((key, si) -> {
String packageName = key.first;
List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
if (!componentNames.isEmpty()) {
SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
mPluginsCategory.addPreference(pref);
}
});
}
use of com.android.launcher3.uioverrides.plugins.PluginManagerWrapper in project android_packages_apps_Launcher3 by AOSPA.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!pluginPermissionApps.contains(packageName)) {
continue;
}
Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
if (!plugins.containsKey(key)) {
plugins.put(key, new ArrayList<>());
}
plugins.get(key).add(Pair.create(name, info));
}
}
PreferenceDataStore enabler = manager.getPluginEnabler();
plugins.forEach((key, si) -> {
String packageName = key.first;
List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
if (!componentNames.isEmpty()) {
SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
mPluginsCategory.addPreference(pref);
}
});
}
use of com.android.launcher3.uioverrides.plugins.PluginManagerWrapper in project Neo-Launcher by NeoApplications.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<String, ArraySet<String>> plugins = new ArrayMap<>();
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), PackageManager.MATCH_DISABLED_COMPONENTS);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!plugins.containsKey(packageName)) {
plugins.put(packageName, new ArraySet<>());
}
plugins.get(packageName).add(name);
}
}
List<PackageInfo> apps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.GET_SERVICES);
PreferenceDataStore enabled = manager.getPluginEnabler();
apps.forEach(app -> {
if (!plugins.containsKey(app.packageName))
return;
SwitchPreference pref = new PluginPreference(prefContext, app, enabled);
pref.setSummary("Plugins: " + toString(plugins.get(app.packageName)));
mPluginsCategory.addPreference(pref);
});
}
use of com.android.launcher3.uioverrides.plugins.PluginManagerWrapper in project android_packages_apps_Launcher3 by ArrowOS.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!pluginPermissionApps.contains(packageName)) {
continue;
}
Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
if (!plugins.containsKey(key)) {
plugins.put(key, new ArrayList<>());
}
plugins.get(key).add(Pair.create(name, info));
}
}
PreferenceDataStore enabler = manager.getPluginEnabler();
plugins.forEach((key, si) -> {
String packageName = key.first;
List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
if (!componentNames.isEmpty()) {
SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
mPluginsCategory.addPreference(pref);
}
});
}
use of com.android.launcher3.uioverrides.plugins.PluginManagerWrapper in project android_packages_apps_Launcher3 by ProtonAOSP.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!pluginPermissionApps.contains(packageName)) {
continue;
}
Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
if (!plugins.containsKey(key)) {
plugins.put(key, new ArrayList<>());
}
plugins.get(key).add(Pair.create(name, info));
}
}
PreferenceDataStore enabler = manager.getPluginEnabler();
plugins.forEach((key, si) -> {
String packageName = key.first;
List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
if (!componentNames.isEmpty()) {
SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
mPluginsCategory.addPreference(pref);
}
});
}
Aggregations