shadows/framework/src/main/java/org/robolectric/shadows/ShadowDisplay.java
public void setState(int state) {
    if (!isJB()) {
      ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
          di -> di.state = state);
    }
  }
public void setState(int state) {
    if (!isJB()) {
      ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
          di -> di.state = state);
    }
  }
Changes the simulated state for this display, such as whether it is on or off

Any registered {@link android.hardware.display.DisplayManager.DisplayListener}s will be
notified of the change.

@param state the new state: one of {@link Display#STATE_OFF}, {@link Display#STATE_ON},
{@link Display#STATE_DOZE}, {@link Display#STATE_DOZE_SUSPEND}, or
{@link Display#STATE_UNKNOWN}.