mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-06 11:33:06 +02:00
Cleanup.
This commit is contained in:
@@ -150,7 +150,7 @@ public class TrackRecordingService extends Service {
|
||||
private boolean currentSegmentHasLocation;
|
||||
private boolean isIdle; // true if idle
|
||||
private ServiceBinder binder = new ServiceBinder(this);
|
||||
private LocationListener locationListener = new LocationListener() {
|
||||
private final LocationListener locationListener = new LocationListener() {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(final Location location) {
|
||||
@@ -358,7 +358,7 @@ public class TrackRecordingService extends Service {
|
||||
track.setTripStatistics(trackTripStatisticsUpdater.getTripStatistics());
|
||||
contentProviderUtils.updateTrack(track);
|
||||
|
||||
startRecording(true);
|
||||
startRecording();
|
||||
return trackId;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public class TrackRecordingService extends Service {
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(TAG, "RuntimeException", e);
|
||||
}
|
||||
startRecording(true);
|
||||
startRecording();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,15 +408,13 @@ public class TrackRecordingService extends Service {
|
||||
insertLocation(track, resume, null);
|
||||
}
|
||||
|
||||
startRecording(false);
|
||||
startRecording();
|
||||
}
|
||||
|
||||
/**
|
||||
* Common code for starting a new track, resuming a track, or restarting after phone reboot.
|
||||
*
|
||||
* @param trackStarted true if track is started, false if track is resumed
|
||||
*/
|
||||
private void startRecording(boolean trackStarted) {
|
||||
private void startRecording() {
|
||||
// Update instance variables
|
||||
remoteSensorManager = new BluetoothRemoteSensorManager(this);
|
||||
remoteSensorManager.start();
|
||||
@@ -686,7 +684,7 @@ public class TrackRecordingService extends Service {
|
||||
}
|
||||
|
||||
try {
|
||||
Uri uri = contentProviderUtils.insertTrackPoint(location, track.getId());
|
||||
contentProviderUtils.insertTrackPoint(location, track.getId());
|
||||
trackTripStatisticsUpdater.addLocation(location, recordingDistanceInterval);
|
||||
updateRecordingTrack(track, LocationUtils.isValidLocation(location));
|
||||
} catch (SQLiteException e) {
|
||||
|
||||
+2
-2
@@ -24,9 +24,9 @@ class TrackRecordingServiceNotificationManager {
|
||||
|
||||
private final static String CHANNEL_ID = TrackRecordingServiceNotificationManager.class.getSimpleName();
|
||||
|
||||
private NotificationCompat.Builder notificationBuilder;
|
||||
private final NotificationCompat.Builder notificationBuilder;
|
||||
|
||||
private NotificationManager notificationManager;
|
||||
private final NotificationManager notificationManager;
|
||||
|
||||
private boolean previousLocationWasAccurate = true;
|
||||
|
||||
|
||||
+2
-2
@@ -57,9 +57,9 @@ public class BluetoothConnectionManager {
|
||||
private SensorState sensorState;
|
||||
|
||||
private BluetoothGatt bluetoothGatt;
|
||||
private BluetoothDevice bluetoothDevice;
|
||||
private final BluetoothDevice bluetoothDevice;
|
||||
|
||||
private BluetoothGattCallback connectCallback = new BluetoothGattCallback() {
|
||||
private final BluetoothGattCallback connectCallback = new BluetoothGattCallback() {
|
||||
@Override
|
||||
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
||||
switch (newState) {
|
||||
|
||||
@@ -61,11 +61,7 @@ public class AnnouncementPeriodicTask implements PeriodicTask {
|
||||
stop = false;
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS:
|
||||
stop = true;
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
|
||||
stop = true;
|
||||
break;
|
||||
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
|
||||
stop = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user