From e8305d6e1674bcc7cdb4e99e50f48fbcfd23d4db Mon Sep 17 00:00:00 2001 From: Isaac Katzenelson Date: Tue, 3 Sep 2013 14:56:26 -0700 Subject: Use setExact on K and up only. Bug: 9926186 Change-Id: Ib81c56b01f1c28f811c0e96582582c4bb5d32c37 --- src/com/android/calendar/Utils.java | 9 +++++++++ src/com/android/calendar/alerts/AlertUtils.java | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java index fc409cd4..40a9e58d 100644 --- a/src/com/android/calendar/Utils.java +++ b/src/com/android/calendar/Utils.java @@ -207,6 +207,15 @@ public class Utils { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; } + /** + * Returns whether the SDK is the KeyLimePie release 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 int getViewTypeFromIntentAndSharedPref(Activity activity) { Intent intent = activity.getIntent(); Bundle extras = intent.getExtras(); diff --git a/src/com/android/calendar/alerts/AlertUtils.java b/src/com/android/calendar/alerts/AlertUtils.java index a082fdf7..fec7b111 100644 --- a/src/com/android/calendar/alerts/AlertUtils.java +++ b/src/com/android/calendar/alerts/AlertUtils.java @@ -88,7 +88,11 @@ public class AlertUtils { return new AlarmManagerInterface() { @Override public void set(int type, long triggerAtMillis, PendingIntent operation) { - mgr.set(type, triggerAtMillis, operation); + if (Utils.isKeyLimePieOrLater()) { + mgr.setExact(type, triggerAtMillis, operation); + } else { + mgr.set(type, triggerAtMillis, operation); + } } }; } -- cgit v1.2.3