Fix code style and unit test issues for the compass fix.

This commit is contained in:
Tsoi Yat Shing
2020-04-21 13:52:37 +08:00
committed by Łukasz Paczos
parent e3b2452ba2
commit d230172b3c
2 changed files with 2 additions and 3 deletions

View File

@@ -107,7 +107,8 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen
if (lastAccuracySensorStatus == SensorManager.SENSOR_STATUS_UNRELIABLE) {
Logger.d(TAG, "Compass sensor is unreliable, device calibration is needed.");
// Update the heading, even if the sensor is unreliable.
// This makes it possible to use a different indicator for the unreliable case, instead of just changing the RenderMode to NORMAL.
// This makes it possible to use a different indicator for the unreliable case,
// instead of just changing the RenderMode to NORMAL.
//return;
}
if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {

View File

@@ -58,7 +58,6 @@ public class CompassEngineTest {
@Test
public void whenGyroscopeIsNull_fallbackToGravity() {
SensorManager sensorManager = mock(SensorManager.class);
when(sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)).thenReturn(null);
new LocationComponentCompassEngine(windowManager, sensorManager);
verify(sensorManager, times(1)).getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
@@ -67,7 +66,6 @@ public class CompassEngineTest {
@Test
public void whenGyroscopeIsNull_fallbackToMagneticField() {
SensorManager sensorManager = mock(SensorManager.class);
when(sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)).thenReturn(null);
new LocationComponentCompassEngine(windowManager, sensorManager);
verify(sensorManager, times(1)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);