Improve memory/performace in ManagerService

Added the event_get_first_sorted_by_filters method to the DB API.
The idea of this method is to only return the first event that
satisfies the sorting criteria and all the filters.

In the ManagerService class, replaced the use of
event_get_all_sorted_by_filters method for
event_get_first_sorted_by_filters in order to reduce the use of memory and
improve the performace.

Change-Id: I54491bae9dafb3ecf2adb29aae6bb8139c8751b4
Closes-Bug: #1279459
Merge "Improve memory/performace in ManagerService"