summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2011-06-24 16:42:02 -0700
committerAndy McFadden <fadden@android.com>2011-06-24 16:53:55 -0700
commitc820145eca703ab29ab799e0c00e696878a8045f (patch)
tree5b1812293bc70b4a538183b579c0b0cbc25dc350
parent808be0d0645c5f2c61cf0ae785bc52ceb8867bcd (diff)
downloadframeworks_base-c820145eca703ab29ab799e0c00e696878a8045f.zip
frameworks_base-c820145eca703ab29ab799e0c00e696878a8045f.tar.gz
frameworks_base-c820145eca703ab29ab799e0c00e696878a8045f.tar.bz2
Reduce definition of monthly rep test
The repeatsMonthlyOnDayCount() function was returning true for events like FREQ=MONTHLY;BYDAY=TU which actually appear weekly. This is not the desired behavior of the function. Bug 4522027 Change-Id: I03ef68b429828097c8bad7fcd374e7c9eb4c7b03
-rw-r--r--core/java/android/pim/EventRecurrence.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/pim/EventRecurrence.java b/core/java/android/pim/EventRecurrence.java
index cde7dac..830f63f 100644
--- a/core/java/android/pim/EventRecurrence.java
+++ b/core/java/android/pim/EventRecurrence.java
@@ -456,6 +456,19 @@ public class EventRecurrence {
return true;
}
+ /**
+ * Determines whether this rule specifies a simple monthly rule by weekday, such as
+ * "FREQ=MONTHLY;BYDAY=3TU" (the 3rd Tuesday of every month).
+ * <p>
+ * Negative days, e.g. "FREQ=MONTHLY;BYDAY=-1TU" (the last Tuesday of every month),
+ * will cause "false" to be returned.
+ * <p>
+ * Rules that fire every week, such as "FREQ=MONTHLY;BYDAY=TU" (every Tuesday of every
+ * month) will cause "false" to be returned. (Note these are usually expressed as
+ * WEEKLY rules, and hence are uncommon.)
+ *
+ * @return true if this rule is of the appropriate form
+ */
public boolean repeatsMonthlyOnDayCount() {
if (this.freq != MONTHLY) {
return false;
@@ -465,6 +478,10 @@ public class EventRecurrence {
return false;
}
+ if (bydayNum[0] <= 0) {
+ return false;
+ }
+
return true;
}