shadows/framework/src/main/java/org/robolectric/shadows/ShadowPackageManager.java
public ProviderInfo addProviderIfNotPresent(ComponentName componentName) {
    return addComponent(
        providerFilters,
        p -> p.providers,
        (p, a) -> p.providers = a,
        updateName(componentName, new ProviderInfo()),
        false);
  }
public ProviderInfo addProviderIfNotPresent(ComponentName componentName) {
    return addComponent(
        providerFilters,
        p -> p.providers,
        (p, a) -> p.providers = a,
        updateName(componentName, new ProviderInfo()),
        false);
  }
Makes sure that given provider exists.

If the provider doesn't exist yet, it will be created with {@code applicationInfo} set to an
existing application, or if it doesn't exist, a new package will be created.

@return existing or newly created provider info.