shadows/framework/src/main/java/org/robolectric/shadows/ShadowServiceManager.java
public static void setServiceAvailability(String service, boolean available) {
    if (available) {
      unavailableServices.remove(service);
    } else {
      unavailableServices.add(service);
    }
  }
public static void setServiceAvailability(String service, boolean available) {
    if (available) {
      unavailableServices.remove(service);
    } else {
      unavailableServices.add(service);
    }
  }
Sets the availability of the given system service. If the service is set as unavailable,
subsequent calls to {@link Context#getSystemService} for that service will return {@code null}.