public static String restore(BootupConfig config) {
    final boolean hasVdd = Utils.fileExists(VoltageUtils.VDD_TABLE_FILE);
    final boolean hasUv = Utils.fileExists(VoltageUtils.UV_TABLE_FILE);
    if (!hasVdd && !hasUv) {
      return "";
    }

    final ArrayList<BootupItem> bootupItems =
        config.getItemsByCategory(BootupConfig.CATEGORY_VOLTAGE);
    if (bootupItems.size() == 0) {
      return "";
    }
    final BootupItem voltageBootupItem = bootupItems.get(0);
    if (voltageBootupItem == null || !voltageBootupItem.enabled) {
      return "";
    }

    final StringBuilder restore = new StringBuilder();
    if (hasVdd) {
      final String value = ExtraConfig.get().vdd;
      Logger.v(VoltageFragment.class, "VDD Table: " + value);

      if (!TextUtils.isEmpty(value)) {
        final String[] values = value.split("XXX");
        for (final String s : values) {
          restore.append(Utils.getWriteCommand(VoltageUtils.VDD_TABLE_FILE, s));
        }
      }
    } else {
      final String value = ExtraConfig.get().uv;
      Logger.v(VoltageFragment.class, "UV Table: " + value);

      if (!TextUtils.isEmpty(value)) {
        restore.append(Utils.getWriteCommand(VoltageUtils.UV_TABLE_FILE, value));
      }
    }

    return restore.toString();
  }
      @Override
      protected String doInBackground(String... params) {
        try {
          mNames = VoltageUtils.get().getUvValues(true);
          mValues = VoltageUtils.get().getUvValues(false);
        } catch (Exception exc) {
          Logger.e(this, "UV ERROR: " + exc.getMessage());
          return "ERROR";
        }
        Logger.v(this, "UV TABLE: " + buildTable(mValues));

        String name;
        CustomPreference pref;
        final int length = mNames.length;
        for (int i = 0; i < length; i++) {
          final int j = i;
          name = mNames[i];
          pref = new CustomPreference(getActivity());
          pref.setTitle(name);
          pref.areMilliVolts(millivolts);
          if (isVdd) {
            pref.setSummary(mValues[i]);
          } else {
            pref.setSummary(mValues[i] + " mV");
          }
          pref.setKey(mValues[i]);
          mCategory.addPreference(pref);

          pref.setOnPreferenceClickListener(
              new OnPreferenceClickListener() {

                @Override
                public boolean onPreferenceClick(final Preference p) {
                  final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

                  final LinearLayout ll = new LinearLayout(getActivity());
                  ll.setLayoutParams(
                      new LinearLayout.LayoutParams(
                          LinearLayout.LayoutParams.WRAP_CONTENT,
                          LinearLayout.LayoutParams.MATCH_PARENT));

                  final EditText et = new EditText(getActivity());

                  final LinearLayout.LayoutParams params =
                      new LinearLayout.LayoutParams(
                          LinearLayout.LayoutParams.MATCH_PARENT,
                          LinearLayout.LayoutParams.WRAP_CONTENT);
                  params.setMargins(40, 40, 40, 40);
                  params.gravity = Gravity.CENTER;

                  final String val = p.getKey();

                  et.setLayoutParams(params);
                  et.setRawInputType(InputType.TYPE_CLASS_NUMBER);
                  et.setGravity(Gravity.CENTER_HORIZONTAL);
                  et.setText(val);

                  ll.addView(et);
                  builder.setView(ll);

                  builder.setPositiveButton(
                      android.R.string.ok,
                      new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                          if (et.getText() != null) {
                            if (isVdd) {
                              final String value = p.getTitle() + " " + et.getText().toString();
                              Utils.writeValue(VoltageUtils.UV_TABLE_FILE, value);
                              p.setSummary(et.getText().toString());
                              p.setKey(et.getText().toString());
                              mValues[j] = p.getKey();
                            } else {
                              final String value = et.getText().toString();
                              p.setSummary(value + " mV");
                              p.setKey(value);
                              mValues[j] = value;
                              Utils.writeValue(VoltageUtils.UV_TABLE_FILE, buildTable(mValues));
                            }
                          }
                        }
                      });
                  final AlertDialog dialog = builder.create();
                  dialog.show();

                  final Window window = dialog.getWindow();
                  window.setLayout(800, LayoutParams.WRAP_CONTENT);

                  return true;
                }
              });
        }
        return "Executed";
      }