Bug 1248033 - Support GAME_ROTATION_VECTOR sensor events with no W parameter; r=snorp

This commit is contained in:
Jim Chen 2016-02-16 16:57:49 -05:00
parent 0e1e26ad5a
commit 1e590abbf2

View File

@ -432,8 +432,11 @@ public class GeckoEvent {
break;
case Sensor.TYPE_ROTATION_VECTOR:
case Sensor.TYPE_GAME_ROTATION_VECTOR: // API >= 18
event = GeckoEvent.get(NativeGeckoEvent.SENSOR_EVENT);
event.mFlags = GeckoHalDefines.SENSOR_ROTATION_VECTOR;
event.mFlags = (sensor_type == Sensor.TYPE_ROTATION_VECTOR ?
GeckoHalDefines.SENSOR_ROTATION_VECTOR :
GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR);
event.mMetaState = HalSensorAccuracyFor(s.accuracy);
event.mX = s.values[0];
event.mY = s.values[1];
@ -448,17 +451,6 @@ public class GeckoEvent {
event.mW = (event.mW > 0.0) ? Math.sqrt(event.mW) : 0.0;
}
break;
// case Sensor.TYPE_GAME_ROTATION_VECTOR: // API >= 18
case 15:
event = GeckoEvent.get(NativeGeckoEvent.SENSOR_EVENT);
event.mFlags = GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR;
event.mMetaState = HalSensorAccuracyFor(s.accuracy);
event.mX = s.values[0];
event.mY = s.values[1];
event.mZ = s.values[2];
event.mW = s.values[3];
break;
}
return event;
}