Merge "Measure and optimize IMF latency 6/n"

This commit is contained in:
TreeHugger Robot
2020-12-03 16:38:38 +00:00
committed by Android (Google) Code Review

View File

@@ -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;