Search in sources :

Example 1 with PackageItemData

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

the class DefaultPackageManager method getReceiverInfo.

@Override
public ActivityInfo getReceiverInfo(ComponentName className, int flags) throws NameNotFoundException {
    String packageName = className.getPackageName();
    AndroidManifest androidManifest = androidManifests.get(packageName);
    String classString = resolvePackageName(packageName, className);
    for (PackageItemData receiver : androidManifest.getBroadcastReceivers()) {
        if (receiver.getClassName().equals(classString)) {
            ActivityInfo activityInfo = new ActivityInfo();
            activityInfo.packageName = packageName;
            activityInfo.name = classString;
            if ((flags & GET_META_DATA) != 0) {
                activityInfo.metaData = metaDataToBundle(receiver.getMetaData().getValueMap());
            }
            return activityInfo;
        }
    }
    return null;
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) AndroidManifest(org.robolectric.manifest.AndroidManifest) PackageItemData(org.robolectric.manifest.PackageItemData)

Aggregations

ActivityInfo (android.content.pm.ActivityInfo)1 AndroidManifest (org.robolectric.manifest.AndroidManifest)1 PackageItemData (org.robolectric.manifest.PackageItemData)1