From b8f6061f30a8f5eedf7ec5735b5162aa605a88d4 Mon Sep 17 00:00:00 2001 From: Gitsaibot Date: Thu, 18 Jul 2024 22:09:36 +0200 Subject: [PATCH] Remove obsolete version check --- .../main/java/com/android/calendar/Utils.java | 7 ------- .../calendar/alerts/AlertReceiver.java | 19 ++++++++----------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/android/calendar/Utils.java b/app/src/main/java/com/android/calendar/Utils.java index ee0732b48..fd7396b46 100644 --- a/app/src/main/java/com/android/calendar/Utils.java +++ b/app/src/main/java/com/android/calendar/Utils.java @@ -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. * diff --git a/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java b/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java index 2af76a4de..caf099ff1 100644 --- a/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java +++ b/app/src/main/java/com/android/calendar/alerts/AlertReceiver.java @@ -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"); } + } }