зеркало из https://github.com/mozilla/gecko-dev.git
Bug 827707 - [GonkSensor] Sensor field in sensors_event_t doesn't mean the index of sensors list from HAL. r=mwu
This commit is contained in:
Родитель
6a0da62b7a
Коммит
aef1dbd224
|
@ -182,16 +182,19 @@ PollSensors()
|
|||
if (buffer[i].type == SENSOR_TYPE_MAGNETIC_FIELD)
|
||||
continue;
|
||||
|
||||
if (buffer[i].sensor >= size) {
|
||||
LOGW("buffer type is hal sensor type SENSOR_UNKNOWN, and buffer sensor is not in a valid range");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (HardwareSensorToHalSensor(buffer[i].type) == SENSOR_UNKNOWN) {
|
||||
// Emulator is broken and gives us events without types set
|
||||
if (HardwareSensorToHalSensor(sensors[buffer[i].sensor].type) != SENSOR_UNKNOWN) {
|
||||
buffer[i].type = sensors[buffer[i].sensor].type;
|
||||
int index;
|
||||
for (index = 0; index < size; index++) {
|
||||
if (sensors[index].handle == buffer[i].sensor) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < size &&
|
||||
HardwareSensorToHalSensor(sensors[index].type) != SENSOR_UNKNOWN) {
|
||||
buffer[i].type = sensors[index].type;
|
||||
} else {
|
||||
LOGW("Could not determine sensor type of event");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче