mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-02-09 18:44:43 +00:00
Add pref to enable verbose logging (#303)
* Add prefs: verbose_log, expert_mode * Update prefs in Constants * Add service.AppPrefs * Update fragments to read verbose log pref * Update classes with context or inject to read verbose log pref * Inherit ENABLE_VERBOSE_LOG from RestApi to Completion * Restart whole app if verbose log pref was changed * A line too much * Revert expert mode pref (DELTA REVERT)
This commit is contained in:
parent
53d3c13403
commit
cdcdc3c1c8
18 changed files with 175 additions and 20 deletions
|
@ -7,6 +7,9 @@ import com.nutomic.syncthingandroid.activities.FolderPickerActivity;
|
|||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SyncConditionsActivity;
|
||||
import com.nutomic.syncthingandroid.fragments.DeviceListFragment;
|
||||
import com.nutomic.syncthingandroid.fragments.FolderListFragment;
|
||||
import com.nutomic.syncthingandroid.fragments.StatusFragment;
|
||||
import com.nutomic.syncthingandroid.receiver.AppConfigReceiver;
|
||||
import com.nutomic.syncthingandroid.service.RunConditionMonitor;
|
||||
import com.nutomic.syncthingandroid.service.EventProcessor;
|
||||
|
@ -31,6 +34,9 @@ public interface DaggerComponent {
|
|||
void inject(FolderActivity activity);
|
||||
void inject(FolderPickerActivity activity);
|
||||
void inject(SyncConditionsActivity activity);
|
||||
void inject(DeviceListFragment fragment);
|
||||
void inject(FolderListFragment fragment);
|
||||
void inject(StatusFragment fragment);
|
||||
void inject(Languages languages);
|
||||
void inject(SyncthingService service);
|
||||
void inject(RunConditionMonitor runConditionMonitor);
|
||||
|
|
|
@ -70,6 +70,8 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
|
||||
private SettingsFragment mSettingsFragment;
|
||||
|
||||
public static final int RESULT_RESTART_APP = 3461;
|
||||
|
||||
public static final String EXTRA_OPEN_SUB_PREF_SCREEN =
|
||||
"com.github.catfriend1.syncthingandroid.activities.SettingsActivity.OPEN_SUB_PREF_SCREEN";
|
||||
|
||||
|
@ -153,6 +155,7 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
|
||||
private Dialog mCurrentPrefScreenDialog = null;
|
||||
|
||||
/* Run conditions */
|
||||
private Preference mCategoryRunConditions;
|
||||
private ListPreference mPowerSource;
|
||||
private CheckBoxPreference mRunOnMobileData;
|
||||
|
@ -332,13 +335,15 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
exportConfig.setOnPreferenceClickListener(this);
|
||||
importConfig.setOnPreferenceClickListener(this);
|
||||
|
||||
/* Debugging */
|
||||
/* Troubleshooting */
|
||||
Preference verboseLog = findPreference(Constants.PREF_VERBOSE_LOG);
|
||||
Preference openIssueTracker = findPreference(KEY_OPEN_ISSUE_TRACKER);
|
||||
Preference debugFacilitiesEnabled = findPreference(Constants.PREF_DEBUG_FACILITIES_ENABLED);
|
||||
Preference environmentVariables = findPreference("environment_variables");
|
||||
Preference stResetDatabase = findPreference("st_reset_database");
|
||||
Preference stResetDeltas = findPreference("st_reset_deltas");
|
||||
|
||||
verboseLog.setOnPreferenceClickListener(this);
|
||||
openIssueTracker.setOnPreferenceClickListener(this);
|
||||
debugFacilitiesEnabled.setOnPreferenceChangeListener(this);
|
||||
environmentVariables.setOnPreferenceChangeListener(this);
|
||||
|
@ -739,6 +744,20 @@ public class SettingsActivity extends SyncthingActivity {
|
|||
public boolean onPreferenceClick(Preference preference) {
|
||||
final Intent intent;
|
||||
switch (preference.getKey()) {
|
||||
case Constants.PREF_VERBOSE_LOG:
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.dialog_settings_restart_app_title)
|
||||
.setMessage(R.string.dialog_settings_restart_app_question)
|
||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||
getActivity().setResult(RESULT_RESTART_APP);
|
||||
getActivity().finish();
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, (dialogInterface, i) -> {
|
||||
// Revert.
|
||||
((CheckBoxPreference) preference).setChecked(!((CheckBoxPreference) preference).isChecked());
|
||||
})
|
||||
.show();
|
||||
return true;
|
||||
case KEY_OPEN_ISSUE_TRACKER:
|
||||
intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra(WebViewActivity.EXTRA_WEB_URL, getString(R.string.issue_tracker_url));
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.nutomic.syncthingandroid.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
|
@ -13,10 +15,12 @@ import android.widget.AdapterView;
|
|||
import android.widget.ListView;
|
||||
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.SyncthingApp;
|
||||
import com.nutomic.syncthingandroid.activities.DeviceActivity;
|
||||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
|
||||
import com.nutomic.syncthingandroid.model.Device;
|
||||
import com.nutomic.syncthingandroid.service.AppPrefs;
|
||||
import com.nutomic.syncthingandroid.service.Constants;
|
||||
import com.nutomic.syncthingandroid.service.RestApi;
|
||||
import com.nutomic.syncthingandroid.service.SyncthingService;
|
||||
|
@ -27,6 +31,8 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Displays a list of all existing devices.
|
||||
*/
|
||||
|
@ -35,7 +41,9 @@ public class DeviceListFragment extends ListFragment implements SyncthingService
|
|||
|
||||
private final static String TAG = "DeviceListFragment";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
@Inject SharedPreferences mPreferences;
|
||||
|
||||
/**
|
||||
* Compares devices by name, uses the device ID as fallback if the name is empty
|
||||
|
@ -59,6 +67,13 @@ public class DeviceListFragment extends ListFragment implements SyncthingService
|
|||
private DevicesAdapter mAdapter;
|
||||
private SyncthingService.State mServiceState = SyncthingService.State.INIT;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
((SyncthingApp) getActivity().getApplication()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
|||
|
||||
private static final String TAG = "DrawerFragment";
|
||||
|
||||
private static final int SETTINGS_SCREEN_REQUEST = 3460;
|
||||
|
||||
/**
|
||||
* These buttons might be accessible if the screen is big enough
|
||||
* or the user can scroll the drawer to access them.
|
||||
|
@ -194,7 +196,7 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
|||
mActivity.closeDrawer();
|
||||
break;
|
||||
case R.id.drawerActionSettings:
|
||||
startActivity(new Intent(mActivity, SettingsActivity.class));
|
||||
startActivityForResult(new Intent(mActivity, SettingsActivity.class), SETTINGS_SCREEN_REQUEST);
|
||||
mActivity.closeDrawer();
|
||||
break;
|
||||
case R.id.drawerActionExit:
|
||||
|
@ -220,12 +222,26 @@ public class DrawerFragment extends Fragment implements SyncthingService.OnServi
|
|||
}
|
||||
}
|
||||
|
||||
private void doExit() {
|
||||
private Boolean doExit() {
|
||||
if (mActivity == null || mActivity.isFinishing()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
Log.i(TAG, "Exiting app on user request");
|
||||
mActivity.stopService(new Intent(mActivity, SyncthingService.class));
|
||||
mActivity.finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives result of SettingsActivity.
|
||||
*/
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (requestCode == SETTINGS_SCREEN_REQUEST && resultCode == SettingsActivity.RESULT_RESTART_APP) {
|
||||
Log.d(TAG, "Got request to restart MainActivity");
|
||||
if (doExit()) {
|
||||
startActivity(new Intent(getActivity(), MainActivity.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.nutomic.syncthingandroid.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
|
@ -12,10 +14,12 @@ import android.view.View;
|
|||
import android.widget.AdapterView;
|
||||
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.SyncthingApp;
|
||||
import com.nutomic.syncthingandroid.activities.FolderActivity;
|
||||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
|
||||
import com.nutomic.syncthingandroid.model.Folder;
|
||||
import com.nutomic.syncthingandroid.service.AppPrefs;
|
||||
import com.nutomic.syncthingandroid.service.Constants;
|
||||
import com.nutomic.syncthingandroid.service.RestApi;
|
||||
import com.nutomic.syncthingandroid.service.SyncthingService;
|
||||
|
@ -24,6 +28,8 @@ import com.nutomic.syncthingandroid.views.FoldersAdapter;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Displays a list of all existing folders.
|
||||
*/
|
||||
|
@ -32,7 +38,9 @@ public class FolderListFragment extends ListFragment implements SyncthingService
|
|||
|
||||
private static final String TAG = "FolderListFragment";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
@Inject SharedPreferences mPreferences;
|
||||
|
||||
private Runnable mUpdateListRunnable = new Runnable() {
|
||||
@Override
|
||||
|
@ -47,6 +55,13 @@ public class FolderListFragment extends ListFragment implements SyncthingService
|
|||
private FoldersAdapter mAdapter;
|
||||
private SyncthingService.State mServiceState = SyncthingService.State.INIT;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
((SyncthingApp) getActivity().getApplication()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.nutomic.syncthingandroid.fragments;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
@ -16,11 +18,13 @@ import android.widget.ArrayAdapter;
|
|||
|
||||
import com.google.common.base.Optional;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.SyncthingApp;
|
||||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
|
||||
import com.nutomic.syncthingandroid.model.Connections;
|
||||
import com.nutomic.syncthingandroid.model.SystemStatus;
|
||||
import com.nutomic.syncthingandroid.service.AppPrefs;
|
||||
import com.nutomic.syncthingandroid.service.Constants;
|
||||
import com.nutomic.syncthingandroid.service.RestApi;
|
||||
import com.nutomic.syncthingandroid.service.SyncthingService;
|
||||
|
@ -32,6 +36,8 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Displays why syncthing is running or disabled.
|
||||
*/
|
||||
|
@ -39,7 +45,9 @@ public class StatusFragment extends ListFragment implements SyncthingService.OnS
|
|||
|
||||
private static final String TAG = "StatusFragment";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
@Inject SharedPreferences mPreferences;
|
||||
|
||||
private Runnable mRestApiQueryRunnable = new Runnable() {
|
||||
@Override
|
||||
|
@ -70,6 +78,13 @@ public class StatusFragment extends ListFragment implements SyncthingService.OnS
|
|||
private String mAnnounceServer = "";
|
||||
private String mUptime = "";
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
((SyncthingApp) getActivity().getApplication()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@ import com.android.volley.toolbox.StringRequest;
|
|||
import com.android.volley.toolbox.Volley;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import com.nutomic.syncthingandroid.service.AppPrefs;
|
||||
import com.nutomic.syncthingandroid.service.Constants;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -38,7 +40,7 @@ public abstract class ApiRequest {
|
|||
|
||||
private static final String TAG = "ApiRequest";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
/**
|
||||
* The name of the HTTP header used for the syncthing API key.
|
||||
|
@ -77,6 +79,7 @@ public abstract class ApiRequest {
|
|||
mUrl = url;
|
||||
mPath = path;
|
||||
mApiKey = apiKey;
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(context);
|
||||
}
|
||||
|
||||
Uri buildUri(Map<String, String> params) {
|
||||
|
|
|
@ -17,11 +17,15 @@ public class Completion {
|
|||
|
||||
private static final String TAG = "Completion";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
HashMap<String, HashMap<String, CompletionInfo>> deviceFolderMap =
|
||||
new HashMap<String, HashMap<String, CompletionInfo>>();
|
||||
|
||||
public Completion(Boolean enableVerboseLog) {
|
||||
ENABLE_VERBOSE_LOG = enableVerboseLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a folder from the cache model.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
package com.nutomic.syncthingandroid.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Provides preference getters and setters.
|
||||
*/
|
||||
public class AppPrefs {
|
||||
private static final String TAG = "AppPrefs";
|
||||
|
||||
private static final Boolean PREF_VERBOSE_LOG_DEFAULT = false;
|
||||
|
||||
public static final boolean getPrefVerboseLog(Context context) {
|
||||
if (context == null) {
|
||||
Log.e(TAG, "getPrefVerboseLog: context == null");
|
||||
return PREF_VERBOSE_LOG_DEFAULT;
|
||||
}
|
||||
return getPrefVerboseLog(PreferenceManager.getDefaultSharedPreferences(context));
|
||||
}
|
||||
|
||||
public static final boolean getPrefVerboseLog(SharedPreferences sharedPreferences) {
|
||||
if (sharedPreferences == null) {
|
||||
Log.e(TAG, "getPrefVerboseLog: sharedPreferences == null");
|
||||
return PREF_VERBOSE_LOG_DEFAULT;
|
||||
}
|
||||
return sharedPreferences.getBoolean(Constants.PREF_VERBOSE_LOG, PREF_VERBOSE_LOG_DEFAULT);
|
||||
}
|
||||
}
|
|
@ -33,8 +33,8 @@ public class Constants {
|
|||
public static final String PREF_SUGGEST_NEW_FOLDER_ROOT_DATA = "external_android_data";
|
||||
public static final String PREF_SUGGEST_NEW_FOLDER_ROOT_MEDIA = "external_android_media";
|
||||
|
||||
|
||||
// Preferences - Troubleshooting
|
||||
public static final String PREF_VERBOSE_LOG = "verbose_log";
|
||||
public static final String PREF_ENVIRONMENT_VARIABLES = "environment_variables";
|
||||
public static final String PREF_DEBUG_FACILITIES_ENABLED = "debug_facilities_enabled";
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public class EventProcessor implements Runnable, RestApi.OnReceiveEventListener
|
|||
|
||||
private static final String TAG = "EventProcessor";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
/**
|
||||
* Minimum interval in seconds at which the events are polled from syncthing and processed.
|
||||
|
@ -62,6 +62,7 @@ public class EventProcessor implements Runnable, RestApi.OnReceiveEventListener
|
|||
|
||||
public EventProcessor(Context context, RestApi restApi) {
|
||||
((SyncthingApp) context.getApplicationContext()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
mContext = context;
|
||||
mRestApi = restApi;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class RestApi {
|
|||
|
||||
private static final String TAG = "RestApi";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
/**
|
||||
* Compares folders by labels, uses the folder ID as fallback if the label is empty
|
||||
|
@ -143,18 +143,20 @@ public class RestApi {
|
|||
/**
|
||||
* Stores the latest result of device and folder completion events.
|
||||
*/
|
||||
private Completion mCompletion = new Completion();
|
||||
private Completion mCompletion;
|
||||
|
||||
private Gson mGson;
|
||||
|
||||
public RestApi(Context context, URL url, String apiKey, OnApiAvailableListener apiListener,
|
||||
OnConfigChangedListener configListener) {
|
||||
((SyncthingApp) context.getApplicationContext()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(context);
|
||||
mContext = context;
|
||||
mUrl = url;
|
||||
mApiKey = apiKey;
|
||||
mOnApiAvailableListener = apiListener;
|
||||
mOnConfigChangedListener = configListener;
|
||||
mCompletion = new Completion(ENABLE_VERBOSE_LOG);
|
||||
mGson = getGson();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class RunConditionMonitor {
|
|||
|
||||
private static final String TAG = "RunConditionMonitor";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
private static final String POWER_SOURCE_CHARGER_BATTERY = "ac_and_battery_power";
|
||||
private static final String POWER_SOURCE_CHARGER = "ac_power";
|
||||
|
@ -111,8 +111,9 @@ public class RunConditionMonitor {
|
|||
public RunConditionMonitor(Context context,
|
||||
OnShouldRunChangedListener onShouldRunChangedListener,
|
||||
OnSyncPreconditionChangedListener onSyncPreconditionChangedListener) {
|
||||
LogV("Created new instance");
|
||||
((SyncthingApp) context.getApplicationContext()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
LogV("Created new instance");
|
||||
mContext = context;
|
||||
res = mContext.getResources();
|
||||
mOnShouldRunChangedListener = onShouldRunChangedListener;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SyncthingRunnable implements Runnable {
|
|||
private static final String TAG_NATIVE = "SyncthingNativeCode";
|
||||
private static final String TAG_NICE = "SyncthingRunnableIoNice";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private static final int LOG_FILE_MAX_LINES = 10;
|
||||
|
||||
private static final AtomicReference<Process> mSyncthing = new AtomicReference<>();
|
||||
|
@ -84,6 +84,7 @@ public class SyncthingRunnable implements Runnable {
|
|||
*/
|
||||
public SyncthingRunnable(Context context, Command command) {
|
||||
((SyncthingApp) context.getApplicationContext()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
mContext = context;
|
||||
// Example: mSyncthingBinary="/data/app/com.github.catfriend1.syncthingandroid.debug-8HsN-IsVtZXc8GrE5-Hepw==/lib/x86/libsyncthing.so"
|
||||
mSyncthingBinary = Constants.getSyncthingBinary(mContext);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SyncthingService extends Service {
|
|||
|
||||
private static final String TAG = "SyncthingService";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
/**
|
||||
* Intent action to perform a Syncthing restart.
|
||||
|
@ -213,10 +213,11 @@ public class SyncthingService extends Service {
|
|||
*/
|
||||
@Override
|
||||
public void onCreate() {
|
||||
LogV("onCreate");
|
||||
super.onCreate();
|
||||
PRNGFixes.apply();
|
||||
((SyncthingApp) getApplication()).component().inject(this);
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(mPreferences);
|
||||
LogV("onCreate");
|
||||
mHandler = new Handler();
|
||||
|
||||
/**
|
||||
|
@ -521,7 +522,6 @@ public class SyncthingService extends Service {
|
|||
return;
|
||||
}
|
||||
|
||||
Log.v(TAG, "Starting syncthing");
|
||||
onServiceStateChange(State.STARTING);
|
||||
|
||||
if (mRestApi == null) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.nutomic.syncthingandroid.model.FolderIgnoreList;
|
|||
import com.nutomic.syncthingandroid.model.Gui;
|
||||
import com.nutomic.syncthingandroid.model.Options;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.service.AppPrefs;
|
||||
import com.nutomic.syncthingandroid.service.Constants;
|
||||
import com.nutomic.syncthingandroid.service.SyncthingRunnable;
|
||||
|
||||
|
@ -61,7 +62,7 @@ public class ConfigXml {
|
|||
|
||||
private static final String TAG = "ConfigXml";
|
||||
|
||||
private static final Boolean ENABLE_VERBOSE_LOG = false;
|
||||
private Boolean ENABLE_VERBOSE_LOG = false;
|
||||
|
||||
public class OpenConfigException extends RuntimeException {
|
||||
}
|
||||
|
@ -98,6 +99,7 @@ public class ConfigXml {
|
|||
|
||||
public ConfigXml(Context context) {
|
||||
mContext = context;
|
||||
ENABLE_VERBOSE_LOG = AppPrefs.getPrefVerboseLog(context);
|
||||
mConfigFile = Constants.getConfigFile(mContext);
|
||||
}
|
||||
|
||||
|
|
|
@ -569,6 +569,10 @@ Please report any problems you encounter via Github.</string>
|
|||
<string name="config_imported_successful">Config was imported</string>
|
||||
<string name="config_import_failed">Config import failed, make sure files are in %1$s</string>
|
||||
|
||||
<string name="dialog_settings_restart_app_title">Restart required</string>
|
||||
|
||||
<string name="dialog_settings_restart_app_question">Changing this option requires an immediate restart of the app. All other changes will be discarded. Continue?</string>
|
||||
|
||||
<!-- Title for the preference to set STTRACE parameters -->
|
||||
<string name="sttrace_title">STTRACE Options</string>
|
||||
|
||||
|
@ -601,6 +605,10 @@ Please report any problems you encounter via Github.</string>
|
|||
|
||||
<string name="category_about">About</string>
|
||||
|
||||
<string name="verbose_log_title">Verbose log</string>
|
||||
|
||||
<string name="verbose_log_summary">Enabling this option will help to generate debug logs at a very detailed level.</string>
|
||||
|
||||
<!-- Settings item that opens the log activity -->
|
||||
<string name="open_log">Open Log</string>
|
||||
|
||||
|
|
|
@ -78,12 +78,14 @@
|
|||
android:key="category_behaviour"
|
||||
android:title="@string/category_behaviour">
|
||||
|
||||
<!-- Autostart on boot -->
|
||||
<CheckBoxPreference
|
||||
android:key="always_run_in_background"
|
||||
android:title="@string/behaviour_autostart_title"
|
||||
android:summary="@string/behaviour_autostart_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<!-- Use root -->
|
||||
<CheckBoxPreference
|
||||
android:key="use_root"
|
||||
android:title="@string/use_root_title"
|
||||
|
@ -217,12 +219,21 @@
|
|||
<PreferenceScreen
|
||||
android:title="@string/category_debug">
|
||||
|
||||
<!-- Report issue -->
|
||||
<Preference
|
||||
android:key="open_issue_tracker"
|
||||
android:persistent="false"
|
||||
android:title="@string/report_issue_title">
|
||||
</Preference>
|
||||
|
||||
<!-- Verbose log -->
|
||||
<CheckBoxPreference
|
||||
android:key="verbose_log"
|
||||
android:title="@string/verbose_log_title"
|
||||
android:summary="@string/verbose_log_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<!-- Open Android or SyncthingNative log -->
|
||||
<Preference
|
||||
android:title="@string/open_log"
|
||||
android:summary="@string/open_log_summary">
|
||||
|
@ -230,21 +241,25 @@
|
|||
android:action=".activities.LogActivity" />
|
||||
</Preference>
|
||||
|
||||
<!-- STTRACE facility chooser dialog -->
|
||||
<com.nutomic.syncthingandroid.views.SttracePreference
|
||||
android:key="debug_facilities_enabled"
|
||||
android:title="@string/sttrace_title" />
|
||||
|
||||
<!-- Environment variables -->
|
||||
<EditTextPreference
|
||||
android:key="environment_variables"
|
||||
android:title="@string/environment_variables"
|
||||
android:singleLine="true"
|
||||
android:inputType="textNoSuggestions"/>
|
||||
|
||||
<!-- Reset database -->
|
||||
<Preference
|
||||
android:key="st_reset_database"
|
||||
android:title="@string/st_reset_database_title"
|
||||
android:singleLine="true" />
|
||||
|
||||
<!-- Reset index database -->
|
||||
<Preference
|
||||
android:key="st_reset_deltas"
|
||||
android:title="@string/st_reset_deltas_title"
|
||||
|
|
Loading…
Reference in a new issue