[android] #5335 - Always record latest accelerometer and magnetometer sensor values regardless of MyLocationView update throttling.

This commit is contained in:
Justas Medeisis
2016-06-13 22:10:29 +03:00
committed by Tobrun
parent 2893f39249
commit f470208f6e

View File

@@ -526,24 +526,19 @@ public class MyLocationView extends View {
return;
}
long currentTime = SystemClock.elapsedRealtime();
if (currentTime < mCompassUpdateNextTimestamp) {
return;
}
int type = event.sensor.getType();
float[] data;
if (type == Sensor.TYPE_ACCELEROMETER) {
data = mGData;
System.arraycopy(event.values, 0, mGData, 0, 3);
} else if (type == Sensor.TYPE_MAGNETIC_FIELD) {
data = mMData;
System.arraycopy(event.values, 0, mMData, 0, 3);
} else {
// we should not be here.
return;
}
for (int i = 0; i < 3; i++) {
data[i] = event.values[i];
long currentTime = SystemClock.elapsedRealtime();
if (currentTime < mCompassUpdateNextTimestamp) {
return;
}
SensorManager.getRotationMatrix(mR, mI, mGData, mMData);