Bug 746728 - Add sensor index fallback for qemu, r=gal a=b2g-only

This commit is contained in:
Michael Wu 2012-04-18 17:18:08 -04:00
Родитель 12e114494a
Коммит cfb6b5aa66
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -94,6 +94,14 @@ public:
SensorRunnable(const sensors_event_t& data)
{
mSensorData.sensor() = HardwareSensorToHalSensor(data.type);
if (mSensorData.sensor() == SENSOR_UNKNOWN) {
// Emulator is broken and gives us events without types set
const sensor_t* sensors = NULL;
SensorDevice& device = SensorDevice::getInstance();
size_t size = device.getSensorList(&sensors);
if (data.sensor < size)
mSensorData.sensor() = HardwareSensorToHalSensor(sensors[data.sensor].type);
}
mSensorData.accuracy() = HardwareStatusToHalAccuracy(SensorseventStatus(data));
mSensorData.timestamp() = data.timestamp;
if (mSensorData.sensor() == SENSOR_GYROSCOPE) {