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

Commit 7fae5708 authored by Asmita Poddar's avatar Asmita Poddar Committed by Android (Google) Code Review
Browse files

Merge "Pass ProductId+VendorId+Source info to LatencyTracker" into main

parents 2ca464ed dd9a6cdf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ enum class InputDeviceUsageSource : int32_t {

    ftl_first = UNKNOWN,
    ftl_last = TRACKBALL,
    // Used by latency fuzzer
    kMaxValue = ftl_last
};

/** Returns the InputDeviceUsageSource that corresponds to the key event. */
+10 −1
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@
#include <queue>
#include <sstream>

#include "../InputDeviceMetricsSource.h"

#include "Connection.h"
#include "DebugConfig.h"
#include "InputDispatcher.h"
@@ -4226,6 +4228,11 @@ std::unique_ptr<MotionEntry> InputDispatcher::splitMotionEvent(
    return splitMotionEntry;
}

void InputDispatcher::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) {
    std::scoped_lock _l(mLock);
    mLatencyTracker.setInputDevices(args.inputDeviceInfos);
}

void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) {
    if (debugInboundEventDetails()) {
        ALOGD("notifyConfigurationChanged - eventTime=%" PRId64, args.eventTime);
@@ -4438,7 +4445,9 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) {
            IdGenerator::getSource(args.id) == IdGenerator::Source::INPUT_READER &&
            !mInputFilterEnabled) {
            const bool isDown = args.action == AMOTION_EVENT_ACTION_DOWN;
            mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime);
            std::set<InputDeviceUsageSource> sources = getUsageSourcesForMotionArgs(args);
            mLatencyTracker.trackListener(args.id, isDown, args.eventTime, args.readTime,
                                          args.deviceId, sources);
        }

        needWake = enqueueInboundEventLocked(std::move(newEntry));
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public:
    status_t start() override;
    status_t stop() override;

    void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override{};
    void notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) override;
    void notifyConfigurationChanged(const NotifyConfigurationChangedArgs& args) override;
    void notifyKey(const NotifyKeyArgs& args) override;
    void notifyMotion(const NotifyMotionArgs& args) override;
+13 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#include "InputEventTimeline.h"

#include "../InputDeviceMetricsSource.h"

namespace android::inputdispatcher {

ConnectionTimeline::ConnectionTimeline(nsecs_t deliveryTime, nsecs_t consumeTime,
@@ -64,8 +66,15 @@ bool ConnectionTimeline::operator!=(const ConnectionTimeline& rhs) const {
    return !operator==(rhs);
}

InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime)
      : isDown(isDown), eventTime(eventTime), readTime(readTime) {}
InputEventTimeline::InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime,
                                       uint16_t vendorId, uint16_t productId,
                                       std::set<InputDeviceUsageSource> sources)
      : isDown(isDown),
        eventTime(eventTime),
        readTime(readTime),
        vendorId(vendorId),
        productId(productId),
        sources(sources) {}

bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const {
    if (connectionTimelines.size() != rhs.connectionTimelines.size()) {
@@ -80,7 +89,8 @@ bool InputEventTimeline::operator==(const InputEventTimeline& rhs) const {
            return false;
        }
    }
    return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime;
    return isDown == rhs.isDown && eventTime == rhs.eventTime && readTime == rhs.readTime &&
            vendorId == rhs.vendorId && productId == rhs.productId && sources == rhs.sources;
}

} // namespace android::inputdispatcher
+7 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#pragma once

#include "../InputDeviceMetricsSource.h"

#include <binder/IBinder.h>
#include <input/Input.h>
#include <unordered_map>
@@ -73,10 +75,14 @@ private:
};

struct InputEventTimeline {
    InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime);
    InputEventTimeline(bool isDown, nsecs_t eventTime, nsecs_t readTime, uint16_t vendorId,
                       uint16_t productId, std::set<InputDeviceUsageSource> sources);
    const bool isDown; // True if this is an ACTION_DOWN event
    const nsecs_t eventTime;
    const nsecs_t readTime;
    const uint16_t vendorId;
    const uint16_t productId;
    const std::set<InputDeviceUsageSource> sources;

    struct IBinderHash {
        std::size_t operator()(const sp<IBinder>& b) const {
Loading