OSDN Git Service

Allow interval updating when no GPS fix & scheduling not supported.
authorgomo <gomo@google.com>
Thu, 14 Dec 2017 03:04:12 +0000 (19:04 -0800)
committergomo <gomo@google.com>
Sat, 16 Dec 2017 01:23:30 +0000 (17:23 -0800)
Since Android-L we have the following isse for GPS chipsets that do not
have GPS_CAPABILITY_SCHEDULING:
1) A location request is ongoing with an interval < 1 minute that
mFixInterval < NO_FIX_TIMEOUT. In which case, the TimeOutIntent will
not be set
2) A new location request arrives with a large interval where we want
the TimeOutIntent to kick in if needed
3) The above scenario has to happen in GPS signal denied environment
with no fix possible as a single reported location will cause hibernate()
to be called and engine to be stopped

Bug:68827168
Test: Current tests pass.

Change-Id: I4b3abf4b6f91a8eeb119bdbdb19f2fb0ed9e28cd

services/core/java/com/android/server/location/GnssLocationProvider.java

index b324002..3bd6446 100644 (file)
@@ -1328,6 +1328,14 @@ public class GnssLocationProvider implements LocationProviderInterface {
             } else if (!mStarted) {
                 // start GPS
                 startNavigating(singleShot);
+            } else {
+                // GNSS Engine is already ON, but no GPS_CAPABILITY_SCHEDULING
+                mAlarmManager.cancel(mTimeoutIntent);
+                if (mFixInterval >= NO_FIX_TIMEOUT) {
+                    // set timer to give up if we do not receive a fix within NO_FIX_TIMEOUT
+                    // and our fix interval is not short
+                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
+                            SystemClock.elapsedRealtime() + NO_FIX_TIMEOUT, mTimeoutIntent);                }
             }
         } else {
             updateClientUids(new WorkSource());