Per-display verifiers for InputDispatcherFuzzer
Before this CL, a single verifier was used inside InputDispatcherFuzzer,
which isn't correct. The event sequences are supposed to be per-display.
Therefore, we should have a verifier for each display.
Bug: 287342122
Test: FUZZER=inputflinger_input_dispatcher_fuzzer; m $FUZZER && ASAN_OPTIONS=detect_odr_violation=0 $ANDROID_HOST_OUT/fuzz/x86_64/$FUZZER/$FUZZER
Change-Id: Id58da6ccedca4cdb5d221bbc4f1d64e069b86689
diff --git a/services/inputflinger/tests/fuzzers/InputDispatcherFuzzer.cpp b/services/inputflinger/tests/fuzzers/InputDispatcherFuzzer.cpp
index 214649c..0bd8fb3 100644
--- a/services/inputflinger/tests/fuzzers/InputDispatcherFuzzer.cpp
+++ b/services/inputflinger/tests/fuzzers/InputDispatcherFuzzer.cpp
@@ -41,14 +41,16 @@
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,
- args.getPointerCount(), args.pointerProperties.data(),
- args.pointerCoords.data(), args.flags);
+ verifier.processMovement(args.deviceId, args.source, args.action,
+ args.getPointerCount(), args.pointerProperties.data(),
+ args.pointerCoords.data(), args.flags);
if (result.ok()) {
return args;
}
@@ -60,7 +62,7 @@
IdGenerator mIdGenerator;
- InputVerifier mVerifier;
+ std::map<int32_t /*displayId*/, InputVerifier> mVerifiers;
};
} // namespace