Search in sources :

Example 1 with ServiceData

use of org.robolectric.manifest.ServiceData in project robolectric by robolectric.

the class DefaultPackageManager method getServiceInfo.

@Override
public ServiceInfo getServiceInfo(ComponentName className, int flags) throws NameNotFoundException {
    String packageName = className.getPackageName();
    AndroidManifest androidManifest = androidManifests.get(packageName);
    String serviceName = className.getClassName();
    ServiceData serviceData = androidManifest.getServiceData(serviceName);
    if (serviceData == null) {
        throw new NameNotFoundException(serviceName);
    }
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.packageName = packageName;
    serviceInfo.name = serviceName;
    serviceInfo.applicationInfo = getApplicationInfo(packageName, flags);
    serviceInfo.permission = serviceData.getPermission();
    if ((flags & GET_META_DATA) != 0) {
        serviceInfo.metaData = metaDataToBundle(serviceData.getMetaData().getValueMap());
    }
    return serviceInfo;
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) AndroidManifest(org.robolectric.manifest.AndroidManifest) ServiceData(org.robolectric.manifest.ServiceData)

Aggregations

ServiceInfo (android.content.pm.ServiceInfo)1 AndroidManifest (org.robolectric.manifest.AndroidManifest)1 ServiceData (org.robolectric.manifest.ServiceData)1