Skip to content

Commit af7c978

Browse files
mikeandroidAndroid Code Review
authored andcommitted
Merge "GpsLocationProvider: Store new Location before onGpsStatusChanged is sent"
2 parents 7751667 + fa94ff0 commit af7c978

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

location/java/com/android/internal/location/GpsLocationProvider.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -805,29 +805,6 @@ private void reportLocation(int flags, double latitude, double longitude, double
805805
if (VERBOSE) Log.v(TAG, "reportLocation lat: " + latitude + " long: " + longitude +
806806
" timestamp: " + timestamp);
807807

808-
mLastFixTime = System.currentTimeMillis();
809-
// report time to first fix
810-
if (mTTFF == 0 && (flags & LOCATION_HAS_LAT_LONG) == LOCATION_HAS_LAT_LONG) {
811-
mTTFF = (int)(mLastFixTime - mFixRequestTime);
812-
if (Config.LOGD) Log.d(TAG, "TTFF: " + mTTFF);
813-
814-
// notify status listeners
815-
synchronized(mListeners) {
816-
int size = mListeners.size();
817-
for (int i = 0; i < size; i++) {
818-
Listener listener = mListeners.get(i);
819-
try {
820-
listener.mListener.onFirstFix(mTTFF);
821-
} catch (RemoteException e) {
822-
Log.w(TAG, "RemoteException in stopNavigating");
823-
mListeners.remove(listener);
824-
// adjust for size of list changing
825-
size--;
826-
}
827-
}
828-
}
829-
}
830-
831808
synchronized (mLocation) {
832809
mLocationFlags = flags;
833810
if ((flags & LOCATION_HAS_LAT_LONG) == LOCATION_HAS_LAT_LONG) {
@@ -863,6 +840,29 @@ private void reportLocation(int flags, double latitude, double longitude, double
863840
}
864841
}
865842

843+
mLastFixTime = System.currentTimeMillis();
844+
// report time to first fix
845+
if (mTTFF == 0 && (flags & LOCATION_HAS_LAT_LONG) == LOCATION_HAS_LAT_LONG) {
846+
mTTFF = (int)(mLastFixTime - mFixRequestTime);
847+
if (Config.LOGD) Log.d(TAG, "TTFF: " + mTTFF);
848+
849+
// notify status listeners
850+
synchronized(mListeners) {
851+
int size = mListeners.size();
852+
for (int i = 0; i < size; i++) {
853+
Listener listener = mListeners.get(i);
854+
try {
855+
listener.mListener.onFirstFix(mTTFF);
856+
} catch (RemoteException e) {
857+
Log.w(TAG, "RemoteException in stopNavigating");
858+
mListeners.remove(listener);
859+
// adjust for size of list changing
860+
size--;
861+
}
862+
}
863+
}
864+
}
865+
866866
if (mStarted && mStatus != LocationProvider.AVAILABLE) {
867867
mAlarmManager.cancel(mTimeoutIntent);
868868
// send an intent to notify that the GPS is receiving fixes.

0 commit comments

Comments
 (0)