mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
announce called after getting recordingTrackId. Fixed a potencial race condition.
This commit is contained in:
committed by
Dennis Guse
parent
99126fa357
commit
772dad4837
@@ -146,9 +146,9 @@ public class AnnouncementPeriodicTask implements PeriodicTask {
|
||||
@Override
|
||||
public void onTrackRecordingId(Track.Id trackId) {
|
||||
recordingTrackId = trackId;
|
||||
announce(trackRecordingService.getTrackStatistics());
|
||||
}
|
||||
});
|
||||
announce(trackRecordingService.getTrackStatistics());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,11 @@ public class AnnouncementPeriodicTask implements PeriodicTask {
|
||||
}
|
||||
|
||||
Track track = contentProviderUtils.getTrack(recordingTrackId);
|
||||
String category = track != null ? track.getCategory() : "";
|
||||
if (track == null) {
|
||||
Log.i(TAG, "It doesn't exists a track with trackid = " + recordingTrackId);
|
||||
return;
|
||||
}
|
||||
String category = track.getCategory();
|
||||
|
||||
//TODO Querying all TrackPoints all the time is inefficient; use TrackDataHub or something else.
|
||||
TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(track.getId(), null);
|
||||
|
||||
Reference in New Issue
Block a user