Fix alarm query
Bug: 25895834
ag/811037 left a bug in place that this change addresses.
Specifically, if a one-time alarm is missed, an entry is left in
the alarm_instances table with a state of MISSED. The query's
join clause would not return a row for the alarm in this case.
A subselect is now used to return the alarm_instances row with
the smallest state value. This means:
- SILENT instances are preferred over MISSED instances
(the only case where 2 instances exist for the same alarm).
- MISSED instances are returned if they are the only instance for
an alarm (the above case)
Change-Id: I31de6d8b2d2bf7719f6b027a2401b1da1a09f247
1 file changed