From 18050095be7d5b7d13861d721f2daf26605ed22b Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 1 Sep 2021 13:32:49 -0700 Subject: 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 --- services/inputflinger/InputManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'services/inputflinger/InputManager.cpp') diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp index 7b3658dfde..221e193136 100644 --- a/services/inputflinger/InputManager.cpp +++ b/services/inputflinger/InputManager.cpp @@ -58,8 +58,8 @@ InputManager::InputManager( const sp& readerPolicy, const sp& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); - mClassifier = new InputClassifier(mDispatcher); - mReader = createInputReader(readerPolicy, mClassifier); + mClassifier = std::make_unique(*mDispatcher); + mReader = createInputReader(readerPolicy, *mClassifier); } InputManager::~InputManager() { @@ -102,16 +102,16 @@ status_t InputManager::stop() { return status; } -sp InputManager::getReader() { - return mReader; +InputReaderInterface& InputManager::getReader() { + return *mReader; } -sp InputManager::getClassifier() { - return mClassifier; +InputClassifierInterface& InputManager::getClassifier() { + return *mClassifier; } -sp InputManager::getDispatcher() { - return mDispatcher; +InputDispatcherInterface& InputManager::getDispatcher() { + return *mDispatcher; } // Used by tests only. -- cgit v1.2.3-59-g8ed1b