mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-30 05:44:51 +02:00
Switch to polling if battery optimizations enabled on Android 12+
This commit is contained in:
@@ -170,7 +170,16 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean enabled = prefs.getBoolean("enabled", true);
|
||||
int pollInterval = ServiceSynchronize.getPollInterval(context);
|
||||
return (!enabled || this.ondemand || (pollInterval > 0 && !this.poll_exempted));
|
||||
return (!enabled || this.ondemand || (pollInterval > 0 && !isExempted(context)));
|
||||
}
|
||||
|
||||
boolean isExempted(Context context) {
|
||||
if (Helper.isTarget(context, Build.VERSION_CODES.R)) {
|
||||
Boolean ignoring = Helper.isIgnoringOptimizations(context);
|
||||
if (ignoring != null && !ignoring)
|
||||
return false;
|
||||
}
|
||||
return this.poll_exempted;
|
||||
}
|
||||
|
||||
String getProtocol() {
|
||||
|
||||
Reference in New Issue
Block a user