am fb3e63fc: am 7869e224: CW on L: Fix a SIGSEGV crash in sensor service.

* commit 'fb3e63fcc76df5ce47dfaa8d1543a97e55dd39a5':
  CW on L: Fix a SIGSEGV crash in sensor service.
This commit is contained in:
Sean Wan 2014-07-15 22:02:23 +00:00 committed by Android Git Automerger
commit 134a6a2594
1 changed files with 6 additions and 2 deletions

View File

@ -490,8 +490,12 @@ bool SensorService::isVirtualSensor(int handle) const {
}
bool SensorService::isWakeUpSensorEvent(const sensors_event_t& event) const {
SensorInterface* sensor = mSensorMap.valueFor(event.sensor);
return sensor->getSensor().isWakeUpSensor();
int handle = event.sensor;
if (event.type == SENSOR_TYPE_META_DATA) {
handle = event.meta_data.sensor;
}
SensorInterface* sensor = mSensorMap.valueFor(handle);
return sensor != NULL && sensor->getSensor().isWakeUpSensor();
}
Vector<Sensor> SensorService::getSensorList()