From 9db9d1cd0bf064a018d8c82356cae049bd84ace5 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 8 Sep 2023 19:54:17 +0200 Subject: [PATCH] Small improvement --- app/src/main/java/eu/faircode/email/ApplicationEx.java | 7 +++++-- .../java/eu/faircode/email/FragmentOptionsConnection.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index 3a8d9d55a1..71dc8487a5 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -136,7 +136,7 @@ public class ApplicationEx extends Application }); if (BuildConfig.DEBUG && - Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && false) { StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder(StrictMode.getVmPolicy()) .detectNonSdkApiUsage() .penaltyListener(getMainExecutor(), new StrictMode.OnVmViolationListener() { @@ -204,7 +204,10 @@ public class ApplicationEx extends Application try { boolean tcp_keep_alive = prefs.getBoolean("tcp_keep_alive", false); - System.setProperty("fairemail.tcp_keep_alive", Boolean.toString(tcp_keep_alive)); + if (tcp_keep_alive) + System.setProperty("fairemail.tcp_keep_alive", Boolean.toString(tcp_keep_alive)); + else + System.clearProperty("fairemail.tcp_keep_alive"); } catch (Throwable ex) { Log.e(ex); } diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java index 5b41e95bab..c4770aa237 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsConnection.java @@ -286,11 +286,11 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { try { + prefs.edit().putBoolean("tcp_keep_alive", checked).apply(); if (checked) System.setProperty("fairemail.tcp_keep_alive", Boolean.toString(checked)); else System.clearProperty("fairemail.tcp_keep_alive"); - prefs.edit().putBoolean("tcp_keep_alive", checked).apply(); } catch (Throwable ex) { Log.e(ex); }