mirror of https://github.com/M66B/FairEmail.git
Added option to turn off logarithmic back-off
This commit is contained in:
parent
dd0c68b918
commit
148092cdf6
|
@ -159,6 +159,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swKeepAlivePoll;
|
||||
private SwitchCompat swEmptyPool;
|
||||
private SwitchCompat swIdleDone;
|
||||
private SwitchCompat swLogarithmicBackoff;
|
||||
private SwitchCompat swExactAlarms;
|
||||
private SwitchCompat swInfra;
|
||||
private SwitchCompat swDupMsgId;
|
||||
|
@ -199,7 +200,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
"chunk_size", "undo_manager", "webview_legacy",
|
||||
"use_modseq", "uid_command", "perform_expunge", "uid_expunge",
|
||||
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop",
|
||||
"keep_alive_poll", "empty_pool", "idle_done",
|
||||
"keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff",
|
||||
"exact_alarms", "infra", "dup_msgids", "test_iab"
|
||||
};
|
||||
|
||||
|
@ -312,6 +313,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swKeepAlivePoll = view.findViewById(R.id.swKeepAlivePoll);
|
||||
swEmptyPool = view.findViewById(R.id.swEmptyPool);
|
||||
swIdleDone = view.findViewById(R.id.swIdleDone);
|
||||
swLogarithmicBackoff = view.findViewById(R.id.swLogarithmicBackoff);
|
||||
swExactAlarms = view.findViewById(R.id.swExactAlarms);
|
||||
swInfra = view.findViewById(R.id.swInfra);
|
||||
swDupMsgId = view.findViewById(R.id.swDupMsgId);
|
||||
|
@ -1042,6 +1044,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swLogarithmicBackoff.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("logarithmic_backoff", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swExactAlarms.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -1614,6 +1623,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
swKeepAlivePoll.setChecked(prefs.getBoolean("keep_alive_poll", false));
|
||||
swEmptyPool.setChecked(prefs.getBoolean("empty_pool", true));
|
||||
swIdleDone.setChecked(prefs.getBoolean("idle_done", true));
|
||||
swLogarithmicBackoff.setChecked(prefs.getBoolean("logarithmic_backoff", true));
|
||||
swExactAlarms.setChecked(prefs.getBoolean("exact_alarms", true));
|
||||
swInfra.setChecked(prefs.getBoolean("infra", false));
|
||||
swDupMsgId.setChecked(prefs.getBoolean("dup_msgids", false));
|
||||
|
|
|
@ -2365,8 +2365,14 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
|
||||
int backoff = state.getBackoff();
|
||||
int recently = (lastLost + LOST_RECENTLY < now ? 1 : 2);
|
||||
boolean logarithmic_backoff = prefs.getBoolean("logarithmic_backoff", true);
|
||||
EntityLog.log(this, EntityLog.Type.Account, account,
|
||||
account.name + " backoff=" + backoff + " recently=" + recently + "x");
|
||||
account.name + " backoff=" + backoff +
|
||||
" recently=" + recently + "x" +
|
||||
" logarithmic=" + logarithmic_backoff);
|
||||
|
||||
if (!logarithmic_backoff)
|
||||
backoff = CONNECT_BACKOFF_START;
|
||||
|
||||
if (backoff < CONNECT_BACKOFF_MAX)
|
||||
state.setBackoff(backoff * 2);
|
||||
|
|
|
@ -1028,6 +1028,31 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/swEmptyPool"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swLogarithmicBackoff"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_logarithmic_backoff"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swIdleDone"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvLogarithmicBackoffHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_logarithmic_backoff_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swLogarithmicBackoff" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swExactAlarms"
|
||||
android:layout_width="0dp"
|
||||
|
@ -1036,7 +1061,7 @@
|
|||
android:text="@string/title_advanced_exact_alarms"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swIdleDone"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLogarithmicBackoffHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
|
@ -723,6 +723,8 @@
|
|||
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
|
||||
<string name="title_advanced_auth_apop" translatable="false">APOP</string>
|
||||
<string name="title_advanced_idle_done" translatable="false">IDLE/DONE</string>
|
||||
<string name="title_advanced_logarithmic_backoff" translatable="false">Logarithmic back-off</string>
|
||||
<string name="title_advanced_logarithmic_backoff_hint" translatable="false">Turning this off can result in a significant increase in battery usage!</string>
|
||||
<string name="title_advanced_keep_alive_poll" translatable="false">Poll on keep-alive</string>
|
||||
<string name="title_advanced_empty_pool" translatable="false">Empty connection pool</string>
|
||||
<string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string>
|
||||
|
|
Loading…
Reference in New Issue