Remove obsolete version check

This commit is contained in:
Gitsaibot 2024-07-18 22:09:36 +02:00 committed by Gitsaibot
parent f34880f1d8
commit b8f6061f30
2 changed files with 8 additions and 18 deletions

View File

@ -234,13 +234,6 @@ public class Utils {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
}
/**
* Returns whether the SDK is the Marshmallow release or later.
*/
public static boolean isMOrLater() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}
/**
* Returns whether the system supports Material You.
*

View File

@ -132,22 +132,19 @@ public class AlertReceiver extends BroadcastReceiver {
}
mStartingService.acquire();
if (Utils.isMOrLater()) {
if (pm.isIgnoringBatteryOptimizations(context.getPackageName())) {
if (Utils.isOreoOrLater()) {
if (Utils.isUpsideDownCakeOrLater() && !Utils.canScheduleAlarms(context)) {
return;
}
context.startForegroundService(intent);
} else {
context.startService(intent);
if (pm.isIgnoringBatteryOptimizations(context.getPackageName())) {
if (Utils.isOreoOrLater()) {
if (Utils.isUpsideDownCakeOrLater() && !Utils.canScheduleAlarms(context)) {
return;
}
context.startForegroundService(intent);
} else {
Log.d(TAG, "Battery optimizations are not disabled");
context.startService(intent);
}
} else {
context.startService(intent);
Log.d(TAG, "Battery optimizations are not disabled");
}
}
}