Small improvement

pull/214/head
M66B 1 year ago
parent df891acc75
commit 9db9d1cd0b

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

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

Loading…
Cancel
Save