Pass unique_ptr of InputChannel to Connection
This gets us closer to the goal of storing unique_ptr of InputChannel
inside the InputPublisher.
In this CL, we are still allowing the "copy" and "dup" functions to
exist. Removing those requires significant refactoring on the Java side,
including the jni layer and object ownership models.
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Bug: 161009324
Change-Id: If6f44d78c7fc9f3e12729068de1753847abf0ebb
diff --git a/services/inputflinger/dispatcher/Connection.h b/services/inputflinger/dispatcher/Connection.h
index 8d7f182..a834a8c 100644
--- a/services/inputflinger/dispatcher/Connection.h
+++ b/services/inputflinger/dispatcher/Connection.h
@@ -58,11 +58,11 @@
// yet received a "finished" response from the application.
std::deque<std::unique_ptr<DispatchEntry>> waitQueue;
- Connection(const std::shared_ptr<InputChannel>& inputChannel, bool monitor,
+ Connection(std::unique_ptr<InputChannel> inputChannel, bool monitor,
const IdGenerator& idGenerator);
inline const std::string getInputChannelName() const {
- return inputPublisher.getChannel()->getName();
+ return inputPublisher.getChannel().getName();
}
sp<IBinder> getToken() const;