diff options
| author | 2021-09-01 13:32:49 -0700 | |
|---|---|---|
| committer | 2021-09-29 13:18:30 -0700 | |
| commit | 18050095be7d5b7d13861d721f2daf26605ed22b (patch) | |
| tree | d5fa351d5fc5d3b2067846bce5bc632a2c72d0cc /services/inputflinger/InputManager.cpp | |
| parent | 91773046fbcc3da53e954a8bdbfdb95f9f482fca (diff) | |
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
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
| -rw-r--r-- | services/inputflinger/InputManager.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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<InputReaderPolicyInterface>& readerPolicy, const sp<InputDispatcherPolicyInterface>& dispatcherPolicy) { mDispatcher = createInputDispatcher(dispatcherPolicy); - mClassifier = new InputClassifier(mDispatcher); - mReader = createInputReader(readerPolicy, mClassifier); + mClassifier = std::make_unique<InputClassifier>(*mDispatcher); + mReader = createInputReader(readerPolicy, *mClassifier); } InputManager::~InputManager() { @@ -102,16 +102,16 @@ status_t InputManager::stop() { return status; } -sp<InputReaderInterface> InputManager::getReader() { - return mReader; +InputReaderInterface& InputManager::getReader() { + return *mReader; } -sp<InputClassifierInterface> InputManager::getClassifier() { - return mClassifier; +InputClassifierInterface& InputManager::getClassifier() { + return *mClassifier; } -sp<InputDispatcherInterface> InputManager::getDispatcher() { - return mDispatcher; +InputDispatcherInterface& InputManager::getDispatcher() { + return *mDispatcher; } // Used by tests only. |