Simplify MSG_SET_ACTIVE handler

This is mechanical refactoring.  There must be no behavior change.

Bug: 234882948
Test: presubmit
Change-Id: I410fc54cd941eda13f25acd1aedf8778956091f3
This commit is contained in:
Yohei Yukawa
2022-10-17 12:11:58 -07:00
parent d838e9f25d
commit a9625d3bee

View File

@@ -1116,14 +1116,19 @@ public final class InputMethodManager {
// Check focus again in case that "onWindowFocus" is called before
// handling this message.
final View servedView = getServedViewLocked();
if (servedView != null && canStartInput(servedView)) {
if (mCurRootView != null && mCurRootView.getImeFocusController()
.checkFocus(mRestartOnNextWindowFocus, false)) {
final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS
: StartInputReason.DEACTIVATED_BY_IMMS;
startInputOnWindowFocusGainInternal(reason, null, 0, 0, 0);
}
if (servedView == null || !canStartInput(servedView)) {
return;
}
if (mCurRootView == null) {
return;
}
if (!mCurRootView.getImeFocusController().checkFocus(
mRestartOnNextWindowFocus, false)) {
return;
}
final int reason = active ? StartInputReason.ACTIVATED_BY_IMMS
: StartInputReason.DEACTIVATED_BY_IMMS;
startInputOnWindowFocusGainInternal(reason, null, 0, 0, 0);
}
return;
}