forked from upstream-mirrors/OpenTracks
Bug fixing and refactoring:
1) Make sure no one but service changes recordingTrackId (which is owned by it) 2) Cache sharedPreferences 3) Clear recordingTrackId if it doesn't correspond to a valid track or the service is not recording 4) More unit tests
This commit is contained in:
@@ -662,6 +662,11 @@ public class TrackRecordingService extends Service implements LocationListener {
|
||||
if (recordingTrack != null) {
|
||||
restoreStats(recordingTrack);
|
||||
isRecording = true;
|
||||
} else {
|
||||
// Make sure we have consistent state in shared preferences.
|
||||
Log.w(MyTracksConstants.TAG, "TrackRecordingService.onCreate: Resetting "
|
||||
+ "an orphaned recording track: " + recordingTrackId);
|
||||
prefManager.setRecordingTrack(recordingTrackId = -1);
|
||||
}
|
||||
showNotification();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user