Skip to content

Commit

Permalink
Remove obsolete version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitsaibot authored and Gitsaibot committed Jul 20, 2024
1 parent f34880f commit b8f6061
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
7 changes: 0 additions & 7 deletions app/src/main/java/com/android/calendar/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,6 @@ public static boolean isOreoOrLater() {
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.
*
Expand Down
19 changes: 8 additions & 11 deletions app/src/main/java/com/android/calendar/alerts/AlertReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,19 @@ public static void beginStartingService(Context context, Intent intent) {
}
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");
}

}
}

Expand Down

0 comments on commit b8f6061

Please sign in to comment.