Extract isSelectedMethodBound method

Bug: 205676419
Test: make
Change-Id: I0b08f54ee46422980ce8738c12c02cfe6ba29ad8
This commit is contained in:
Nikolas Havrikov
2021-11-09 12:39:54 +01:00
parent 95b509ea98
commit 9bc49a5abb

View File

@@ -2459,8 +2459,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
// Check if the input method is changing.
// We expect the caller has already verified that the client is allowed to access this
// display ID.
if (getCurId() != null && getCurId().equals(getSelectedMethodId())
&& displayIdToShowIme == mCurTokenDisplayId) {
if (isSelectedMethodBound(displayIdToShowIme)) {
if (cs.curSession != null) {
// Fast case: if we are already connected to the input method,
// then just return it.
@@ -2495,6 +2494,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
return InputBindResult.IME_NOT_CONNECTED;
}
private boolean isSelectedMethodBound(int displayIdToShowIme) {
String curId = getCurId();
return curId != null && curId.equals(getSelectedMethodId())
&& displayIdToShowIme == mCurTokenDisplayId;
}
@GuardedBy("mMethodMap")
private void prepareClientSwitchLocked(ClientState cs) {
// If the client is changing, we need to switch over to the new