diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-12-03 16:38:38 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-12-03 16:38:38 +0000 |
| commit | 9203d45c5b66d163c8120a07c0f222e6e3bc48d0 (patch) | |
| tree | 67f496fb738e54489112a4a797560fb0110fcc01 /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | 6f3ed806b6f8a29be0add6fd6db49386849ac8eb (diff) | |
| parent | a2b45708ef298bf908341d6b287fc591781a05e7 (diff) | |
Merge "Measure and optimize IMF latency 6/n"
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 5576857d1f6b..6831eca32f72 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -630,6 +630,9 @@ public class InputMethodService extends AbstractInputMethodService { @MainThread @Override public void updateInputMethodDisplay(int displayId) { + if (getDisplayId() == displayId) { + return; + } // Update display for adding IME window to the right display. // TODO(b/111364446) Need to address context lifecycle issue if need to re-create // for update resources & configuration correctly when show soft input @@ -804,12 +807,12 @@ public class InputMethodService extends AbstractInputMethodService { null /* icProto */); final boolean wasVisible = isInputViewShown(); if (dispatchOnShowInputRequested(flags, false)) { - showWindow(true); applyVisibilityInInsetsConsumerIfNecessary(true /* setVisible */); + } else { + // If user uses hard keyboard, IME button should always be shown. + setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition); } - // If user uses hard keyboard, IME button should always be shown. - setImeWindowStatus(mapToImeWindowStatus(), mBackDisposition); final boolean isVisible = isInputViewShown(); final boolean visibilityChanged = isVisible != wasVisible; if (resultReceiver != null) { @@ -1273,6 +1276,9 @@ public class InputMethodService extends AbstractInputMethodService { super.onCreate(); mImm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); mSettingsObserver = SettingsObserver.createAndRegister(this); + // cache preference so we don't have to read ContentProvider when IME is requested to be + // shown the first time (cold start). + mSettingsObserver.shouldShowImeWithHardKeyboard(); mIsAutomotive = isAutomotive(); mAutomotiveHideNavBarForKeyboard = getApplicationContext().getResources().getBoolean( @@ -1341,13 +1347,7 @@ public class InputMethodService extends AbstractInputMethodService { mRootView = mInflater.inflate( com.android.internal.R.layout.input_method, null); mWindow.setContentView(mRootView); - mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer); mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer); - if (Settings.Global.getInt(getContentResolver(), - Settings.Global.FANCY_IME_ANIMATIONS, 0) != 0) { - mWindow.getWindow().setWindowAnimations( - com.android.internal.R.style.Animation_InputMethodFancy); - } mFullscreenArea = mRootView.findViewById(com.android.internal.R.id.fullscreenArea); mExtractViewHidden = false; mExtractFrame = mRootView.findViewById(android.R.id.extractArea); @@ -1413,6 +1413,7 @@ public class InputMethodService extends AbstractInputMethodService { int showFlags = mShowInputFlags; boolean showingInput = mShowInputRequested; CompletionInfo[] completions = mCurCompletions; + mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(mInsetsComputer); initViews(); mInputViewStarted = false; mCandidatesViewStarted = false; |
