CW on L: Fix a SIGSEGV crash in sensor service.

This is to fix b/16189080.

BUG: 16189080
Change-Id: I78d44e82f797c0808891acde609040c46745a0bb
This commit is contained in:
Sean Wan 2014-07-14 17:07:33 -07:00
parent 2a0e40945b
commit 7869e224aa
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 { bool SensorService::isWakeUpSensorEvent(const sensors_event_t& event) const {
SensorInterface* sensor = mSensorMap.valueFor(event.sensor); int handle = event.sensor;
return sensor->getSensor().isWakeUpSensor(); 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() Vector<Sensor> SensorService::getSensorList()