/**
   * Helper method to dump flag state to the log.
   *
   * @param uiFlags Set of UI flags to inspect
   */
  public void dumpFlagStateToLog(int uiFlags) {
    if ((uiFlags & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
      Log.i(TAG, "SYSTEM_UI_FLAG_LOW_PROFILE is set");
    } else {
      Log.i(TAG, "SYSTEM_UI_FLAG_LOW_PROFILE is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
      Log.i(TAG, "SYSTEM_UI_FLAG_FULLSCREEN is set");
    } else {
      Log.i(TAG, "SYSTEM_UI_FLAG_FULLSCREEN is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0) {
      Log.i(TAG, "SYSTEM_UI_FLAG_HIDE_NAVIGATION is set");
    } else {
      Log.i(TAG, "SYSTEM_UI_FLAG_HIDE_NAVIGATION is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0) {
      Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE is set");
    } else {
      Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0) {
      Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE_STICKY is set");
    } else {
      Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE_STICKY is unset");
    }
  }
  /** Create a chain of targets that will receive log data */
  @Override
  public void initializeLogging() {
    // Wraps Android's native log framework.
    LogWrapper logWrapper = new LogWrapper();
    // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
    Log.setLogNode(logWrapper);

    // Filter strips out everything except the message text.
    MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
    logWrapper.setNext(msgFilter);

    // On screen logging via a fragment with a TextView.
    LogFragment logFragment =
        (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
    msgFilter.setNext(logFragment.getLogView());

    Log.i(TAG, "Ready");
  }