Android 12 foreground restrictions

This commit is contained in:
M66B
2021-09-23 20:06:00 +02:00
parent 0903fb77ea
commit 244b6df87e
13 changed files with 94 additions and 73 deletions

View File

@@ -2721,11 +2721,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
static int getPollInterval(Context context) {
if (Helper.isTarget(context, Build.VERSION_CODES.R)) {
Boolean ignoring = Helper.isIgnoringOptimizations(context);
if (ignoring != null && !ignoring)
return 15;
}
if (Helper.isOptimizing12(context))
return (BuildConfig.DEBUG ? 2 : 15);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getInt("poll_interval", 0); // minutes