Merge "Better dumpsys logs" into gingerbread

This commit is contained in:
Mathias Agopian
2010-07-21 16:07:32 -07:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 2 deletions

View File

@@ -133,8 +133,10 @@ status_t SensorService::dump(int fd, const Vector<String16>& args)
snprintf(buffer, SIZE, "Active sensors:\n"); snprintf(buffer, SIZE, "Active sensors:\n");
result.append(buffer); result.append(buffer);
for (size_t i=0 ; i<mActiveSensors.size() ; i++) { for (size_t i=0 ; i<mActiveSensors.size() ; i++) {
snprintf(buffer, SIZE, "handle=%d, connections=%d\n", int handle = mActiveSensors.keyAt(i);
mActiveSensors.keyAt(i), snprintf(buffer, SIZE, "%s (handle=%d, connections=%d)\n",
getSensorName(handle).string(),
handle,
mActiveSensors.valueAt(i)->getNumConnections()); mActiveSensors.valueAt(i)->getNumConnections());
result.append(buffer); result.append(buffer);
} }
@@ -184,6 +186,18 @@ SensorService::getActiveConnections() const
return mActiveConnections; 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() Vector<Sensor> SensorService::getSensorList()
{ {
return mSensorList; return mSensorList;

View File

@@ -91,6 +91,7 @@ class SensorService :
}; };
SortedVector< wp<SensorEventConnection> > getActiveConnections() const; SortedVector< wp<SensorEventConnection> > getActiveConnections() const;
String8 getSensorName(int handle) const;
// constants // constants
Vector<Sensor> mSensorList; Vector<Sensor> mSensorList;