Clean up InputDispatcherPolicyInterface
- Remove RefBase from policy
- Store reference instead of pointer to policy
- Use references instead of pointers in parameters
- Use return values for all outputs for functions instead of passing an
out parameter
Bug: 279927189
Bug: 245989146
Test: Presubmit
Change-Id: I31a2a3e8c67960020169ddfc59bc0a59f3e65c52
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index dd7f7fe..2a06908 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -82,8 +82,8 @@
public:
static constexpr bool kDefaultInTouchMode = true;
- explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy);
- explicit InputDispatcher(const sp<InputDispatcherPolicyInterface>& policy,
+ explicit InputDispatcher(InputDispatcherPolicyInterface& policy);
+ explicit InputDispatcher(InputDispatcherPolicyInterface& policy,
std::chrono::nanoseconds staleEventTimeout);
~InputDispatcher() override;
@@ -167,7 +167,7 @@
std::unique_ptr<InputThread> mThread;
- sp<InputDispatcherPolicyInterface> mPolicy;
+ InputDispatcherPolicyInterface& mPolicy;
android::InputDispatcherConfiguration mConfig GUARDED_BY(mLock);
std::mutex mLock;