Improve the detection of the trip end
Improve the detection of the trip end

Before this change, we used to detect that the trip ended if we hadn't received
any updates for a sufficient time period. This was because we set a distance
filter, and so we assumed that we would not get any updates while we were
within the filter.

Unfortunately, this turned out to not be true. In particular, we can get
updates even after the trip has ended, and while some of these updates have low
accuracy, not all of them do.

Therefore, we change the code to be more consistent with the android code. In
particular, we do the following:
- We get all good quality points for the last n minutes, not the last n points
- If there are no points, we can state that the trip has ended
- If there are points, we calculate the distance from the current point to each of those points
- If the max distance is less than the geofence radius, all points are within
  the trip end threshold and we say that the trip is done

- Otherwise, the trip has not ended

e-mission/e-mission-data-collection,e-mission/e-mission-data-collection,shankari/e-mission-data-collection,shankari/e-mission-data-collection,shankari/e-mission-data-collection,e-mission/e-mission-data-collection