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

Commit 920f30e6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "change DEBUG_ACCELERATION define to constexpr" am: f3af176f

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1805817

Change-Id: I86564459a5ecc103ae547e8b204215e90697d587
parents 4fbb9e00 f3af176f
Loading
Loading
Loading
Loading
+18 −19
Original line number Original line Diff line number Diff line
@@ -18,7 +18,7 @@
//#define LOG_NDEBUG 0
//#define LOG_NDEBUG 0


// Log debug messages about acceleration.
// Log debug messages about acceleration.
#define DEBUG_ACCELERATION 0
static constexpr bool DEBUG_ACCELERATION = false;


#include <math.h>
#include <math.h>
#include <limits.h>
#include <limits.h>
@@ -52,12 +52,10 @@ void VelocityControl::reset() {
void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) {
void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) {
    if ((deltaX && *deltaX) || (deltaY && *deltaY)) {
    if ((deltaX && *deltaX) || (deltaY && *deltaY)) {
        if (eventTime >= mLastMovementTime + STOP_TIME) {
        if (eventTime >= mLastMovementTime + STOP_TIME) {
#if DEBUG_ACCELERATION
            if (DEBUG_ACCELERATION && mLastMovementTime != LLONG_MIN) {
	    if (mLastMovementTime != LLONG_MIN) {
                ALOGD("VelocityControl: stopped, last movement was %0.3fms ago",
                ALOGD("VelocityControl: stopped, last movement was %0.3fms ago",
                           (eventTime - mLastMovementTime) * 0.000001f);
                           (eventTime - mLastMovementTime) * 0.000001f);
            }
            }
#endif
            reset();
            reset();
        }
        }


@@ -85,19 +83,20 @@ void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) {
                        * (mParameters.acceleration - 1);
                        * (mParameters.acceleration - 1);
            }
            }


#if DEBUG_ACCELERATION
            if (DEBUG_ACCELERATION) {
                ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
                ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): "
                        "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f",
                        "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f",
                        mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                        mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                        mParameters.acceleration,
                        mParameters.acceleration,
                        vx, vy, speed, scale / mParameters.scale);
                        vx, vy, speed, scale / mParameters.scale);
#endif
            }

        } else {
        } else {
#if DEBUG_ACCELERATION
            if (DEBUG_ACCELERATION) {
                ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
                ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity",
                        mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                        mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold,
                        mParameters.acceleration);
                        mParameters.acceleration);
#endif
            }
        }
        }


        if (deltaX) {
        if (deltaX) {