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

Commit 20f5fd87 authored by Michael Wright's avatar Michael Wright
Browse files

Add TouchSpotController to PointerController dump.

Bug: 254277939
Test: manually inspect `dumpsys input`
Change-Id: I3a50e13885df90253335f013cda28b5ce9d2def7
parent 21401ad9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -331,6 +331,10 @@ void PointerController::dump(std::string& dump) {
    for (const auto& info : mLocked.mDisplayInfos) {
        info.dump(dump, INDENT3);
    }
    dump += INDENT2 "Spot Controllers:\n";
    for (const auto& [_, spotController] : mLocked.spotControllers) {
        spotController.dump(dump, INDENT3);
    }
}

} // namespace android
+31 −0
Original line number Diff line number Diff line
@@ -21,8 +21,15 @@

#include "TouchSpotController.h"

#include <android-base/stringprintf.h>
#include <input/PrintTools.h>
#include <log/log.h>

#include <mutex>

#define INDENT "  "
#define INDENT2 "    "

namespace {
// Time to spend fading out the spot completely.
const nsecs_t SPOT_FADE_DURATION = 200 * 1000000LL; // 200 ms
@@ -53,6 +60,12 @@ void TouchSpotController::Spot::updateSprite(const SpriteIcon* icon, float x, fl
    }
}

void TouchSpotController::Spot::dump(std::string& out, const char* prefix) const {
    out += prefix;
    base::StringAppendF(&out, "Spot{id=%" PRIx32 ", alpha=%f, scale=%f, pos=[%f, %f]}\n", id, alpha,
                        scale, x, y);
}

// --- TouchSpotController ---

TouchSpotController::TouchSpotController(int32_t displayId, PointerControllerContext& context)
@@ -255,4 +268,22 @@ void TouchSpotController::startAnimationLocked() REQUIRES(mLock) {
    mContext.addAnimationCallback(mDisplayId, func);
}

void TouchSpotController::dump(std::string& out, const char* prefix) const {
    using base::StringAppendF;
    out += prefix;
    out += "SpotController:\n";
    out += prefix;
    StringAppendF(&out, INDENT "DisplayId: %" PRId32 "\n", mDisplayId);
    std::scoped_lock lock(mLock);
    out += prefix;
    StringAppendF(&out, INDENT "Animating: %s\n", toString(mLocked.animating));
    out += prefix;
    out += INDENT "Spots:\n";
    std::string spotPrefix = prefix;
    spotPrefix += INDENT2;
    for (const auto& spot : mLocked.displaySpots) {
        spot->dump(out, spotPrefix.c_str());
    }
}

} // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ public:
    void reloadSpotResources();
    bool doAnimations(nsecs_t timestamp);

    void dump(std::string& out, const char* prefix = "") const;

private:
    struct Spot {
        static const uint32_t INVALID_ID = 0xffffffff;
@@ -58,6 +60,7 @@ private:
                mLastIcon(nullptr) {}

        void updateSprite(const SpriteIcon* icon, float x, float y, int32_t displayId);
        void dump(std::string& out, const char* prefix = "") const;

    private:
        const SpriteIcon* mLastIcon;