Fixed problem with default logging preference settings being incorrect

This commit is contained in:
Graham Jones
2022-01-28 23:04:44 +00:00
parent 438f0cb0b9
commit fd1aff80b1
8 changed files with 22 additions and 17 deletions

Binary file not shown.

View File

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="uk.org.openseizuredetector" package="uk.org.openseizuredetector"
android:versionCode="92" android:versionCode="92"
android:versionName="4.0.0a"> android:versionName="4.0.0b">
<!-- android:allowBackup="false" --> <!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

View File

@@ -137,8 +137,8 @@ public class OsdUtil implements ActivityCompat.OnRequestPermissionsResultCallbac
try { try {
mLogAlarms = SP.getBoolean("LogAlarms", true); mLogAlarms = SP.getBoolean("LogAlarms", true);
Log.v(TAG, "updatePrefs() - mLogAlarms = " + mLogAlarms); Log.v(TAG, "updatePrefs() - mLogAlarms = " + mLogAlarms);
mLogData = SP.getBoolean("LogData", false); mLogData = SP.getBoolean("LogData", true);
Log.v(TAG, "updatePrefs() - mLogData = " + mLogData); Log.v(TAG, "OsdUtil.updatePrefs() - mLogData = " + mLogData);
mLogSystem = SP.getBoolean("LogSystem", true); mLogSystem = SP.getBoolean("LogSystem", true);
Log.v(TAG, "updatePrefs() - mLogSystem = " + mLogSystem); Log.v(TAG, "updatePrefs() - mLogSystem = " + mLogSystem);

View File

@@ -1211,7 +1211,7 @@ public class SdServer extends Service implements SdDataReceiver {
Log.v(TAG, "updatePrefs() - mLogAlarms = " + mLogAlarms); Log.v(TAG, "updatePrefs() - mLogAlarms = " + mLogAlarms);
mUtil.writeToSysLogFile("updatePrefs() - mLogAlarms = " + mLogAlarms); mUtil.writeToSysLogFile("updatePrefs() - mLogAlarms = " + mLogAlarms);
mLogData = SP.getBoolean("LogData", true); mLogData = SP.getBoolean("LogData", true);
Log.v(TAG, "updatePrefs() - mLogData = " + mLogData); Log.v(TAG, "SdServer.updatePrefs() - mLogData = " + mLogData);
mUtil.writeToSysLogFile( "updatePrefs() - mLogData = " + mLogData); mUtil.writeToSysLogFile( "updatePrefs() - mLogData = " + mLogData);
mLogDataRemote = SP.getBoolean("LogDataRemote", false); mLogDataRemote = SP.getBoolean("LogDataRemote", false);
Log.v(TAG, "updatePrefs() - mLogDataRemote = " + mLogDataRemote); Log.v(TAG, "updatePrefs() - mLogDataRemote = " + mLogDataRemote);
@@ -1589,9 +1589,9 @@ public class SdServer extends Service implements SdDataReceiver {
if (mEventsTimer != null) { if (mEventsTimer != null) {
Log.v(TAG, "stopEventsTimer(): timer already running - cancelling it."); Log.v(TAG, "stopEventsTimer(): timer already running - cancelling it.");
mUtil.writeToSysLogFile("stopEventsTimer() - stopping timer"); mUtil.writeToSysLogFile("stopEventsTimer() - stopping timer");
mEventsTimer.mIsRunning = false;
mEventsTimer.cancel(); mEventsTimer.cancel();
mEventsTimer = null; mEventsTimer = null;
mEventsTimer.mIsRunning = false;
} else { } else {
Log.v(TAG, "stopEventsTimer(): timer not running - not doing anything."); Log.v(TAG, "stopEventsTimer(): timer not running - not doing anything.");
} }

View File

@@ -86,6 +86,15 @@ public class StartupActivity extends Activity {
.addCommaSeparatedEmailAddresses("crashreports@openseizuredetector.org.uk,") .addCommaSeparatedEmailAddresses("crashreports@openseizuredetector.org.uk,")
.build(); .build();
// Read the default settings from the xml preferences files, so we do
// not have to use the hard coded ones in the java files.
PreferenceManager.setDefaultValues(this, R.xml.alarm_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.general_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.network_datasource_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.pebble_datasource_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.seizure_detector_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.network_passive_datasource_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.logging_prefs, true);
mHandler = new Handler(); mHandler = new Handler();
mUtil = new OsdUtil(getApplicationContext(), mHandler); mUtil = new OsdUtil(getApplicationContext(), mHandler);
@@ -100,15 +109,6 @@ public class StartupActivity extends Activity {
setContentView(R.layout.startup_activity); setContentView(R.layout.startup_activity);
// Read the default settings from the xml preferences files, so we do
// not have to use the hard coded ones in the java files.
PreferenceManager.setDefaultValues(this, R.xml.alarm_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.general_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.network_datasource_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.pebble_datasource_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.seizure_detector_prefs, true);
PreferenceManager.setDefaultValues(this, R.xml.network_passive_datasource_prefs, true);
Button b; Button b;

View File

@@ -70,6 +70,7 @@
android:title="Enable Phone Call Alarm" /> android:title="Enable Phone Call Alarm" />
</PreferenceCategory> </PreferenceCategory>
--> -->
<!--
<PreferenceCategory android:title="@string/AlarmLoggingTitle"> <PreferenceCategory android:title="@string/AlarmLoggingTitle">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
@@ -82,4 +83,5 @@
android:summary="@string/log_data_summary" android:summary="@string/log_data_summary"
android:title="@string/log_data_title"/> android:title="@string/log_data_title"/>
</PreferenceCategory> </PreferenceCategory>
-->
</PreferenceScreen> </PreferenceScreen>

View File

@@ -6,7 +6,7 @@
android:summary="@string/select_datasource_summary" android:summary="@string/select_datasource_summary"
android:entries="@array/datasource_list" android:entries="@array/datasource_list"
android:entryValues="@array/datasource_list_values" android:entryValues="@array/datasource_list_values"
android:defaultValue="Garmin" android:defaultValue="Phone"
android:dialogTitle="@string/select_datasource_title" /> android:dialogTitle="@string/select_datasource_title" />
<Preference <Preference
android:key="SelectBLEDevice" android:key="SelectBLEDevice"
@@ -14,6 +14,7 @@
android:summary="@string/select_ble_device_desc" android:summary="@string/select_ble_device_desc"
android:widgetLayout="@layout/pref_select_ble_device_button" android:widgetLayout="@layout/pref_select_ble_device_button"
/> />
<!--
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="LogAlarms" android:key="LogAlarms"
@@ -55,6 +56,8 @@
android:key="OSDUrl" android:key="OSDUrl"
android:summary="@string/remote_url_summary" android:summary="@string/remote_url_summary"
android:title="@string/remote_url_title" /> android:title="@string/remote_url_title" />
-->
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="PreventSleep" android:key="PreventSleep"

View File

@@ -16,7 +16,7 @@
android:summary="@string/eventDurationSummary" android:summary="@string/eventDurationSummary"
android:title="@string/eventDurationTitle" /> android:title="@string/eventDurationTitle" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="true"
android:key="AutoPruneDb" android:key="AutoPruneDb"
android:summary="@string/AutoPruneDbSummary" android:summary="@string/AutoPruneDbSummary"
android:title="@string/AutoPruneDbTitle" /> android:title="@string/AutoPruneDbTitle" />
@@ -27,7 +27,7 @@
android:title="@string/dataRetentionPeriodTitle" /> android:title="@string/dataRetentionPeriodTitle" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="true"
android:key="LogDataRemote" android:key="LogDataRemote"
android:summary="@string/log_data_remote_summary" android:summary="@string/log_data_remote_summary"
android:title="@string/log_data_remote_title" /> android:title="@string/log_data_remote_title" />