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

Commit a121c78a authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Add prefix to transform dump to align the data better"

parents 403e7d83 85b44207
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -481,13 +481,13 @@ status_t InputPublisher::publishMotionEvent(
    }
    if (DEBUG_TRANSPORT_ACTIONS) {
        std::string transformString;
        transform.dump(transformString, "");
        transform.dump(transformString, "transform", "        ");
        ALOGD("channel '%s' publisher ~ publishMotionEvent: seq=%u, deviceId=%d, source=0x%x, "
              "displayId=%" PRId32 ", "
              "action=0x%x, actionButton=0x%08x, flags=0x%x, edgeFlags=0x%x, "
              "metaState=0x%x, buttonState=0x%x, classification=%s,"
              "xPrecision=%f, yPrecision=%f, downTime=%" PRId64 ", eventTime=%" PRId64 ", "
              "pointerCount=%" PRIu32 " transform=%s",
              "pointerCount=%" PRIu32 " \n%s",
              mChannel->getName().c_str(), seq, deviceId, source, displayId, action, actionButton,
              flags, edgeFlags, metaState, buttonState,
              motionClassificationToString(classification), xPrecision, yPrecision, downTime,
+49 −22
Original line number Diff line number Diff line
@@ -457,7 +457,43 @@ mat4 Transform::asMatrix4() const {
    return m;
}

void Transform::dump(std::string& out, const char* name) const {
static std::string rotationToString(const uint32_t rotationFlags) {
    switch (rotationFlags) {
        case Transform::ROT_0:
            return "ROT_0";
        case Transform::FLIP_H:
            return "FLIP_H";
        case Transform::FLIP_V:
            return "FLIP_V";
        case Transform::ROT_90:
            return "ROT_90";
        case Transform::ROT_180:
            return "ROT_180";
        case Transform::ROT_270:
            return "ROT_270";
        case Transform::ROT_INVALID:
        default:
            return "ROT_INVALID";
    }
}

static std::string transformToString(const uint32_t transform) {
    if (transform == Transform::IDENTITY) {
        return "IDENTITY";
    }

    if (transform == Transform::UNKNOWN) {
        return "UNKNOWN";
    }

    std::string out;
    if (transform & Transform::SCALE) out.append("SCALE ");
    if (transform & Transform::ROTATE) out.append("ROTATE ");
    if (transform & Transform::TRANSLATE) out.append("TRANSLATE");
    return out;
}

void Transform::dump(std::string& out, const char* name, const char* prefix) const {
    using android::base::StringAppendF;

    type(); // Ensure the information in mType is up to date
@@ -465,38 +501,29 @@ void Transform::dump(std::string& out, const char* name) const {
    const uint32_t type = mType;
    const uint32_t orient = type >> 8;

    StringAppendF(&out, "%s 0x%08x (", name, orient);
    out += prefix;
    out += name;
    out += " ";

    if (orient & ROT_INVALID) {
        out.append("ROT_INVALID ");
    } else {
        if (orient & ROT_90) {
            out.append("ROT_90 ");
        } else {
            out.append("ROT_0 ");
        StringAppendF(&out, "0x%08x ", orient);
    }
        if (orient & FLIP_V) out.append("FLIP_V ");
        if (orient & FLIP_H) out.append("FLIP_H ");
    }

    StringAppendF(&out, ") 0x%02x (", type);
    out += "(" + rotationToString(orient) + ") ";

    if (!(type & (SCALE | ROTATE | TRANSLATE))) out.append("IDENTITY ");
    if (type & SCALE) out.append("SCALE ");
    if (type & ROTATE) out.append("ROTATE ");
    if (type & TRANSLATE) out.append("TRANSLATE ");

    out.append(")\n");
    if (type & UNKNOWN) {
        StringAppendF(&out, "0x%02x ", type);
    }
    out += "(" + transformToString(type) + ")\n";

    for (size_t i = 0; i < 3; i++) {
        StringAppendF(&out, "    %.4f  %.4f  %.4f\n", static_cast<double>(mMatrix[0][i]),
        StringAppendF(&out, "%s    %.4f  %.4f  %.4f\n", prefix, static_cast<double>(mMatrix[0][i]),
                      static_cast<double>(mMatrix[1][i]), static_cast<double>(mMatrix[2][i]));
    }
}

void Transform::dump(const char* name) const {
void Transform::dump(const char* name, const char* prefix) const {
    std::string out;
    dump(out, name);
    dump(out, name, prefix);
    ALOGD("%s", out.c_str());
}

+2 −2
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ public:
    Transform inverse() const;

    // for debugging
    void dump(std::string& result, const char* name) const;
    void dump(const char* name) const;
    void dump(std::string& result, const char* name, const char* prefix = "") const;
    void dump(const char* name, const char* prefix = "") const;

    static RotationFlags toRotationFlags(Rotation);

+1 −1
Original line number Diff line number Diff line
@@ -4245,7 +4245,7 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) {
                                         "ms\n",
                                         windowInfo->ownerPid, windowInfo->ownerUid,
                                         millis(windowInfo->dispatchingTimeout));
                    windowInfo->transform.dump(dump, INDENT4 "transform=");
                    windowInfo->transform.dump(dump, "transform", INDENT4);
                }
            } else {
                dump += INDENT2 "Windows: <none>\n";
+3 −4
Original line number Diff line number Diff line
@@ -74,10 +74,10 @@ const ui::Transform& InputTarget::getDefaultPointerTransform() const {
}

std::string InputTarget::getPointerInfoString() const {
    std::string out;
    std::string out = "\n";
    if (useDefaultPointerTransform()) {
        const ui::Transform& transform = getDefaultPointerTransform();
        transform.dump(out, "default");
        transform.dump(out, "default", "        ");
        return out;
    }

@@ -86,9 +86,8 @@ std::string InputTarget::getPointerInfoString() const {
            continue;
        }

        out += "\n";
        const std::string name = "pointerId " + std::to_string(i) + ":";
        pointerTransforms[i].dump(out, name.c_str());
        pointerTransforms[i].dump(out, name.c_str(), "        ");
    }
    return out;
}