From 20f5fd8744b5f57bc3e8e72e0fe1be94b5297f52 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Fri, 28 Oct 2022 14:12:24 +0100 Subject: Add TouchSpotController to PointerController dump. Bug: 254277939 Test: manually inspect `dumpsys input` Change-Id: I3a50e13885df90253335f013cda28b5ce9d2def7 --- libs/input/TouchSpotController.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libs/input/TouchSpotController.cpp') diff --git a/libs/input/TouchSpotController.cpp b/libs/input/TouchSpotController.cpp index 4ac66c4ffb6a..d9fe5996bcff 100644 --- a/libs/input/TouchSpotController.cpp +++ b/libs/input/TouchSpotController.cpp @@ -21,8 +21,15 @@ #include "TouchSpotController.h" +#include +#include #include +#include + +#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 -- cgit v1.2.3-59-g8ed1b