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

Commit 4fd6cc50 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Log when TouchInputMapper drops touch

Today, it's possible for InputReader to drop touch without any logs,
which makes it difficult to debug issues like 'dropped touches', either
in the field, or during test failures.

These logs will make it explicit that touch is being dropped. Unless
virtual key is pressed, this should not occur under normal device
operation.

Bug: 396796958
Test: atest inputflinger_tests
Flag: EXEMPT refactor
Change-Id: Ibbd69e8380d0d4d9e6e6d07936dc98ab958baf2a
parent f0ef43a9
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@


#include <math.h>
#include <math.h>


#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android-base/stringprintf.h>
#include <android/input.h>
#include <android/input.h>
#include <com_android_input_flags.h>
#include <com_android_input_flags.h>
@@ -1484,6 +1485,7 @@ std::list<NotifyArgs> TouchInputMapper::cookAndDispatch(nsecs_t when, nsecs_t re
    bool consumed;
    bool consumed;
    out += consumeRawTouches(when, readTime, policyFlags, consumed /*byref*/);
    out += consumeRawTouches(when, readTime, policyFlags, consumed /*byref*/);
    if (consumed) {
    if (consumed) {
        LOG_IF(INFO, debugRawEvents()) << "Touch consumed by consumeRawTouches, eventTime=" << when;
        mCurrentRawState.rawPointerData.clear();
        mCurrentRawState.rawPointerData.clear();
    }
    }


@@ -1724,6 +1726,7 @@ std::list<NotifyArgs> TouchInputMapper::consumeRawTouches(nsecs_t when, nsecs_t
        }
        }
        if (!hoveringPointersInFrame) {
        if (!hoveringPointersInFrame) {
            // All hovering pointers are outside the physical frame.
            // All hovering pointers are outside the physical frame.
            LOG(WARNING) << "Dropping hover, all pointers are outside the physical frame";
            outConsumed = true;
            outConsumed = true;
            return out;
            return out;
        }
        }
@@ -1762,6 +1765,8 @@ std::list<NotifyArgs> TouchInputMapper::consumeRawTouches(nsecs_t when, nsecs_t
                    }
                    }
                }
                }
            }
            }
            LOG(WARNING) << "Dropping pointer " << id << " at (" << pointer.x << ", " << pointer.y
                         << "), it is outside of the physical frame";
            outConsumed = true;
            outConsumed = true;
            return out;
            return out;
        }
        }