utInputChannel != null && (attrs.inputFeatures
& WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL) == 0) {
String name = win.makeInputChannelName();
InputChannel[] inputChannels = InputChannel.openInputChannelPair(name);
win.setInputChannel(inputChannels[0]);
inputChannels[1].transferTo(outInputChannel);
mInputManager.registerInputChannel(win.mInputChannel, win.mInputWindowHandle);
}
}
在windowState.java中调用attach:
void attach() {
mSession.windowAddedLocked();
}
最后在Session.java中实现添加:
void windowAddedLocked() {
if (mSurfaceSession == null) {
mSurfaceSession = new SurfaceSession();
mService.mSessions.add(this);
}
mNumWindow++;
}
至此,正式建立activity的client和windowManagerService之间的联系:
ViewRootImpl 通过IWindowSession 访问 WindowManagerService
WindowManagerService通过IWindow访问ViewRootImpl