Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42e1b39a authored by Mathias Agopian's avatar Mathias Agopian
Browse files

Better dumpsys logs

Change-Id: Iae65a8547ee5815cc4c3b74d2c9ef17bed7f565d
parent 6f8b4d28
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ class SensorService :
    };

    SortedVector< wp<SensorEventConnection> > getActiveConnections() const;
    String8 getSensorName(int handle) const;

    // constants
    Vector<Sensor> mSensorList;