Unregister input channel by token
An input channel is uniquely identified by its token. Once the input
channel exists, you can unregister it simply using its token.
There's no need to pass back the entire input channel, including its id,
to input dispatcher. We will look for the server-side input channel
using the token anyways.
Bug: 167947395
Test: atest libinput_tests
Change-Id: I009da372bd6cc897b019a66e9c3bbed78cc91223
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 93d3fde..c3d6b18 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -121,7 +121,7 @@
virtual void setFocusedWindow(const FocusRequest&) override;
virtual status_t registerInputMonitor(const std::shared_ptr<InputChannel>& inputChannel,
int32_t displayId, bool isGestureMonitor) override;
- virtual status_t unregisterInputChannel(const InputChannel& inputChannel) override;
+ virtual status_t unregisterInputChannel(const sp<IBinder>& connectionToken) override;
virtual status_t pilferPointers(const sp<IBinder>& token) override;
std::array<uint8_t, 32> sign(const VerifiedInputEvent& event) const;
@@ -490,11 +490,11 @@
std::string dumpFocusedWindowsLocked() REQUIRES(mLock);
// Registration.
- void removeMonitorChannelLocked(const InputChannel& inputChannel) REQUIRES(mLock);
+ void removeMonitorChannelLocked(const sp<IBinder>& connectionToken) REQUIRES(mLock);
void removeMonitorChannelLocked(
- const InputChannel& inputChannel,
+ const sp<IBinder>& connectionToken,
std::unordered_map<int32_t, std::vector<Monitor>>& monitorsByDisplay) REQUIRES(mLock);
- status_t unregisterInputChannelLocked(const InputChannel& inputChannel, bool notify)
+ status_t unregisterInputChannelLocked(const sp<IBinder>& connectionToken, bool notify)
REQUIRES(mLock);
// Interesting events that we might like to log or tell the framework about.