Bugfix: reset TrackRecordingManager properly.

Fixes #901.
This commit is contained in:
Dennis Guse
2021-08-05 18:43:18 +02:00
parent 7a2741e508
commit 6f3efd9ff2
4 changed files with 42 additions and 16 deletions
@@ -72,6 +72,10 @@ public class TrackPointCreator {
}
public void resetSensorData() {
if (remoteSensorManager == null || altitudeSumManager == null) {
Log.d(TAG, "No recording running and no reset necessary.");
return;
}
remoteSensorManager.reset();
altitudeSumManager.reset();
}
@@ -101,6 +105,16 @@ public class TrackPointCreator {
// }
// serviceExecutor = null;
if (remoteSensorManager != null) {
remoteSensorManager.stop();
remoteSensorManager = null;
}
if (altitudeSumManager != null) {
altitudeSumManager.stop(context);
altitudeSumManager = null;
}
this.context = null;
}
@@ -156,6 +170,7 @@ public class TrackPointCreator {
}
//TODO Limit visibility
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
public Instant createNow() {
return Instant.now(clock);
}