diff --git a/app/src/main/java/eu/faircode/email/ActivitySetup.java b/app/src/main/java/eu/faircode/email/ActivitySetup.java
index 0a8da33c6a..78bced347c 100644
--- a/app/src/main/java/eu/faircode/email/ActivitySetup.java
+++ b/app/src/main/java/eu/faircode/email/ActivitySetup.java
@@ -993,7 +993,8 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
if ("secure".equals(key) ||
"shortcuts".equals(key) ||
"language".equals(key) ||
- "query_threads".equals(key))
+ "query_threads".equals(key) ||
+ "wal".equals(key))
continue;
if (key != null && key.startsWith("widget."))
diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java
index d9db20080a..87cb50111a 100644
--- a/app/src/main/java/eu/faircode/email/ApplicationEx.java
+++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java
@@ -196,6 +196,7 @@ public class ApplicationEx extends Application
case "shortcuts": // misc
case "language": // misc
case "query_threads": // misc
+ case "wal": // misc
// Should be excluded for import
restart();
break;
diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java
index 819a6000f6..1be8c7b78e 100644
--- a/app/src/main/java/eu/faircode/email/DB.java
+++ b/app/src/main/java/eu/faircode/email/DB.java
@@ -266,14 +266,15 @@ public abstract class DB extends RoomDatabase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int threads = prefs.getInt("query_threads", 4); // AndroidX default thread count: 4
- Log.i("Query threads=" + threads);
+ boolean wal = prefs.getBoolean("wal", true);
+ Log.i("DB query threads=" + threads + " wal=" + wal);
ExecutorService executor = Helper.getBackgroundExecutor(threads, "query");
return Room
.databaseBuilder(context, DB.class, DB_NAME)
.openHelperFactory(new RequerySQLiteOpenHelperFactory())
.setQueryExecutor(executor)
- .setJournalMode(JournalMode.WRITE_AHEAD_LOGGING) // using the latest sqlite
+ .setJournalMode(wal ? JournalMode.WRITE_AHEAD_LOGGING : JournalMode.TRUNCATE) // using the latest sqlite
.addCallback(new Callback() {
@Override
public void onOpen(@NonNull SupportSQLiteDatabase db) {
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
index 2223b6d8b8..4b802d03ea 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java
@@ -98,6 +98,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swExperiments;
private TextView tvExperimentsHint;
private SwitchCompat swQueries;
+ private SwitchCompat swWal;
private SwitchCompat swCrashReports;
private TextView tvUuid;
private Button btnReset;
@@ -133,7 +134,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"shortcuts", "fts",
"classification", "class_min_probability", "class_min_difference",
"language", "watchdog", "updates",
- "experiments", "query_threads", "crash_reports", "cleanup_attachments",
+ "experiments", "wal", "query_threads", "crash_reports", "cleanup_attachments",
"protocol", "debug", "perform_expunge", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl"
};
@@ -193,6 +194,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swExperiments = view.findViewById(R.id.swExperiments);
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
swQueries = view.findViewById(R.id.swQueries);
+ swWal = view.findViewById(R.id.swWal);
swCrashReports = view.findViewById(R.id.swCrashReports);
tvUuid = view.findViewById(R.id.tvUuid);
btnReset = view.findViewById(R.id.btnReset);
@@ -404,6 +406,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
+ swWal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("wal", checked).commit(); // apply won't work here
+ }
+ });
+
swCrashReports.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -852,6 +861,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
? View.GONE : View.VISIBLE);
swExperiments.setChecked(prefs.getBoolean("experiments", false));
swQueries.setChecked(prefs.getInt("query_threads", 4) < 4);
+ swWal.setChecked(prefs.getBoolean("wal", true));
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
tvUuid.setText(prefs.getString("uuid", null));
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml
index 9316bcbf1f..174348aa05 100644
--- a/app/src/main/res/layout/fragment_options_misc.xml
+++ b/app/src/main/res/layout/fragment_options_misc.xml
@@ -338,6 +338,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvQueriesHint" />
+
+
Check for GitHub updates
Try experimental features
Limit parallel database access
+ WAL (debug only)
Send error reports
Protocol logging
Debug mode