summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-10-17 11:32:15 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-17 11:32:15 -0700
commit1c8a6bf3b21c4cfddf8d37cf7cd9fb30008a7911 (patch)
treec602391525209f0985999c0f07832e6cea51a8b4 /libs
parent4bb7572e7660172a53bb9e309fd646928400acc0 (diff)
parentfefffc685ab703b44f6e32b5ec45292b22d370a3 (diff)
downloadframeworks_base-1c8a6bf3b21c4cfddf8d37cf7cd9fb30008a7911.zip
frameworks_base-1c8a6bf3b21c4cfddf8d37cf7cd9fb30008a7911.tar.gz
frameworks_base-1c8a6bf3b21c4cfddf8d37cf7cd9fb30008a7911.tar.bz2
am fefffc68: Merge "add logging and defensive code when initializing sensors" into ics-mr0
* commit 'fefffc685ab703b44f6e32b5ec45292b22d370a3': add logging and defensive code when initializing sensors
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/SensorManager.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
index d719efb..4774a58 100644
--- a/libs/gui/SensorManager.cpp
+++ b/libs/gui/SensorManager.cpp
@@ -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;
}
// ----------------------------------------------------------------------------