use of android.content.pm.ServiceInfo in project android_frameworks_base by DirtyUnicorns.
the class PackageManagerService method queryIntentServicesInternal.
@NonNull
private List<ResolveInfo> queryIntentServicesInternal(Intent intent, String resolvedType, int flags, int userId) {
if (!sUserManager.exists(userId))
return Collections.emptyList();
flags = updateFlagsForResolve(flags, userId, intent);
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ServiceInfo si = getServiceInfo(comp, flags, userId);
if (si != null) {
final ResolveInfo ri = new ResolveInfo();
ri.serviceInfo = si;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mServices.queryIntent(intent, resolvedType, flags, userId);
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services, userId);
}
return Collections.emptyList();
}
}
use of android.content.pm.ServiceInfo in project android_frameworks_base by ParanoidAndroid.
the class InputMethodInfo method buildDummyResolveInfo.
private static ResolveInfo buildDummyResolveInfo(String packageName, String className, CharSequence label) {
ResolveInfo ri = new ResolveInfo();
ServiceInfo si = new ServiceInfo();
ApplicationInfo ai = new ApplicationInfo();
ai.packageName = packageName;
ai.enabled = true;
si.applicationInfo = ai;
si.enabled = true;
si.packageName = packageName;
si.name = className;
si.exported = true;
si.nonLocalizedLabel = label;
ri.serviceInfo = si;
return ri;
}
use of android.content.pm.ServiceInfo in project android_frameworks_base by ParanoidAndroid.
the class MetaDataTest method testServiceWithData.
@SmallTest
public void testServiceWithData() throws Exception {
ComponentName cn = new ComponentName(mContext, LocalService.class);
ServiceInfo si = mContext.getPackageManager().getServiceInfo(cn, PackageManager.GET_META_DATA);
checkMetaData(cn, si);
si = mContext.getPackageManager().getServiceInfo(cn, 0);
assertNull("Meta data returned when not requested", si.metaData);
}
use of android.content.pm.ServiceInfo in project android_frameworks_base by AOSPA.
the class InputMethodUtilsTest method createDummyInputMethodInfo.
private static InputMethodInfo createDummyInputMethodInfo(String packageName, String name, CharSequence label, boolean isAuxIme, boolean isDefault, List<InputMethodSubtype> subtypes) {
final ResolveInfo ri = new ResolveInfo();
final ServiceInfo si = new ServiceInfo();
final ApplicationInfo ai = new ApplicationInfo();
ai.packageName = packageName;
ai.enabled = true;
ai.flags |= ApplicationInfo.FLAG_SYSTEM;
si.applicationInfo = ai;
si.enabled = true;
si.packageName = packageName;
si.name = name;
si.exported = true;
si.nonLocalizedLabel = label;
ri.serviceInfo = si;
return new InputMethodInfo(ri, isAuxIme, "", subtypes, 1, isDefault);
}
use of android.content.pm.ServiceInfo in project android_frameworks_base by AOSPA.
the class BackupManagerService method checkForTransportAndBind.
// Check whether the given package hosts a transport, and bind if so
void checkForTransportAndBind(PackageInfo pkgInfo) {
Intent intent = new Intent(mTransportServiceIntent).setPackage(pkgInfo.packageName);
// TODO: http://b/22388012
List<ResolveInfo> hosts = mPackageManager.queryIntentServicesAsUser(intent, 0, UserHandle.USER_SYSTEM);
if (hosts != null) {
final int N = hosts.size();
for (int i = 0; i < N; i++) {
final ServiceInfo info = hosts.get(i).serviceInfo;
tryBindTransport(info);
}
}
}
Aggregations