mirror of https://github.com/M66B/FairEmail.git
Debug: added leak canary option
This commit is contained in:
parent
ed330a6d91
commit
08f8ad4d15
|
@ -158,6 +158,7 @@ public class ApplicationEx extends Application
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
final boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
final boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
||||||
|
final boolean leak_canary = prefs.getBoolean("leak_canary", false);
|
||||||
final boolean load_emoji = prefs.getBoolean("load_emoji", BuildConfig.PLAY_STORE_RELEASE);
|
final boolean load_emoji = prefs.getBoolean("load_emoji", BuildConfig.PLAY_STORE_RELEASE);
|
||||||
|
|
||||||
prev = Thread.getDefaultUncaughtExceptionHandler();
|
prev = Thread.getDefaultUncaughtExceptionHandler();
|
||||||
|
@ -182,7 +183,7 @@ public class ApplicationEx extends Application
|
||||||
});
|
});
|
||||||
|
|
||||||
Log.setup(this);
|
Log.setup(this);
|
||||||
CoalMine.setup(crash_reports);
|
CoalMine.setup(leak_canary);
|
||||||
|
|
||||||
upgrade(this);
|
upgrade(this);
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
private TextView tvExperimentsHint;
|
private TextView tvExperimentsHint;
|
||||||
private SwitchCompat swCrashReports;
|
private SwitchCompat swCrashReports;
|
||||||
private TextView tvUuid;
|
private TextView tvUuid;
|
||||||
|
private SwitchCompat swCanary;
|
||||||
private Button btnReset;
|
private Button btnReset;
|
||||||
private SwitchCompat swCleanupAttachments;
|
private SwitchCompat swCleanupAttachments;
|
||||||
private Button btnCleanup;
|
private Button btnCleanup;
|
||||||
|
@ -203,7 +204,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
"classification", "class_min_probability", "class_min_difference",
|
"classification", "class_min_probability", "class_min_difference",
|
||||||
"language", "deepl_enabled", "watchdog",
|
"language", "deepl_enabled", "watchdog",
|
||||||
"updates", "weekly", "show_changelog",
|
"updates", "weekly", "show_changelog",
|
||||||
"experiments", "crash_reports", "cleanup_attachments",
|
"experiments", "crash_reports", "leak_canary", "cleanup_attachments",
|
||||||
"protocol", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",
|
"protocol", "debug", "log_level", "test1", "test2", "test3", "test4", "test5",
|
||||||
"work_manager", // "external_storage",
|
"work_manager", // "external_storage",
|
||||||
"query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache",
|
"query_threads", "wal", "sqlite_checkpoints", "sqlite_analyze", "sqlite_cache",
|
||||||
|
@ -287,6 +288,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
|
tvExperimentsHint = view.findViewById(R.id.tvExperimentsHint);
|
||||||
swCrashReports = view.findViewById(R.id.swCrashReports);
|
swCrashReports = view.findViewById(R.id.swCrashReports);
|
||||||
tvUuid = view.findViewById(R.id.tvUuid);
|
tvUuid = view.findViewById(R.id.tvUuid);
|
||||||
|
swCanary = view.findViewById(R.id.swCanary);
|
||||||
btnReset = view.findViewById(R.id.btnReset);
|
btnReset = view.findViewById(R.id.btnReset);
|
||||||
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
|
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
|
||||||
btnCleanup = view.findViewById(R.id.btnCleanup);
|
btnCleanup = view.findViewById(R.id.btnCleanup);
|
||||||
|
@ -662,6 +664,14 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
.putBoolean("crash_reports", checked)
|
.putBoolean("crash_reports", checked)
|
||||||
.apply();
|
.apply();
|
||||||
Log.setCrashReporting(checked);
|
Log.setCrashReporting(checked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
swCanary.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||||
|
swCanary.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
prefs.edit().putBoolean("leak_canary", checked).apply();
|
||||||
CoalMine.setup(checked);
|
CoalMine.setup(checked);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1671,6 +1681,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
swExperiments.setChecked(prefs.getBoolean("experiments", false));
|
swExperiments.setChecked(prefs.getBoolean("experiments", false));
|
||||||
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
|
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
|
||||||
tvUuid.setText(prefs.getString("uuid", null));
|
tvUuid.setText(prefs.getString("uuid", null));
|
||||||
|
swCanary.setChecked(prefs.getBoolean("leak_canary", false));
|
||||||
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
|
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
|
||||||
|
|
||||||
swProtocol.setChecked(prefs.getBoolean("protocol", false));
|
swProtocol.setChecked(prefs.getBoolean("protocol", false));
|
||||||
|
|
|
@ -453,6 +453,17 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/swCrashReports" />
|
app:layout_constraintTop_toBottomOf="@id/swCrashReports" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swCanary"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_advanced_canary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvUuid"
|
||||||
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnReset"
|
android:id="@+id/btnReset"
|
||||||
style="?android:attr/buttonStyleSmall"
|
style="?android:attr/buttonStyleSmall"
|
||||||
|
@ -463,7 +474,7 @@
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:text="@string/title_setup_reset_questions"
|
android:text="@string/title_setup_reset_questions"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvUuid" />
|
app:layout_constraintTop_toBottomOf="@id/swCanary" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swCleanupAttachments"
|
android:id="@+id/swCleanupAttachments"
|
||||||
|
|
|
@ -699,6 +699,7 @@
|
||||||
<string name="title_advanced_changelog">Show changelog after update</string>
|
<string name="title_advanced_changelog">Show changelog after update</string>
|
||||||
<string name="title_advanced_experiments">Try experimental features</string>
|
<string name="title_advanced_experiments">Try experimental features</string>
|
||||||
<string name="title_advanced_crash_reports">Send error reports</string>
|
<string name="title_advanced_crash_reports">Send error reports</string>
|
||||||
|
<string name="title_advanced_canary" translatable="false">Leak canary</string>
|
||||||
<string name="title_advanced_cleanup_attachments">Delete attachments of old messages</string>
|
<string name="title_advanced_cleanup_attachments">Delete attachments of old messages</string>
|
||||||
<string name="title_advanced_cleanup">Cleanup</string>
|
<string name="title_advanced_cleanup">Cleanup</string>
|
||||||
<string name="title_advanced_last_cleanup">Last cleanup: %1$s</string>
|
<string name="title_advanced_last_cleanup">Last cleanup: %1$s</string>
|
||||||
|
|
Loading…
Reference in New Issue