进入InputMethodManager类的doStartInput方法
void doStartInput(InputConnection ic, EditorInfo attribute, boolean restarting) {
if (!restarting) {
doFinishInput();
}
mInputStarted = true;
mStartedInputConnection = ic;
mInputEditorInfo = attribute;
initialize();
if (DEBUG) Log.v(TAG,"InputMethodService class" + "CALL: onStartInput , mWindowVisible=" + mWindowVisible);
onStartInput(attribute, restarting);
if (mWindowVisible) {
if (mShowInputRequested) {
if (DEBUG) Log.v(TAG,"InputMethodService class" + "CALL: onStartInputView");
mInputViewStarted = true;
onStartInputView(mInputEditorInfo, restarting);
startExtractingText(true);
} else if (mCandidatesVisibility == View.VISIBLE) {
if (DEBUG) Log.v(TAG,"InputMethodService class" + "CALL: onStartCandidatesView");
mCandidatesViewStarted = true;
onStartCandidatesView(mInputEditorInfo, restarting);
}
}
}
找到两处赋值的地方,如下:
void showWindowInner(boolean showInput) {
boolean doShowInput = false;
boolean wasVisible = mWindowVisible;
mWindowVisible = true;
public void hideWindow() {
finishViews();
mImm.setImeWindowStatus(mToken, 0, mBackDisposition);
if (mWindowVisible) {
mWindow.hide();
mWindowVisible = false;
onWindowHidden();
mWindowWasVisible = false;
}
}
public void showWindow(boolean showInput) {
if (DEBUG) Log.v(TAG,"InputMethodService class" + "Showing window: showInput=" + showInput
+ " mShowInputRequested=" + mShowInputRequested
+ " mWindowAdded=" + mWindowAdded
+ " mWindowCreated=" + mWindowCreated
+ " mWindowVisible=" + mWindowVisible
+ " mInputStarted=" + mInputStarted);
if (mInShowWindow) {
Log.w(TAG,"InputMethodService class" + "Re-entrance in to showWindow");
return;
}
try {
mWindowWasVisible = mWindowVisible;
mInShowWindow = true;
showWindowInner(showInput);
} finally {
mWindowWasVisible = true;
mInShowWindow = false;
}
}
public void showSoftInput(int flags, ResultReceiver resultReceiver) {
if (DEBUG) Log.v(TAG,"InputMethodService class" + "showSoftInput()");
boolean wasVis = isInputViewShown();
mShowInputFlags = 0;
if (onShowInputRequested(flags, false)) {
if (DEBUG) Log.v(TAG,"InputMethodService class" + "showWindow(true)");
showWindow(true);
}
01-01 09:22:22.520 V/PateoInputMethod( 1486): InputMethodService classshowSoftInput()
01-01 09:22:22.520 V/PateoInputMethod( 1486): InputMethodService classshowWindow(true)
可以看出是在show的时候进入该方法的,那就对了,好吧,有关怎么show的流程,可以看我写的另一个帖子: