use of android.content.pm.ResolveInfo in project platform_frameworks_base by android.
the class PackageManagerShellCommand method runQueryIntentServices.
private int runQueryIntentServices() {
Intent intent;
try {
intent = parseIntentAndUser();
} catch (URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
try {
List<ResolveInfo> result = mInterface.queryIntentServices(intent, null, 0, mTargetUser).getList();
PrintWriter pw = getOutPrintWriter();
if (result == null || result.size() <= 0) {
pw.println("No services found");
} else {
if (!mComponents) {
pw.print(result.size());
pw.println(" services found:");
PrintWriterPrinter pr = new PrintWriterPrinter(pw);
for (int i = 0; i < result.size(); i++) {
pw.print(" Service #");
pw.print(i);
pw.println(":");
printResolveInfo(pr, " ", result.get(i), mBrief, mComponents);
}
} else {
PrintWriterPrinter pr = new PrintWriterPrinter(pw);
for (int i = 0; i < result.size(); i++) {
printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
}
}
}
} catch (RemoteException e) {
throw new RuntimeException("Failed calling service", e);
}
return 0;
}
use of android.content.pm.ResolveInfo in project platform_frameworks_base by android.
the class InputMethodSubtypeSwitchingControllerTest method addDummyImeSubtypeListItems.
private static void addDummyImeSubtypeListItems(List<ImeSubtypeListItem> items, String imeName, String imeLabel, List<String> subtypeLocales, boolean supportsSwitchingToNextInputMethod) {
final ResolveInfo ri = new ResolveInfo();
final ServiceInfo si = new ServiceInfo();
final ApplicationInfo ai = new ApplicationInfo();
ai.packageName = DUMMY_PACKAGE_NAME;
ai.enabled = true;
si.applicationInfo = ai;
si.enabled = true;
si.packageName = DUMMY_PACKAGE_NAME;
si.name = imeName;
si.exported = true;
si.nonLocalizedLabel = imeLabel;
ri.serviceInfo = si;
List<InputMethodSubtype> subtypes = null;
if (subtypeLocales != null) {
subtypes = new ArrayList<>();
for (String subtypeLocale : subtypeLocales) {
subtypes.add(createDummySubtype(subtypeLocale));
}
}
final InputMethodInfo imi = new InputMethodInfo(ri, DUMMY_IS_AUX_IME, DUMMY_SETTING_ACTIVITY_NAME, subtypes, DUMMY_IS_DEFAULT_RES_ID, DUMMY_FORCE_DEFAULT, supportsSwitchingToNextInputMethod);
if (subtypes == null) {
items.add(new ImeSubtypeListItem(imeName, null, /* variableName */
imi, NOT_A_SUBTYPE_ID, null, SYSTEM_LOCALE));
} else {
for (int i = 0; i < subtypes.size(); ++i) {
final String subtypeLocale = subtypeLocales.get(i);
items.add(new ImeSubtypeListItem(imeName, subtypeLocale, imi, i, subtypeLocale, SYSTEM_LOCALE));
}
}
}
use of android.content.pm.ResolveInfo in project platform_frameworks_base by android.
the class RecentsProvider method call.
@Override
public Bundle call(String method, String arg, Bundle extras) {
if (METHOD_PURGE.equals(method)) {
// Purge references to unknown authorities
final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
final Set<String> knownAuth = Sets.newHashSet();
for (ResolveInfo info : getContext().getPackageManager().queryIntentContentProviders(intent, 0)) {
knownAuth.add(info.providerInfo.authority);
}
purgeByAuthority(new Predicate<String>() {
@Override
public boolean test(String authority) {
// Purge unknown authorities
return !knownAuth.contains(authority);
}
});
return null;
} else if (METHOD_PURGE_PACKAGE.equals(method)) {
// Purge references to authorities in given package
final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
intent.setPackage(arg);
final Set<String> packageAuth = Sets.newHashSet();
for (ResolveInfo info : getContext().getPackageManager().queryIntentContentProviders(intent, 0)) {
packageAuth.add(info.providerInfo.authority);
}
if (!packageAuth.isEmpty()) {
purgeByAuthority(new Predicate<String>() {
@Override
public boolean test(String authority) {
// Purge authority matches
return packageAuth.contains(authority);
}
});
}
return null;
} else {
return super.call(method, arg, extras);
}
}
use of android.content.pm.ResolveInfo in project platform_frameworks_base by android.
the class FilesAppPerfTest method killProviders.
private void killProviders() throws Exception {
final Context context = getInstrumentation().getContext();
final PackageManager pm = context.getPackageManager();
final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);
final List<ResolveInfo> providers = pm.queryIntentContentProviders(intent, 0);
for (ResolveInfo info : providers) {
final String packageName = info.providerInfo.packageName;
am.killBackgroundProcesses(packageName);
}
}
use of android.content.pm.ResolveInfo in project platform_frameworks_base by android.
the class AppWidgetServiceImpl method loadGroupWidgetProvidersLocked.
private void loadGroupWidgetProvidersLocked(int[] profileIds) {
List<ResolveInfo> allReceivers = null;
Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
final int profileCount = profileIds.length;
for (int i = 0; i < profileCount; i++) {
final int profileId = profileIds[i];
List<ResolveInfo> receivers = queryIntentReceivers(intent, profileId);
if (receivers != null && !receivers.isEmpty()) {
if (allReceivers == null) {
allReceivers = new ArrayList<>();
}
allReceivers.addAll(receivers);
}
}
final int N = (allReceivers == null) ? 0 : allReceivers.size();
for (int i = 0; i < N; i++) {
ResolveInfo receiver = allReceivers.get(i);
addProviderLocked(receiver);
}
}
Aggregations