Merge "Do not recreate ImeInputEventSender for the same channel" into sc-dev am: 0d2041dec3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14229516

Change-Id: I7484c6aa892666fc7489f9a156ff2a3f24d9f346
This commit is contained in:
TreeHugger Robot
2021-05-13 19:01:47 +00:00
committed by Automerger Merge Worker

View File

@@ -1519,17 +1519,25 @@ public final class InputMethodManager {
}
void setInputChannelLocked(InputChannel channel) {
if (mCurChannel != channel) {
if (mCurSender != null) {
flushPendingEventsLocked();
mCurSender.dispose();
mCurSender = null;
}
if (mCurChannel != null) {
mCurChannel.dispose();
}
mCurChannel = channel;
if (mCurChannel == channel) {
return;
}
if (mCurChannel != null && channel != null
&& mCurChannel.getToken() == channel.getToken()) {
// channel is a dupe of 'mCurChannel', because they have the same token, and represent
// the same connection. Ignore the incoming channel and keep using 'mCurChannel' to
// avoid confusing the InputEventReceiver.
return;
}
if (mCurSender != null) {
flushPendingEventsLocked();
mCurSender.dispose();
mCurSender = null;
}
if (mCurChannel != null) {
mCurChannel.dispose();
}
mCurChannel = channel;
}
/**