Cleanup: fix various issues in tests.

This commit is contained in:
Dennis Guse
2021-12-27 12:59:25 +01:00
parent 9af213fd12
commit c7bbaddc06
6 changed files with 26 additions and 29 deletions
@@ -161,13 +161,16 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
@Override
public void onDestroy() {
handler.removeCallbacksAndMessages(null); //Some tests do not finish the recording completely
handler = null;
trackPointCreator.stop();
trackPointCreator = null;
trackRecordingManager = null;
// Reverse order from onCreate
showNotification(false); //TODO Why?
notificationManager = null;
PreferencesUtils.unregisterOnSharedPreferenceChangeListener(sharedPreferenceChangeListener);
@@ -180,6 +183,7 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
// This should be the next to last operation
wakeLock = SystemUtils.releaseWakeLock(wakeLock);
updateRecordingStatus(STATUS_DEFAULT);
recordingStatusObservable = null;
gpsStatusObservable = null;
recordingDataObservable = null;
@@ -187,6 +191,16 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
@Override
public Binder onBind(Intent intent) {
return binder;
}
public boolean isRecording() {
return recordingStatus.isRecording();
}