@@ -192,6 +192,11 @@ public class GpsLocationProvider implements LocationProviderInterface {
192192 // stop trying if we do not receive a fix within 60 seconds
193193 private static final int NO_FIX_TIMEOUT = 60 * 1000 ;
194194
195+ // if the fix interval is below this we leave GPS on,
196+ // if above then we cycle the GPS driver.
197+ // Typical hot TTTF is ~5 seconds, so 10 seconds seems sane.
198+ private static final int GPS_POLLING_THRESHOLD_INTERVAL = 10 * 1000 ;
199+
195200 // true if we are enabled
196201 private volatile boolean mEnabled ;
197202
@@ -842,7 +847,18 @@ public void setMinTime(long minTime, WorkSource ws) {
842847 }
843848
844849 public String getInternalState () {
845- return native_get_internal_state ();
850+ StringBuilder s = new StringBuilder ();
851+ s .append (" mFixInterval=" ).append (mFixInterval ).append ("\n " );
852+ s .append (" mEngineCapabilities=0x" ).append (Integer .toHexString (mEngineCapabilities )).append (" (" );
853+ if (hasCapability (GPS_CAPABILITY_SCHEDULING )) s .append ("SCHED " );
854+ if (hasCapability (GPS_CAPABILITY_MSB )) s .append ("MSB " );
855+ if (hasCapability (GPS_CAPABILITY_MSA )) s .append ("MSA " );
856+ if (hasCapability (GPS_CAPABILITY_SINGLE_SHOT )) s .append ("SINGLE_SHOT " );
857+ if (hasCapability (GPS_CAPABILITY_ON_DEMAND_TIME )) s .append ("ON_DEMAND_TIME " );
858+ s .append (")\n " );
859+
860+ s .append (native_get_internal_state ());
861+ return s .toString ();
846862 }
847863
848864 private final class Listener implements IBinder .DeathRecipient {
@@ -1131,7 +1147,8 @@ private void reportLocation(int flags, double latitude, double longitude, double
11311147 updateStatus (LocationProvider .AVAILABLE , mSvCount );
11321148 }
11331149
1134- if (!hasCapability (GPS_CAPABILITY_SCHEDULING ) && mStarted && mFixInterval > 1000 ) {
1150+ if (!hasCapability (GPS_CAPABILITY_SCHEDULING ) && mStarted &&
1151+ mFixInterval > GPS_POLLING_THRESHOLD_INTERVAL ) {
11351152 if (DEBUG ) Log .d (TAG , "got fix, hibernating" );
11361153 hibernate ();
11371154 }
0 commit comments