add logging and defensive code when initializing sensors
Bug: 5445240 Change-Id: I9dc7d27d3e8b4f15989488859831526d8c7ded3b
This commit is contained in:
parent
00f99e88c8
commit
be58de0d62
@ -78,9 +78,23 @@ Sensor const* SensorManager::getDefaultSensor(int type)
|
||||
|
||||
sp<SensorEventQueue> SensorManager::createEventQueue()
|
||||
{
|
||||
sp<SensorEventQueue> result = new SensorEventQueue(
|
||||
mSensorServer->createSensorEventConnection());
|
||||
return result;
|
||||
sp<SensorEventQueue> queue;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user