summaryrefslogtreecommitdiff
path: root/libs/input/TouchSpotController.cpp
diff options
context:
space:
mode:
author Michael Wright <michaelwr@google.com> 2022-10-28 14:12:24 +0100
committer Michael Wright <michaelwr@google.com> 2022-11-11 14:04:13 +0000
commit20f5fd8744b5f57bc3e8e72e0fe1be94b5297f52 (patch)
tree19a7797f0e646914255b237421e779df10d7dbfe /libs/input/TouchSpotController.cpp
parent21401ad9c017b49614743b16164ef4dba5899563 (diff)
Add TouchSpotController to PointerController dump.
Bug: 254277939 Test: manually inspect `dumpsys input` Change-Id: I3a50e13885df90253335f013cda28b5ce9d2def7
Diffstat (limited to 'libs/input/TouchSpotController.cpp')
-rw-r--r--libs/input/TouchSpotController.cpp31
1 files changed, 31 insertions, 0 deletions
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 <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