inputflinger fuzzers: remove FuzzContainer.getPolicyConfig
Because FuzzInputReaderPolicy::getReaderConfiguration does nothing, any
calls to getPolicyConfig can be replaced with default
InputReaderConfiguration structs. This makes it clearer where where a
fuzzer is getting its configuration from, and therefore makes it easier
to understand the fuzzer without having to dig into FuzzContainer and
FuzzInputReaderPolicy.
InputReaderPolicyInterface::getReaderConfiguration is not called by any
of the code being fuzzed, so it's unlikely that
FuzzInputReaderPolicy::getReaderConfiguration will need to be modified
to return a non-default InputReaderConfiguration in future.
Bug: 245989146
Test: build and briefly run all modified fuzzers
$ SANITIZE_TARGET=hwaddress make ${FUZZER_NAME}
$ cd $ANDROID_PRODUCT_OUT
$ adb root
$ adb sync data
$ adb shell /data/fuzz/$(get_build_var TARGET_ARCH)/${FUZZER_NAME}/${FUZZER_NAME}
Change-Id: If933e1ce81439831b24c61dde1c2d24ed1a00942
diff --git a/services/inputflinger/tests/fuzzers/KeyboardInputFuzzer.cpp b/services/inputflinger/tests/fuzzers/KeyboardInputFuzzer.cpp
index d11e8ae..54977df 100644
--- a/services/inputflinger/tests/fuzzers/KeyboardInputFuzzer.cpp
+++ b/services/inputflinger/tests/fuzzers/KeyboardInputFuzzer.cpp
@@ -15,6 +15,7 @@
*/
#include <FuzzContainer.h>
+#include <InputReaderBase.h>
#include <KeyboardInputMapper.h>
#include <MapperHelpers.h>
@@ -45,9 +46,9 @@
std::make_shared<ThreadSafeFuzzedDataProvider>(data, size);
FuzzContainer fuzzer(fdp);
- auto policyConfig = fuzzer.getPolicyConfig();
KeyboardInputMapper& mapper =
- fuzzer.getMapper<KeyboardInputMapper>(policyConfig, fdp->ConsumeIntegral<uint32_t>(),
+ fuzzer.getMapper<KeyboardInputMapper>(InputReaderConfiguration{},
+ fdp->ConsumeIntegral<uint32_t>(),
fdp->ConsumeIntegral<int32_t>());
// Loop through mapper operations until randomness is exhausted.
@@ -65,7 +66,7 @@
[&]() -> void { mapper.getSources(); },
[&]() -> void {
std::list<NotifyArgs> unused =
- mapper.reconfigure(fdp->ConsumeIntegral<nsecs_t>(), policyConfig,
+ mapper.reconfigure(fdp->ConsumeIntegral<nsecs_t>(), /*readerConfig=*/{},
InputReaderConfiguration::Change(
fdp->ConsumeIntegral<uint32_t>()));
},