Bluetooth: use TrackRecording handler for callback.

Otherwise the thread is not defined and a SecurityException may be triggered when inserting data into the ContentProvider.
Sadly, below API26 this needs to be done manually.

Fixes #1165.
This commit is contained in:
Dennis Guse
2022-05-05 19:14:19 +02:00
parent a77b7a0626
commit 40d2bf0c22
7 changed files with 35 additions and 12 deletions
@@ -162,7 +162,7 @@ public class ExportImportTest {
service.insertMarker("Marker 2", "Marker 2 category", "Marker 2 desc", null);
trackPointCreator.setClock("2020-02-02T02:02:06Z");
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, trackPointCreator));
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, null, trackPointCreator));
service.pauseCurrentTrack();
trackPointCreator.setClock("2020-02-02T02:02:20Z");
@@ -175,7 +175,7 @@ public class ExportImportTest {
sendLocation(trackPointCreator, "2020-02-02T02:02:23Z", 3, 16.001, 10, 27, 15, 10, 0);
trackPointCreator.setClock("2020-02-02T02:02:24Z");
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, trackPointCreator));
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, null, trackPointCreator));
service.endCurrentTrack();
Track track = contentProviderUtils.getTrack(trackId);
@@ -492,7 +492,7 @@ public class ExportImportTest {
}
private void mockBLESensorData(TrackPointCreator trackPointCreator, Float speed, Distance distance, float heartRate, float cadence, Float power) {
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, trackPointCreator) {
trackPointCreator.setRemoteSensorManager(new BluetoothRemoteSensorManager(context, null, trackPointCreator) {
@Override
public SensorDataSet fill(@NonNull TrackPoint trackPoint) {
SensorDataSet sensorDataSet = new SensorDataSet();
@@ -27,7 +27,7 @@ public class TrackRecordingServiceTestUtils {
TrackRecordingService service = ((TrackRecordingService.Binder) mServiceRule.bindService(new Intent(context, TrackRecordingService.class)))
.getService();
service.getTrackPointCreator().setRemoteSensorManager(new BluetoothRemoteSensorManager(context, service.getTrackPointCreator()));
service.getTrackPointCreator().setRemoteSensorManager(new BluetoothRemoteSensorManager(context, null, service.getTrackPointCreator()));
service.getTrackPointCreator().setClock(Clock.systemUTC());
service.endCurrentTrack();
}
@@ -32,7 +32,7 @@ public class TrackPointCreatorTest {
@Before
public void setUp() {
subject = new TrackPointCreator(locationHandler, server);
subject.start(context);
subject.start(context, null);
}
@After