//设置DisplayViewport
performTraversalLocked
clearViewportsLocked();
mViewports.clear();
configureDisplayLocked(t, device);
populateViewportLocked(viewportType.get(), display.getDisplayIdLocked(), device, info);
final DisplayViewport viewport = getViewportLocked(viewportType, info.uniqueId);
viewport = new DisplayViewport();
mViewports.add(viewport);
viewport.displayId = displayId; //设置viewport.displayId
mHandler.sendEmptyMessage(MSG_UPDATE_VIEWPORT);
@frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
DisplayManagerHandler::handleMessage
@frameworks/base/services/core/java/com/android/server/input/InputManagerService.java
case MSG_UPDATE_VIEWPORT: { mInputManagerInternal.setDisplayViewports(mTempViewports);
setDisplayViewportsInternal(viewports);
final DisplayViewport[] vArray = new DisplayViewport[viewports.size()];
@frameworks/base/services/core/jni/com_android_server_input_InputManagerService.cpp
nativeSetDisplayViewports(mPtr, vArray);
im->setDisplayViewports(env, viewportObjArray); //NativeInputManager::setDisplayViewports
for (jsize i = 0; i < length; i++) {
jobject viewportObj = env->GetObjectArrayElement(viewportObjArray, i);
android_hardware_display_DisplayViewport_toNative(env, viewportObj, &viewport);
viewports.push_back(viewport);
@frameworks/base/services/core/java/com/android/server/wm/InputManagerCallback.java
int32_t pointerDisplayId = getPointerDisplayId();
if (!mService.mForceDesktopModeOnExternalDisplays) { return DEFAULT_DISPLAY; }
mLocked.viewports = viewports;
mLocked.pointerDisplayId = pointerDisplayId;
mInputManager->getReader()->requestRefreshConfiguration(InputReaderConfiguration::CHANGE_DISPLAY_INFO);
mConfigurationChangesToRefresh |= changes;
mEventHub->wake(); //唤醒InputReader线程
标签:java,server,设置,DisplayViewport,viewports,Android,android,viewport
From: https://blog.csdn.net/wenwang88/article/details/141128361