mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-10 20:15:54 +00:00
Rename sttrace pref to debug_facilities_enabled (fixes #1133)
This commit is contained in:
parent
2b360dab54
commit
691edabaf6
6 changed files with 14 additions and 13 deletions
|
@ -78,7 +78,6 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
Preference.OnPreferenceClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
Preference.OnPreferenceClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
private static final String TAG = "SettingsFragment";
|
private static final String TAG = "SettingsFragment";
|
||||||
private static final String KEY_STTRACE = "sttrace";
|
|
||||||
private static final String KEY_EXPORT_CONFIG = "export_config";
|
private static final String KEY_EXPORT_CONFIG = "export_config";
|
||||||
private static final String KEY_IMPORT_CONFIG = "import_config";
|
private static final String KEY_IMPORT_CONFIG = "import_config";
|
||||||
private static final String KEY_ST_RESET_DATABASE = "st_reset_database";
|
private static final String KEY_ST_RESET_DATABASE = "st_reset_database";
|
||||||
|
@ -193,10 +192,10 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
Preference exportConfig = findPreference("export_config");
|
Preference exportConfig = findPreference("export_config");
|
||||||
Preference importConfig = findPreference("import_config");
|
Preference importConfig = findPreference("import_config");
|
||||||
|
|
||||||
Preference stTrace = findPreference("sttrace");
|
Preference debugFacilitiesEnabled = findPreference(Constants.PREF_DEBUG_FACILITIES_ENABLED);
|
||||||
Preference environmentVariables = findPreference("environment_variables");
|
Preference environmentVariables = findPreference("environment_variables");
|
||||||
Preference stResetDatabase = findPreference("st_reset_database");
|
Preference stResetDatabase = findPreference("st_reset_database");
|
||||||
Preference stResetDeltas = findPreference("st_reset_deltas");
|
Preference stResetDeltas = findPreference("st_reset_deltas");
|
||||||
|
|
||||||
mUseRoot = (CheckBoxPreference) findPreference(Constants.PREF_USE_ROOT);
|
mUseRoot = (CheckBoxPreference) findPreference(Constants.PREF_USE_ROOT);
|
||||||
mUseWakelock = (CheckBoxPreference) findPreference(Constants.PREF_USE_WAKE_LOCK);
|
mUseWakelock = (CheckBoxPreference) findPreference(Constants.PREF_USE_WAKE_LOCK);
|
||||||
|
@ -216,7 +215,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
exportConfig.setOnPreferenceClickListener(this);
|
exportConfig.setOnPreferenceClickListener(this);
|
||||||
importConfig.setOnPreferenceClickListener(this);
|
importConfig.setOnPreferenceClickListener(this);
|
||||||
|
|
||||||
stTrace.setOnPreferenceChangeListener(this);
|
debugFacilitiesEnabled.setOnPreferenceChangeListener(this);
|
||||||
environmentVariables.setOnPreferenceChangeListener(this);
|
environmentVariables.setOnPreferenceChangeListener(this);
|
||||||
stResetDatabase.setOnPreferenceClickListener(this);
|
stResetDatabase.setOnPreferenceClickListener(this);
|
||||||
stResetDeltas.setOnPreferenceClickListener(this);
|
stResetDeltas.setOnPreferenceClickListener(this);
|
||||||
|
@ -409,7 +408,7 @@ public class SettingsActivity extends SyncthingActivity {
|
||||||
case Constants.PREF_SYNC_ONLY_WIFI:
|
case Constants.PREF_SYNC_ONLY_WIFI:
|
||||||
mSyncOnlyOnSSIDs.setEnabled((Boolean) o);
|
mSyncOnlyOnSSIDs.setEnabled((Boolean) o);
|
||||||
break;
|
break;
|
||||||
case KEY_STTRACE:
|
case Constants.PREF_DEBUG_FACILITIES_ENABLED:
|
||||||
mRequireRestart = true;
|
mRequireRestart = true;
|
||||||
break;
|
break;
|
||||||
case Constants.PREF_ENVIRONMENT_VARIABLES:
|
case Constants.PREF_ENVIRONMENT_VARIABLES:
|
||||||
|
|
|
@ -18,16 +18,17 @@ public class Constants {
|
||||||
public static final String PREF_USE_ROOT = "use_root";
|
public static final String PREF_USE_ROOT = "use_root";
|
||||||
public static final String PREF_NOTIFICATION_TYPE = "notification_type";
|
public static final String PREF_NOTIFICATION_TYPE = "notification_type";
|
||||||
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";
|
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";
|
||||||
|
public static final String PREF_DEBUG_FACILITIES_ENABLED = "debug_facilities_enabled";
|
||||||
public static final String PREF_USE_WAKE_LOCK = "wakelock_while_binary_running";
|
public static final String PREF_USE_WAKE_LOCK = "wakelock_while_binary_running";
|
||||||
public static final String PREF_USE_TOR = "use_tor";
|
public static final String PREF_USE_TOR = "use_tor";
|
||||||
public static final String PREF_SOCKS_PROXY_ADDRESS = "socks_proxy_address";
|
public static final String PREF_SOCKS_PROXY_ADDRESS = "socks_proxy_address";
|
||||||
public static final String PREF_HTTP_PROXY_ADDRESS = "http_proxy_address";
|
public static final String PREF_HTTP_PROXY_ADDRESS = "http_proxy_address";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available options cache for preference {@link app_settings#sttrace}
|
* Available options cache for preference {@link app_settings#debug_facilities_enabled}
|
||||||
* Read via REST API call in {@link RestApi#updateDebugFacilitiesCache} after first successful binary startup.
|
* Read via REST API call in {@link RestApi#updateDebugFacilitiesCache} after first successful binary startup.
|
||||||
*/
|
*/
|
||||||
public static final String PREF_STTRACE_AVAILABLE_OPTIONS = "sttrace_available_options";
|
public static final String PREF_DEBUG_FACILITIES_AVAILABLE = "sttrace_available_options";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On Android 8.1, ACCESS_COARSE_LOCATION is required to access WiFi SSID.
|
* On Android 8.1, ACCESS_COARSE_LOCATION is required to access WiFi SSID.
|
||||||
|
|
|
@ -221,7 +221,7 @@ public class RestApi {
|
||||||
facilitiesToStore.add(facilityName);
|
facilitiesToStore.add(facilityName);
|
||||||
}
|
}
|
||||||
PreferenceManager.getDefaultSharedPreferences(mContext).edit()
|
PreferenceManager.getDefaultSharedPreferences(mContext).edit()
|
||||||
.putStringSet(Constants.PREF_STTRACE_AVAILABLE_OPTIONS, facilitiesToStore)
|
.putStringSet(Constants.PREF_DEBUG_FACILITIES_AVAILABLE, facilitiesToStore)
|
||||||
.apply();
|
.apply();
|
||||||
|
|
||||||
// Store current binary version so we will only store this information again
|
// Store current binary version so we will only store this information again
|
||||||
|
|
|
@ -432,7 +432,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
HashMap<String, String> targetEnv = new HashMap<>();
|
HashMap<String, String> targetEnv = new HashMap<>();
|
||||||
// Set home directory to data folder for web GUI folder picker.
|
// Set home directory to data folder for web GUI folder picker.
|
||||||
targetEnv.put("HOME", Environment.getExternalStorageDirectory().getAbsolutePath());
|
targetEnv.put("HOME", Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||||
targetEnv.put("STTRACE", TextUtils.join(" ", mPreferences.getStringSet("sttrace", new HashSet<>())));
|
targetEnv.put("STTRACE", TextUtils.join(" ",
|
||||||
|
mPreferences.getStringSet(Constants.PREF_DEBUG_FACILITIES_ENABLED, new HashSet<>())));
|
||||||
File externalFilesDir = mContext.getExternalFilesDir(null);
|
File externalFilesDir = mContext.getExternalFilesDir(null);
|
||||||
if (externalFilesDir != null)
|
if (externalFilesDir != null)
|
||||||
targetEnv.put("STGUIASSETS", externalFilesDir.getAbsolutePath() + "/gui");
|
targetEnv.put("STGUIASSETS", externalFilesDir.getAbsolutePath() + "/gui");
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class SttracePreference extends MultiSelectListPreference {
|
||||||
*/
|
*/
|
||||||
private CharSequence[] getDebugFacilities() {
|
private CharSequence[] getDebugFacilities() {
|
||||||
List<String> retDebugFacilities = new ArrayList<String>();
|
List<String> retDebugFacilities = new ArrayList<String>();
|
||||||
Set<String> availableDebugFacilities = getSharedPreferences().getStringSet(Constants.PREF_STTRACE_AVAILABLE_OPTIONS, new HashSet<>());
|
Set<String> availableDebugFacilities = getSharedPreferences().getStringSet(Constants.PREF_DEBUG_FACILITIES_AVAILABLE, new HashSet<>());
|
||||||
// from JavaDoc: Note that you must not modify the set instance returned by this call.
|
// from JavaDoc: Note that you must not modify the set instance returned by this call.
|
||||||
// therefore required to make a defensive copy of the elements
|
// therefore required to make a defensive copy of the elements
|
||||||
availableDebugFacilities = new HashSet<>(availableDebugFacilities);
|
availableDebugFacilities = new HashSet<>(availableDebugFacilities);
|
||||||
|
|
|
@ -168,7 +168,7 @@
|
||||||
android:summary="@string/notify_crashes_summary"/>
|
android:summary="@string/notify_crashes_summary"/>
|
||||||
|
|
||||||
<com.nutomic.syncthingandroid.views.SttracePreference
|
<com.nutomic.syncthingandroid.views.SttracePreference
|
||||||
android:key="sttrace"
|
android:key="debug_facilities_enabled"
|
||||||
android:title="@string/sttrace_title" />
|
android:title="@string/sttrace_title" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
|
|
Loading…
Reference in a new issue