Merge "GpsLocationProvider: Eliminate MIN_FIX_COUNT." into kraken
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 1b3c645..dccb872 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -160,12 +160,9 @@
 
     // time for last status update
     private long mStatusUpdateTime = SystemClock.elapsedRealtime();
-    
+
     // turn off GPS fix icon if we haven't received a fix in 10 seconds
     private static final long RECENT_FIX_TIMEOUT = 10 * 1000;
-    
-    // number of fixes to receive before disabling GPS
-    private static final int MIN_FIX_COUNT = 10;
 
     // stop trying if we do not receive a fix within 60 seconds
     private static final int NO_FIX_TIMEOUT = 60 * 1000;
@@ -190,9 +187,6 @@
     // requested frequency of fixes, in milliseconds
     private int mFixInterval = 1000;
 
-    // number of fixes we have received since we started navigating
-    private int mFixCount;
-
     // true if we started navigation
     private boolean mStarted;
 
@@ -908,7 +902,6 @@
 
             // reset SV count to zero
             updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE, 0);
-            mFixCount = 0;
             mFixRequestTime = System.currentTimeMillis();
             if (!hasCapability(GPS_CAPABILITY_SCHEDULING)) {
                 // set timer to give up if we do not receive a fix within NO_FIX_TIMEOUT
@@ -938,7 +931,6 @@
     private void hibernate() {
         // stop GPS until our next fix interval arrives
         stopNavigating();
-        mFixCount = 0;
         mAlarmManager.cancel(mTimeoutIntent);
         mAlarmManager.cancel(mWakeupIntent);
         long now = SystemClock.elapsedRealtime();
@@ -1017,7 +1009,7 @@
         }
 
         if (mStarted && mStatus != LocationProvider.AVAILABLE) {
-            // we still want to time out if we do not receive MIN_FIX_COUNT
+            // we want to time out if we do not receive a fix
             // within the time out and we are requesting infrequent fixes
             if (!hasCapability(GPS_CAPABILITY_SCHEDULING) && mFixInterval < NO_FIX_TIMEOUT) {
                 mAlarmManager.cancel(mTimeoutIntent);
@@ -1030,9 +1022,8 @@
             updateStatus(LocationProvider.AVAILABLE, mSvCount);
         }
 
-       if (!hasCapability(GPS_CAPABILITY_SCHEDULING) &&
-                mFixCount++ >= MIN_FIX_COUNT && mFixInterval > 1000) {
-            if (DEBUG) Log.d(TAG, "exceeded MIN_FIX_COUNT");
+       if (!hasCapability(GPS_CAPABILITY_SCHEDULING) && mFixInterval > 1000) {
+            if (DEBUG) Log.d(TAG, "got fix, hibernating");
             hibernate();
         }
    }