diff options
author | James Lemieux <jplemieux@google.com> | 2016-12-05 17:09:35 -0800 |
---|---|---|
committer | James Lemieux <jplemieux@google.com> | 2016-12-05 17:09:35 -0800 |
commit | d8acc9943a70ced1f23c931ca60888d2f38de379 (patch) | |
tree | d63555133c909ef3adef9309bbe430163f30e3ea /src/com | |
parent | 0777a082e248c33c2e5a32690bfcdbd5de7d3f9e (diff) | |
download | android_packages_apps_DeskClock-d8acc9943a70ced1f23c931ca60888d2f38de379.tar.gz android_packages_apps_DeskClock-d8acc9943a70ced1f23c931ca60888d2f38de379.tar.bz2 android_packages_apps_DeskClock-d8acc9943a70ced1f23c931ca60888d2f38de379.zip |
Adjust alarms query to tolerate multiple scheduled instances
Bug: 30134986
It is possible for an alarm to have multiple scheduled instances
but the query does not gracefully tolerate those instances
sharing a common state. Adjust the alarms query to return the
*earliest* instance when this case occurs.
Change-Id: I07e14fe87f6e93252e6ee6a2d7a1ec85ca27ebe0
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/deskclock/provider/ClockProvider.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/deskclock/provider/ClockProvider.java b/src/com/android/deskclock/provider/ClockProvider.java index 06b294260..51be7e8e0 100644 --- a/src/com/android/deskclock/provider/ClockProvider.java +++ b/src/com/android/deskclock/provider/ClockProvider.java @@ -101,10 +101,15 @@ public class ClockProvider extends ContentProvider { ALARMS_TABLE_NAME + "." + AlarmsColumns._ID + " = " + InstancesColumns.ALARM_ID + ")"; private static final String ALARM_JOIN_INSTANCE_WHERE_STATEMENT = - InstancesColumns.ALARM_STATE + " IS NULL OR " + - InstancesColumns.ALARM_STATE + " = (SELECT MIN(" + InstancesColumns.ALARM_STATE + - ") FROM " + INSTANCES_TABLE_NAME + " WHERE " + InstancesColumns.ALARM_ID + - " = " + ALARMS_TABLE_NAME + "." + AlarmsColumns._ID + ")"; + INSTANCES_TABLE_NAME + "." + InstancesColumns._ID + " IS NULL OR " + + INSTANCES_TABLE_NAME + "." + InstancesColumns._ID + " = (" + + "SELECT " + InstancesColumns._ID + + " FROM " + INSTANCES_TABLE_NAME + + " WHERE " + InstancesColumns.ALARM_ID + + " = " + ALARMS_TABLE_NAME + "." + AlarmsColumns._ID + + " ORDER BY " + InstancesColumns.ALARM_STATE + ", " + + InstancesColumns.YEAR + ", " + InstancesColumns.MONTH + ", " + + InstancesColumns.DAY + " LIMIT 1)"; private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { |