diff options
author | Mathias Agopian <mathias@google.com> | 2010-07-19 15:20:39 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-07-19 17:57:29 -0700 |
commit | 42e1b39ac53709d9a9a74cd803e8ded10cf03848 (patch) | |
tree | 36d99627ca19ad7db6cf512ab7c2d5ba11a5be08 /services/sensorservice | |
parent | 6f8b4d28d41508e3a563c12f5841918bb3869819 (diff) | |
download | frameworks_base-42e1b39ac53709d9a9a74cd803e8ded10cf03848.zip frameworks_base-42e1b39ac53709d9a9a74cd803e8ded10cf03848.tar.gz frameworks_base-42e1b39ac53709d9a9a74cd803e8ded10cf03848.tar.bz2 |
Better dumpsys logs
Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d
Diffstat (limited to 'services/sensorservice')
-rw-r--r-- | services/sensorservice/SensorService.cpp | 18 | ||||
-rw-r--r-- | services/sensorservice/SensorService.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index 0ab4a20..3fe3a5d 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -133,8 +133,10 @@ status_t SensorService::dump(int fd, const Vector<String16>& args) snprintf(buffer, SIZE, "Active sensors:\n"); result.append(buffer); for (size_t i=0 ; i<mActiveSensors.size() ; i++) { - snprintf(buffer, SIZE, "handle=%d, connections=%d\n", - mActiveSensors.keyAt(i), + int handle = mActiveSensors.keyAt(i); + snprintf(buffer, SIZE, "%s (handle=%d, connections=%d)\n", + getSensorName(handle).string(), + handle, mActiveSensors.valueAt(i)->getNumConnections()); result.append(buffer); } @@ -184,6 +186,18 @@ SensorService::getActiveConnections() const return mActiveConnections; } +String8 SensorService::getSensorName(int handle) const { + size_t count = mSensorList.size(); + for (size_t i=0 ; i<count ; i++) { + const Sensor& sensor(mSensorList[i]); + if (sensor.getHandle() == handle) { + return sensor.getName(); + } + } + String8 result("unknown"); + return result; +} + Vector<Sensor> SensorService::getSensorList() { return mSensorList; diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h index d5e321c..88b84ec 100644 --- a/services/sensorservice/SensorService.h +++ b/services/sensorservice/SensorService.h @@ -91,6 +91,7 @@ class SensorService : }; SortedVector< wp<SensorEventConnection> > getActiveConnections() const; + String8 getSensorName(int handle) const; // constants Vector<Sensor> mSensorList; |