am b9cdead4: Merge "Better dumpsys logs" into gingerbread
Merge commit 'b9cdead457fb86efc125db8c1c6954c4af1d7388' into gingerbread-plus-aosp * commit 'b9cdead457fb86efc125db8c1c6954c4af1d7388': Better dumpsys logs
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -91,6 +91,7 @@ class SensorService :
|
||||
};
|
||||
|
||||
SortedVector< wp<SensorEventConnection> > getActiveConnections() const;
|
||||
String8 getSensorName(int handle) const;
|
||||
|
||||
// constants
|
||||
Vector<Sensor> mSensorList;
|
||||
|
||||
Reference in New Issue
Block a user