Small improvement

This commit is contained in:
M66B 2023-09-08 19:54:17 +02:00
parent df891acc75
commit 9db9d1cd0b
2 changed files with 6 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);
}