forked from upstream-mirrors/OpenTracks
Fix a bug in maybeResumeTrack. Still not sure if it works correctly (need to verify on real device).
This commit is contained in:
@@ -753,7 +753,9 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean maybeResumeTrack(Track track) {
|
private boolean maybeResumeTrack(Track track) {
|
||||||
List<Location> locations = track.getLocations();
|
Log.d(MyTracksConstants.TAG,
|
||||||
|
"maybeResumeTrack: autoResumeTrackTimeout = " + autoResumeTrackTimeout);
|
||||||
|
|
||||||
if (autoResumeTrackTimeout == 0) {
|
if (autoResumeTrackTimeout == 0) {
|
||||||
// Never resume.
|
// Never resume.
|
||||||
return false;
|
return false;
|
||||||
@@ -763,9 +765,15 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the last recorded point's time is within acceptable range.
|
// Check if the last recorded point's time is within acceptable range.
|
||||||
return System.currentTimeMillis()
|
List<Location> locations = track.getLocations();
|
||||||
|
Log.d(MyTracksConstants.TAG,
|
||||||
|
"maybeResumeTrack: Found " + (locations != null ? locations.size() : 0)
|
||||||
|
+ " locations in the previous track");
|
||||||
|
|
||||||
|
return locations != null && !locations.isEmpty() &&
|
||||||
|
System.currentTimeMillis()
|
||||||
- locations.get(locations.size() - 1).getTime() <=
|
- locations.get(locations.size() - 1).getTime() <=
|
||||||
autoResumeTrackTimeout * 60 * 1000;
|
autoResumeTrackTimeout * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRecording() {
|
public boolean isRecording() {
|
||||||
|
|||||||
Reference in New Issue
Block a user