Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ff2962d authored by Isaac Katzenelson's avatar Isaac Katzenelson Committed by Isaac Katzenelson
Browse files

Update SDK version check

Bug: 10732543
Change-Id: I5141cee374778888f6b27ea9726ccdee0daca7cd
(cherry picked from commit f1ce98a6)
parent 5544e59d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class DigitalAppWidgetProvider extends AppWidgetProvider {
            PendingIntent quarterlyIntent = getOnQuarterHourPendingIntent(context);
            AlarmManager alarmManager = ((AlarmManager) context
                    .getSystemService(Context.ALARM_SERVICE));
            if (Utils.isKeyLimePieOrLater()) {
            if (Utils.isKitKatOrLater()) {
                alarmManager.setExact(AlarmManager.RTC, onQuarterHour, quarterlyIntent);
            } else {
                alarmManager.set(AlarmManager.RTC, onQuarterHour, quarterlyIntent);
+3 −5
Original line number Diff line number Diff line
@@ -77,12 +77,10 @@ public class Utils {
    public static final String CLOCK_TYPE_ANALOG = "analog";

    /**
     * Returns whether the SDK is the KeyLimePie release or later.
     * Returns whether the SDK is KitKat or later
     */
    public static boolean isKeyLimePieOrLater() {
        // TODO when SDK is set to 19, switch back to this:
//      return Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2;
        return "KeyLimePie".equals(Build.VERSION.CODENAME);
    public static boolean isKitKatOrLater() {
        return Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2;
    }


+1 −1
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ public final class AlarmStateManager extends BroadcastReceiver {
                stateChangeIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        if (Utils.isKeyLimePieOrLater()) {
        if (Utils.isKitKatOrLater()) {
            am.setExact(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
        } else {
            am.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent);
+2 −2
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public class TimerReceiver extends BroadcastReceiver {
        PendingIntent p = PendingIntent.getBroadcast(context,
                0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT);
        if (t != null) {
            if (Utils.isKeyLimePieOrLater()) {
            if (Utils.isKitKatOrLater()) {
                mngr.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p);
            } else {
                mngr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextTimesup, p);
@@ -311,7 +311,7 @@ public class TimerReceiver extends BroadcastReceiver {
                PendingIntent.getBroadcast(context, 0, nextBroadcast, 0);
        AlarmManager alarmManager =
                (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        if (Utils.isKeyLimePieOrLater()) {
        if (Utils.isKitKatOrLater()) {
            alarmManager.setExact(AlarmManager.ELAPSED_REALTIME, nextBroadcastTime, pendingNextBroadcast);
        } else {
            alarmManager.set(AlarmManager.ELAPSED_REALTIME, nextBroadcastTime, pendingNextBroadcast);