diff options
author | Mathias Agopian <mathias@google.com> | 2010-07-21 16:07:32 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-21 16:07:32 -0700 |
commit | b9cdead457fb86efc125db8c1c6954c4af1d7388 (patch) | |
tree | 11ae1c3b7c7546df6cbe392de639adf875633513 /services | |
parent | 865991b075de1df8144426b5c2b2f341e4e33d33 (diff) | |
parent | 42e1b39ac53709d9a9a74cd803e8ded10cf03848 (diff) | |
download | frameworks_base-b9cdead457fb86efc125db8c1c6954c4af1d7388.zip frameworks_base-b9cdead457fb86efc125db8c1c6954c4af1d7388.tar.gz frameworks_base-b9cdead457fb86efc125db8c1c6954c4af1d7388.tar.bz2 |
Merge "Better dumpsys logs" into gingerbread
Diffstat (limited to 'services')
-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; |