@frameworks/native/services/inputflinger/reader/InputReader.cpp
InputReader::loopOnce
refreshConfigurationLocked(changes);
@frameworks/base/services/core/jni/com_android_server_input_InputManagerService.cpp
mPolicy->getReaderConfiguration(&mConfig);
@frameworks/native/services/inputflinger/InputReaderBase.cpp
outConfig->setDisplayViewports(mLocked.viewports);
mDisplays = viewports; //将viewports赋给mDisplays
outConfig->defaultPointerDisplayId = mLocked.pointerDisplayId; //设置defaultPointerDisplayId
@frameworks/native/services/inputflinger/reader/InputReader.cpp
if (changes & InputReaderConfiguration::CHANGE_DISPLAY_INFO) { updatePointerDisplayLocked(); }
std::optional<DisplayViewport> viewport = mConfig.getDisplayViewportById(mConfig.defaultPointerDisplayId); //根据defaultPointerDisplayId获取对应的viewport
for (const DisplayViewport& currentViewport : mDisplays) { //从mDisplays里面获取Viewport
if (currentViewport.displayId == displayId) { return std::make_optional(currentViewport); }
@frameworks/base/libs/input/PointerController.cpp
mCursorController.setDisplayViewport(viewport, getAdditionalMouseResources);
@frameworks/base/libs/input/MouseCursorController.cpp
controller->setDisplayViewport(*viewport); //MouseCursorController::setDisplayViewport
mLocked.viewport = viewport; //设置当前使用的viewport
updatePointerLocked();
@frameworks/base/libs/input/SpriteController.cpp
mLocked.pointerSprite->setPosition(mLocked.pointerX, mLocked.pointerY);
invalidateLocked(DIRTY_POSITION);
mLocked.pointerSprite->setDisplayId(mLocked.viewport.displayId);
if (mLocked.state.displayId != displayId) { mLocked.state.displayId = displayId; invalidateLocked(DIRTY_DISPLAY_ID); } //不相等则更新displayId,设置成viewport.displayId
标签:鼠标,frameworks,cpp,displayId,input,Android,mLocked,屏幕,viewport
From: https://blog.csdn.net/wenwang88/article/details/141128381