Bugfix: TrackListActivity couldn't stop and restart sensors.

Part of #1780.
This commit is contained in:
Dennis Guse
2023-12-25 21:07:22 +01:00
parent 6cd627e832
commit 826cf0d468
2 changed files with 5 additions and 0 deletions
@@ -158,6 +158,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
} else { } else {
if (gpsStatusValue.isGpsStarted()) { if (gpsStatusValue.isGpsStarted()) {
recordingStatusConnection.unbindAndStop(this); recordingStatusConnection.unbindAndStop(this);
recordingStatusConnection.startConnection(this); //TODO We need to stay listening!
} else { } else {
new TrackRecordingServiceConnection((service, connection) -> { new TrackRecordingServiceConnection((service, connection) -> {
service.tryStartSensors(); service.tryStartSensors();
@@ -125,6 +125,9 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
if (isRecording()) { if (isRecording()) {
endCurrentTrack(); endCurrentTrack();
} }
if (isSensorStarted()) {
stopSensors();
}
PreferencesUtils.unregisterOnSharedPreferenceChangeListener(this); PreferencesUtils.unregisterOnSharedPreferenceChangeListener(this);
@@ -248,6 +251,7 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
stopForeground(true); stopForeground(true);
notificationManager.cancelNotification(); notificationManager.cancelNotification();
wakeLock = SystemUtils.releaseWakeLock(wakeLock); wakeLock = SystemUtils.releaseWakeLock(wakeLock);
gpsStatusObservable.postValue(STATUS_GPS_DEFAULT);
} }
@Override @Override