Extract part of the client switch logic

Bug: 205676419
Test: make
Change-Id: If387b0f0d007ca468f3a038693ca2014d8e671d6
This commit is contained in:
Nikolas Havrikov
2021-11-05 14:08:14 +01:00
parent 8bdeee1ad4
commit 0170114696

View File

@@ -2447,14 +2447,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mImeHiddenByDisplayPolicy = false;
if (mCurClient != cs) {
// If the client is changing, we need to switch over to the new
// one.
unbindCurrentClientLocked(UnbindReason.SWITCH_CLIENT);
// If the screen is on, inform the new client it is active
if (mIsInteractive) {
scheduleSetActiveToClient(cs, true /* active */, false /* fullscreen */,
false /* reportToImeController */);
}
prepareClientSwitchLocked(cs);
}
// Bump up the sequence for this client and attach it.
@@ -2523,6 +2516,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
return InputBindResult.IME_NOT_CONNECTED;
}
@GuardedBy("mMethodMap")
private void prepareClientSwitchLocked(ClientState cs) {
// If the client is changing, we need to switch over to the new
// one.
unbindCurrentClientLocked(UnbindReason.SWITCH_CLIENT);
// If the screen is on, inform the new client it is active
if (mIsInteractive) {
scheduleSetActiveToClient(cs, true /* active */, false /* fullscreen */,
false /* reportToImeController */);
}
}
@NonNull
private Intent createImeBindingIntent(ComponentName component) {
Intent intent = new Intent(InputMethod.SERVICE_INTERFACE);