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

Commit b9cdead4 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "Better dumpsys logs" into gingerbread

parents 865991b0 42e1b39a
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;