public static ArrayList<Entry> getTriggers() {
    final ArrayList<Entry> triggers = new ArrayList<>();

    Entry e = new Entry(App.get().getString(R.string.screen_off), TRIGGER_SCREEN_OFF);
    triggers.add(e);
    e = new Entry(App.get().getString(R.string.screen_on), TRIGGER_SCREEN_ON);
    triggers.add(e);

    return triggers;
  }
  public static ArrayList<Entry> getCategories() {
    final ArrayList<Entry> categories = new ArrayList<>();

    // CPU
    categories.add(new Entry(App.get().getString(R.string.cpu), CATEGORY_CPU));
    // GPU
    categories.add(new Entry(App.get().getString(R.string.gpu), CATEGORY_GPU));
    // Extras
    categories.add(new Entry(App.get().getString(R.string.extras), CATEGORY_EXTRAS));
    // Filesystem
    categories.add(new Entry(App.get().getString(R.string.file_system), CATEGORY_FS));

    return categories;
  }
 private static void addValuesOnOff(final ArrayList<Entry> values) {
   values.add(new Entry(App.get().getString(R.string.on), "1"));
   values.add(new Entry(App.get().getString(R.string.off), "0"));
 }
  public static ArrayList<Entry> getValues(final String action) {
    final ArrayList<Entry> values = new ArrayList<>();
    if (TextUtils.isEmpty(action)) return values;

    // CPU frequencies
    if (TextUtils.equals(ACTION_CPU_FREQUENCY_MAX, action)
        || TextUtils.equals(ACTION_CPU_FREQUENCY_MIN, action)) {
      final List<Integer> freqList = CpuReader.readFreqAvail(0);
      for (final int value : freqList) {
        final String s = String.valueOf(value);
        values.add(new Entry(CpuInformation.toMhz(s), s));
      }
    } else

    // CPU governor
    if (TextUtils.equals(ACTION_CPU_GOVERNOR, action)) {
      final List<String> governors = CpuReader.readGovAvail(0);
      for (final String s : governors) {
        values.add(new Entry(s, s));
      }
    } else

    // GPU frequencies
    if (TextUtils.equals(ACTION_GPU_FREQUENCY_MAX, action)
        || TextUtils.equals(ACTION_GPU_FREQUENCY_MIN, action)) {
      final String[] freqs = GpuUtils.get().getAvailableFrequencies(true);
      if (freqs == null) return values;

      for (final String s : freqs) {
        values.add(new Entry(GpuUtils.toMhz(s), s));
      }
    } else

    // GPU governor
    if (TextUtils.equals(ACTION_GPU_GOVERNOR, action)) {
      final String[] governors = GovernorUtils.get().getAvailableGpuGovernors();
      if (governors == null) return values;

      for (final String s : governors) {
        values.add(new Entry(s, s));
      }
    } else

    // GPU 3D scaling
    if (TextUtils.equals(ACTION_3D_SCALING, action)) {
      addValuesOnOff(values);
    } else

    // Filesystem
    if (TextUtils.equals(ACTION_IO_SCHEDULER, action)) {
      final String[] scheds = IoUtils.get().getAvailableIoSchedulers();
      if (scheds == null) return values;

      for (final String s : scheds) {
        values.add(new Entry(s, s));
      }
    } else if (TextUtils.equals(ACTION_READ_AHEAD, action)) {
      final String[] entries = App.get().getStringArray(R.array.read_ahead_entries);
      final String[] vals = App.get().getStringArray(R.array.read_ahead_values);
      for (int i = 0; i < entries.length; i++) {
        values.add(new Entry(entries[i], vals[i]));
      }
    } else
    // Extras
    if (TextUtils.equals(ACTION_KSM_ENABLED, action)
        || TextUtils.equals(ACTION_KSM_DEFERRED, action)) {
      addValuesOnOff(values);
    } else if (TextUtils.equals(ACTION_KSM_PAGES, action)) {
      final String[] vals = {"32", "64", "128", "256", "512", "1024"};
      for (final String s : vals) {
        values.add(new Entry(s, s));
      }
    } else if (TextUtils.equals(ACTION_KSM_SLEEP, action)) {
      final String[] vals = {"100", "250", "500", "1000", "2000", "3000", "4000", "5000"};
      for (final String s : vals) {
        values.add(new Entry(s, s));
      }
    } else if (TextUtils.equals(ACTION_MPDECISION, action)) {
      addValuesOnOff(values);
    }

    return values;
  }
  public static ArrayList<Entry> getActions(final String category) {
    final ArrayList<Entry> actions = new ArrayList<>();
    if (TextUtils.isEmpty(category)) return actions;

    // CPU
    if (TextUtils.equals(CATEGORY_CPU, category)) {
      actions.add(new Entry(App.get().getString(R.string.frequency_max), ACTION_CPU_FREQUENCY_MAX));
      actions.add(new Entry(App.get().getString(R.string.frequency_min), ACTION_CPU_FREQUENCY_MIN));
      actions.add(new Entry(App.get().getString(R.string.governor), ACTION_CPU_GOVERNOR));
    }
    // GPU
    if (TextUtils.equals(CATEGORY_GPU, category)) {
      if (Utils.fileExists(GpuUtils.get().getGpuFreqMaxPath())) {
        actions.add(
            new Entry(App.get().getString(R.string.frequency_max), ACTION_GPU_FREQUENCY_MAX));
      }
      if (Utils.fileExists(GpuUtils.get().getGpuFreqMinPath())) {
        actions.add(
            new Entry(App.get().getString(R.string.frequency_min), ACTION_GPU_FREQUENCY_MIN));
      }
      if (Utils.fileExists(GpuUtils.get().getGpuGovPath())) {
        actions.add(new Entry(App.get().getString(R.string.governor), ACTION_GPU_GOVERNOR));
      }
      if (Utils.fileExists(GpuUtils.FILE_3D_SCALING)) {
        actions.add(new Entry(App.get().getString(R.string.gpu_3d_scaling), ACTION_3D_SCALING));
      }
    }
    // Extras
    if (TextUtils.equals(CATEGORY_EXTRAS, category)) {
      if (Utils.fileExists(KsmUtils.KSM_PATH)) {
        if (Utils.fileExists(App.get().getString(R.string.file_ksm_run))) {
          actions.add(new Entry(App.get().getString(R.string.enable_ksm), ACTION_KSM_ENABLED));
        }
        if (Utils.fileExists(App.get().getString(R.string.file_ksm_deferred))) {
          actions.add(new Entry(App.get().getString(R.string.deferred_timer), ACTION_KSM_DEFERRED));
        }
        if (Utils.fileExists(KsmUtils.KSM_PAGES_TO_SCAN)) {
          actions.add(new Entry(App.get().getString(R.string.pages_to_scan), ACTION_KSM_PAGES));
        }
        if (Utils.fileExists(KsmUtils.KSM_SLEEP)) {
          actions.add(
              new Entry(App.get().getString(R.string.sleep_between_scans), ACTION_KSM_SLEEP));
        }
      }
      if (Utils.fileExists(MpDecisionAction.MPDECISION_PATH)) {
        actions.add(new Entry(App.get().getString(R.string.mpdecision), ACTION_MPDECISION));
      }
    }
    // Filesystem
    if (TextUtils.equals(CATEGORY_FS, category)) {
      actions.add(new Entry(App.get().getString(R.string.io), ACTION_IO_SCHEDULER));
      actions.add(new Entry(App.get().getString(R.string.read_ahead), ACTION_READ_AHEAD));
    }

    return actions;
  }