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

Commit 7a04f377 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Per-display verifiers for InputDispatcherFuzzer" into main

parents 9a8dd7cf 119604e7
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -41,12 +41,14 @@ static constexpr int32_t MAX_RANDOM_WINDOWS = 4;
class NotifyStreamProvider {
public:
    NotifyStreamProvider(FuzzedDataProvider& fdp)
          : mFdp(fdp), mIdGenerator(IdGenerator::Source::OTHER), mVerifier("Fuzz verifier") {}
          : mFdp(fdp), mIdGenerator(IdGenerator::Source::OTHER) {}

    std::optional<NotifyMotionArgs> nextMotion() {
        NotifyMotionArgs args = generateFuzzedMotionArgs(mIdGenerator, mFdp, MAX_RANDOM_DISPLAYS);
        auto [it, _] = mVerifiers.emplace(args.displayId, "Fuzz Verifier");
        InputVerifier& verifier = it->second;
        const Result<void> result =
                mVerifier.processMovement(args.deviceId, args.source, args.action,
                verifier.processMovement(args.deviceId, args.source, args.action,
                                         args.getPointerCount(), args.pointerProperties.data(),
                                         args.pointerCoords.data(), args.flags);
        if (result.ok()) {
@@ -60,7 +62,7 @@ private:

    IdGenerator mIdGenerator;

    InputVerifier mVerifier;
    std::map<int32_t /*displayId*/, InputVerifier> mVerifiers;
};

} // namespace