diff options
| author | 2019-01-29 02:08:13 +0000 | |
|---|---|---|
| committer | 2019-01-29 02:08:13 +0000 | |
| commit | b138cbf30b1460cd6c6c7daa2d31b509dfa14ddb (patch) | |
| tree | 57fd3ac6e1061f0e1242e3ae690541fb7e9b86fd | |
| parent | d10781bfa8c0bce13d95210914b45760609c6b79 (diff) | |
| parent | 6746452ebaceac45ce3b8aa49bb616adb81541d7 (diff) | |
Merge "Simplify IMMS#startInputOrWindowGainedFocusInternal() part 5/5"
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 74b5b3b3007e..d20508a5e704 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -2801,26 +2801,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @SoftInputModeFlags int softInputMode, int windowFlags, EditorInfo attribute, IInputContext inputContext, @MissingMethodFlags int missingMethods, int unverifiedTargetSdkVersion, @UserIdInt int userId) { - InputBindResult res = null; - final int windowDisplayId = - mWindowManagerInternal.getDisplayIdForWindow(windowToken); - if (DEBUG) Slog.v(TAG, "startInputOrWindowGainedFocusInternalLocked: reason=" - + InputMethodDebug.startInputReasonToString(startInputReason) - + " client=" + client.asBinder() - + " inputContext=" + inputContext - + " missingMethods=" - + InputConnectionInspector.getMissingMethodFlagsAsString(missingMethods) - + " attribute=" + attribute - + " startInputFlags=" - + InputMethodDebug.startInputFlagsToString(startInputFlags) - + " softInputMode=" + InputMethodDebug.softInputModeToString(softInputMode) - + " windowFlags=#" + Integer.toHexString(windowFlags) - + " unverifiedTargetSdkVersion=" + unverifiedTargetSdkVersion); - - ClientState cs = mClients.get(client.asBinder()); + if (DEBUG) { + Slog.v(TAG, "startInputOrWindowGainedFocusInternalLocked: reason=" + + InputMethodDebug.startInputReasonToString(startInputReason) + + " client=" + client.asBinder() + + " inputContext=" + inputContext + + " missingMethods=" + + InputConnectionInspector.getMissingMethodFlagsAsString(missingMethods) + + " attribute=" + attribute + + " startInputFlags=" + + InputMethodDebug.startInputFlagsToString(startInputFlags) + + " softInputMode=" + InputMethodDebug.softInputModeToString(softInputMode) + + " windowFlags=#" + Integer.toHexString(windowFlags) + + " unverifiedTargetSdkVersion=" + unverifiedTargetSdkVersion); + } + + final int windowDisplayId = mWindowManagerInternal.getDisplayIdForWindow(windowToken); + + final ClientState cs = mClients.get(client.asBinder()); if (cs == null) { - throw new IllegalArgumentException("unknown client " - + client.asBinder()); + throw new IllegalArgumentException("unknown client " + client.asBinder()); } if (cs.selfReportedDisplayId != windowDisplayId) { Slog.e(TAG, "startInputOrWindowGainedFocusInternal: display ID mismatch." @@ -2859,8 +2859,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // Master feature flag that overrides other conditions and forces IME preRendering. if (DEBUG) { Slog.v(TAG, "IME PreRendering MASTER flag: " - + DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.value() - + ", LowRam: " + mIsLowRam); + + DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.value() + ", LowRam: " + mIsLowRam); } // pre-rendering not supported on low-ram devices. cs.shouldPreRenderIme = DebugFlags.FLAG_PRE_RENDER_IME_VIEWS.value() && !mIsLowRam; @@ -2894,8 +2893,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub == LayoutParams.SOFT_INPUT_ADJUST_RESIZE || mRes.getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE); - final boolean isTextEditor = - (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0; + final boolean isTextEditor = (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0; // We want to start input before showing the IME, but after closing // it. We want to do this after closing it to help the IME disappear @@ -2903,6 +2901,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // new focused input, even if its window wants to hide the IME). boolean didStart = false; + InputBindResult res = null; switch (softInputMode & LayoutParams.SOFT_INPUT_MASK_STATE) { case LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: if (!isTextEditor || !doAutoShow) { @@ -2959,9 +2958,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (InputMethodUtils.isSoftInputModeStateVisibleAllowed( unverifiedTargetSdkVersion, startInputFlags)) { if (attribute != null) { - res = startInputUncheckedLocked(cs, inputContext, - missingMethods, attribute, startInputFlags, - startInputReason); + res = startInputUncheckedLocked(cs, inputContext, missingMethods, + attribute, startInputFlags, startInputReason); didStart = true; } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); @@ -2994,8 +2992,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (attribute != null) { if (!DebugFlags.FLAG_OPTIMIZE_START_INPUT.value() || (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0) { - res = startInputUncheckedLocked(cs, inputContext, missingMethods, - attribute, + res = startInputUncheckedLocked(cs, inputContext, missingMethods, attribute, startInputFlags, startInputReason); } else { res = InputBindResult.NO_EDITOR; |