summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-08-23 20:27:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-08-23 20:27:58 +0000
commitf3af176ff16d9faf0e5198d55f0fa7c9c9daf372 (patch)
tree1c7dad83851371a7b851fa06ad5ccee5926f1e26
parent0bd3275a71e2e5a5dd6b08a16be92e2e1e775664 (diff)
parent70dc879484f1e5fc89a5efd31958113ff2ee36c0 (diff)
downloadnative-f3af176ff16d9faf0e5198d55f0fa7c9c9daf372.tar.gz
Merge "change DEBUG_ACCELERATION define to constexpr"
-rw-r--r--libs/input/VelocityControl.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/libs/input/VelocityControl.cpp b/libs/input/VelocityControl.cpp
index 0c3ad633f6..03c49cc89d 100644
--- a/libs/input/VelocityControl.cpp
+++ b/libs/input/VelocityControl.cpp
@@ -18,7 +18,7 @@
//#define LOG_NDEBUG 0
// Log debug messages about acceleration.
-#define DEBUG_ACCELERATION 0
+static constexpr bool DEBUG_ACCELERATION = false;
#include <math.h>
#include <limits.h>
@@ -52,12 +52,10 @@ void VelocityControl::reset() {
void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) {
if ((deltaX && *deltaX) || (deltaY && *deltaY)) {
if (eventTime >= mLastMovementTime + STOP_TIME) {
-#if DEBUG_ACCELERATION
- if (mLastMovementTime != LLONG_MIN) {
- ALOGD("VelocityControl: stopped, last movement was %0.3fms ago",
- (eventTime - mLastMovementTime) * 0.000001f);
- }
-#endif
+ if (DEBUG_ACCELERATION && mLastMovementTime != LLONG_MIN) {
+ ALOGD("VelocityControl: stopped, last movement was %0.3fms ago",
+ (eventTime - mLastMovementTime) * 0.000001f);
+ }
reset();
}
@@ -85,19 +83,20 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) {
* (mParameters.acceleration - 1);
}
-#if DEBUG_ACCELERATION
- ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
- "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f",
- mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
- mParameters.acceleration,
- vx, vy, speed, scale / mParameters.scale);
-#endif
+ if (DEBUG_ACCELERATION) {
+ ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
+ "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f",
+ mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
+ mParameters.acceleration,
+ vx, vy, speed, scale / mParameters.scale);
+ }
+
} else {
-#if DEBUG_ACCELERATION
- ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
- mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
- mParameters.acceleration);
-#endif
+ if (DEBUG_ACCELERATION) {
+ ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
+ mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
+ mParameters.acceleration);
+ }
}
if (deltaX) {