summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Zixuan Qu <zixuanqu@google.com> 2022-11-11 04:47:51 +0000
committer Zixuan Qu <zixuanqu@google.com> 2022-11-14 23:57:16 +0000
commit79b76d190b1c6bf78fe4ade91c0d6f1a4c637ee7 (patch)
treec9e3cdf9d58ed97830f0cebde7a36031822413e8
parentf8ebb5b58d973109811154eae03d687b9da2c87c (diff)
Dump WheelVelocityControlParameters in individual CursorInputMappers.
This information is currently only dumped from InputReader as a global state. However device can have different configurations in the related CursorInputMapper. Test: Manual - adb shell dumpsys input Change-Id: Ibec2b5ff2533c74924a542fe98d13fa8a88e40ca
-rw-r--r--include/input/VelocityControl.h12
-rw-r--r--libs/input/VelocityControl.cpp4
-rw-r--r--services/inputflinger/reader/mapper/CursorInputMapper.cpp4
3 files changed, 20 insertions, 0 deletions
diff --git a/include/input/VelocityControl.h b/include/input/VelocityControl.h
index f72a1bdded..f3c201e7c4 100644
--- a/include/input/VelocityControl.h
+++ b/include/input/VelocityControl.h
@@ -16,10 +16,13 @@
#pragma once
+#include <android-base/stringprintf.h>
#include <input/Input.h>
#include <input/VelocityTracker.h>
#include <utils/Timers.h>
+using android::base::StringPrintf;
+
namespace android {
/*
@@ -69,6 +72,12 @@ struct VelocityControlParameters {
scale(scale), lowThreshold(lowThreshold),
highThreshold(highThreshold), acceleration(acceleration) {
}
+
+ std::string dump() const {
+ return StringPrintf("scale=%0.3f, lowThreshold=%0.3f, highThreshold=%0.3f, "
+ "acceleration=%0.3f\n",
+ scale, lowThreshold, highThreshold, acceleration);
+ }
};
/*
@@ -78,6 +87,9 @@ class VelocityControl {
public:
VelocityControl();
+ /* Gets the various parameters. */
+ VelocityControlParameters& getParameters();
+
/* Sets the various parameters. */
void setParameters(const VelocityControlParameters& parameters);
diff --git a/libs/input/VelocityControl.cpp b/libs/input/VelocityControl.cpp
index e2bfb508e1..5c008b1158 100644
--- a/libs/input/VelocityControl.cpp
+++ b/libs/input/VelocityControl.cpp
@@ -37,6 +37,10 @@ VelocityControl::VelocityControl() {
reset();
}
+VelocityControlParameters& VelocityControl::getParameters() {
+ return mParameters;
+}
+
void VelocityControl::setParameters(const VelocityControlParameters& parameters) {
mParameters = parameters;
reset();
diff --git a/services/inputflinger/reader/mapper/CursorInputMapper.cpp b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
index a4f257c4b6..5657d619d1 100644
--- a/services/inputflinger/reader/mapper/CursorInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/CursorInputMapper.cpp
@@ -117,6 +117,10 @@ void CursorInputMapper::dump(std::string& dump) {
toString(mCursorScrollAccumulator.haveRelativeVWheel()));
dump += StringPrintf(INDENT3 "HaveHWheel: %s\n",
toString(mCursorScrollAccumulator.haveRelativeHWheel()));
+ dump += StringPrintf(INDENT3 "WheelYVelocityControlParameters: %s",
+ mWheelYVelocityControl.getParameters().dump().c_str());
+ dump += StringPrintf(INDENT3 "WheelXVelocityControlParameters: %s",
+ mWheelXVelocityControl.getParameters().dump().c_str());
dump += StringPrintf(INDENT3 "VWheelScale: %0.3f\n", mVWheelScale);
dump += StringPrintf(INDENT3 "HWheelScale: %0.3f\n", mHWheelScale);
dump += StringPrintf(INDENT3 "DisplayId: %s\n", toString(mDisplayId).c_str());