Merge "add logging and defensive code when initializing sensors" into ics-mr0

This commit is contained in:
Mathias Agopian
2011-10-16 21:07:42 -07:00
committed by Android (Google) Code Review

View File

@ -78,9 +78,23 @@ Sensor const* SensorManager::getDefaultSensor(int type)
sp<SensorEventQueue> SensorManager::createEventQueue() sp<SensorEventQueue> SensorManager::createEventQueue()
{ {
sp<SensorEventQueue> result = new SensorEventQueue( sp<SensorEventQueue> queue;
mSensorServer->createSensorEventConnection());
return result; if (mSensorServer == NULL) {
LOGE("createEventQueue: mSensorSever is NULL");
return queue;
}
sp<ISensorEventConnection> connection =
mSensorServer->createSensorEventConnection();
if (connection == NULL) {
LOGE("createEventQueue: connection is NULL");
return queue;
}
queue = new SensorEventQueue(connection);
return queue;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------