class MarshmallowNetworkObservingStrategy implements NetworkObservingStrategy {

  protected Publisher<Connectivity> propagateAnyConnectedState(final Connectivity last,
      final Connectivity current) {
    final boolean typeChanged = last.type() != current.type();
    final boolean wasConnected = last.state() == NetworkInfo.State.CONNECTED;
    final boolean isDisconnected = current.state() == NetworkInfo.State.DISCONNECTED;
    final boolean isNotIdle = current.detailedState() != NetworkInfo.DetailedState.IDLE;

    if (typeChanged && wasConnected && isDisconnected && isNotIdle) {
      return Flowable.fromArray(current, last);
    } else {
      return Flowable.fromArray(current);
    }
  }

  @SuppressWarnings("NullAway") // networkCallback cannot be initialized here public  MarshmallowNetworkObservingStrategy();

}