Fix issue #23214751: Get a GPS fix before going in to doze

This introduces a new phase of device idle mode, immediately
before going idle (once we are sure the device is not moving),
try to collect a location for the device so that any later
requests for it will have a good chance of having an accurate
value.

We do this with two location requests: one a single-shot as
accurate as possible location, and a second longer-running
attempt to get an accurate location from the GPS.  There is
a limit on how long we will try to collect the location (default
is 30 seconds), and we stop collection once we reach a desired
accuracy (default is 20 meters).

Also cleanup various transition paths out of the normal state
flow to clean up any active state we may have running.

Change-Id: Ibd3d2e9a720fbfd9640755baf5547180dd409f6a
2 files changed