/**
   * Conditionally quit the looper and stop execution.
   *
   * <p>This sends the SM_QUIT_MSG to the state machine and if not handled by any state's
   * processMessage then the state machine will be stopped and no further messages will be
   * processed.
   */
  public final void quit() {
    // mSmHandler can be null if the state machine has quit.
    if (mSmHandler == null) return;

    mSmHandler.quit();
  }