Remove RefBase from InputListener interface
We don't need refbase for inputlisteners. Remove it, and switch to
references, which cannot be null. This way, we can avoid dereferencing
the pointers without checking for nullness.
Bug: 198472780
Test: atest inputflinger_tests
Change-Id: I2f469fd268472c7e78d36812353cff5c52a90163
diff --git a/services/inputflinger/reader/InputReaderFactory.cpp b/services/inputflinger/reader/InputReaderFactory.cpp
index a897141..2d9ffc3 100644
--- a/services/inputflinger/reader/InputReaderFactory.cpp
+++ b/services/inputflinger/reader/InputReaderFactory.cpp
@@ -20,9 +20,9 @@
namespace android {
-sp<InputReaderInterface> createInputReader(const sp<InputReaderPolicyInterface>& policy,
- const sp<InputListenerInterface>& listener) {
- return new InputReader(std::make_unique<EventHub>(), policy, listener);
+std::unique_ptr<InputReaderInterface> createInputReader(
+ const sp<InputReaderPolicyInterface>& policy, InputListenerInterface& listener) {
+ return std::make_unique<InputReader>(std::make_unique<EventHub>(), policy, listener);
}
} // namespace android
\ No newline at end of file