2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
입력 라우팅
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android 9 이하에서는 터치를 통해 여러 디스플레이와 상호작용할 수 있는 방법이 없었습니다. 이는 디스플레이 및 입력 기기 간의 연결 메커니즘이 없었기 때문입니다. 예를 들어 터치스크린 디스플레이는 HDMI 동영상 입력(Android의 디스플레이로 등록됨)과 터치스크린용 USB 출력(입력 기기로 등록됨)을 제공할 수 있었습니다. 여러 기기가 이러한 방식으로 연결되면 어떤 입력 기기가 어떤 디스플레이에 속하는지 파악할 방법이 없게 됩니다. 여러 기본 디스플레이를 포함하는 폴더블 기기에도 같은 문제가 적용됩니다.
Android 10에는 어떤 입력 기기가 어떤 디스플레이에 속하는지 지정하기 위한 메커니즘이 추가되었습니다. 연결은 포트 수에 의해 이루어집니다. 여기서 포트는 디스플레이가 연결되는 실제 포트를 의미합니다.
예를 들어 Android 기기에 hdmi1
및 hdmi2
라고 표시된 2개의 HDMI 포트가 있는 경우에는 디스플레이 포트 값이 1
및 2
일 수 있습니다. 다른 디스플레이가 동일한 실제 HDMI 포트에 연결된 경우에도(예: 다른 디스플레이 모델 또는 제조업체) 포트 값은 동일하게 유지됩니다. 이렇게 하면 기기 제조업체에서 디스플레이 조립 및 업그레이드를 위한 지침을 제공할 수 있습니다.
연결은 /vendor/etc/input-port-associations.xml
에서 구성됩니다.
예:
<ports>
<port display="0" input="usb-xhci-hcd.0.auto-1.1/input0" />
<port display="1" input="usb-xhci-hcd.0.auto-1.2/input0" />
</ports>
위의 예에서는 display="0"
이 디스플레이가 연결되는 포트를 지정합니다. input="usb-xhci-hcd.0.auto-1.1/input0"
은 입력 기기가 연결되는 포트를 지정합니다. 특정 기기에 연결된 포트를 파악하려면 다음과 같은 터미널 명령어를 사용한 다음 이벤트 허브 상태에서 이러한 기기의 location
속성을 검토합니다.
adb shell dumpsys input
다수의 기기가 연결된 경우에는 구체적인 기기를 탭하여 입력 디스패처 상태의 RecentQueue
배열을 검토합니다. 그런 다음에는 가장 최근의 이벤트를 생성한 기기를 식별할 수 있습니다. 그런 다음에는 이벤트 허브 상태에서 해당하는 기기를 찾을 수 있습니다.
연결된 디스플레이에 할당된 디스플레이 포트를 파악하려면 adb shell dumpsys display
를 사용한 다음 디스플레이 기기의 각 디스플레이와 관련된 DisplayDeviceInfo
의 address
속성을 찾습니다.
아니면 adb shell dumpsys SurfaceFlinger --display-id
를 사용하여 모든 연결된 디스플레이의 식별 정보를 덤프합니다. 정적 디스플레이 식별자도 참조하세요.
해당하는 디스플레이가 시스템에 존재하지 않는 상태에서 구체적인 입력 기기의 연결을 지정하면 각 디스플레이가 표시될 때까지 입력 기기가 사용 중지됩니다. 연결은 터치 기기에 대해서만 수행됩니다.
동적 다중 디스플레이 라우팅
Android 10에서는 정적 다중 디스플레이 기기를 설정할 수 있습니다. 동적 연결은 아직 지원되지 않습니다. 하지만 일부 사용 사례는 경우에 따라 존재하지 않는 디스플레이 및 입력 패널의 라우팅 정보를 제공하거나 가상 입력 기기를 사용한 다음 이러한 가상 기기에 추가적인 라우팅 정보를 제공하는 방식으로 해결할 수 있습니다. 기기 구현이 다음을 지원하는 경우:
- 데스크톱과 유사한 환경과 도킹 스테이션을 지원하는 경우에는 라우팅 config를 제공하여 도크에 연결된 입력 액세서리(포트에 의해 고유하게 식별됨)의 입력을 외부 디스플레이(포트에 의해 식별됨)에 타겟팅할 수 있습니다.
- 외부 디스플레이에 연결되면 터치패드와 같은 입력 소스로 기능하는 기본 화면을 지원하는 경우에는 라우팅 config를 제공하여 가상 터치 패널(고유한 가상 ID에 의해 식별됨)의 입력을 외부 디스플레이(포트에 의해 식별됨)에 타겟팅할 수 있습니다.
구현
- 실제 장치의 경우 터치스크린을 포함하는 디스플레이와 일치하도록 입력 기기가 연결되는 포트와 디스플레이가 연결되는 포트가 사용됩니다.
- 매핑은
InputReaderConfiguration
에 저장됩니다.
TouchInputMapper.mViewport
는 InputDevice.location
에 대해 지정된 포트와 일치하는 표시 영역으로 설정됩니다.
- 매핑 파일에 입력 기기 포트가 지정되었고 현재 일치하는 디스플레이 포트가 있는 표시 영역이 없는 경우에는 해당 포트의 입력 기기가 사용 중지됩니다.
- 특정 입력 기기에 포트가 지정되지 않은 경우에는 기존 규칙에 따라 표시 영역이 설정됩니다.
- 입력 드라이버에서는 커널을 변경할 필요가 없습니다.
- 입력 기기 포트는 EVIOCGPHYS ioctl을 사용하여 결정됩니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Input routing\n\nIn Android 9 and lower, there was no way to interact with multiple displays\nvia touch, because there was no association mechanism between displays and input\ndevices. For example, a touchscreen display could provide an HDMI video output\n(that would register as a display on Android) and a USB output for touchscreen\n(that would register as an input device). If multiple devices were connected in\nthis manner, there would be no way to determine which input device belongs to\nwhich display. The same issue applies to foldable devices with multiple built-in\ndisplays.\n\nAndroid 10 added a mechanism to specify which input\ndevices belong to which displays. The association is done by port numbers where\n*port* refers to the physical port to which a display is connected.\n\nFor example, if an Android device has two HDMI ports labeled `hdmi1`\nand `hdmi2`, then the display port values could be `1` and\n`2`. The port values remain the same even when a different display is\nconnected (such as a different display model or manufacturer) to the same physical\nHDMI port. This enables device manufacturers to provide instructions to assemble\nand upgrade displays.\n\nThe association is configured in `/vendor/etc/input-port-associations.xml`.\nFor example: \n\n \u003cports\u003e\n \u003cport display=\"0\" input=\"usb-xhci-hcd.0.auto-1.1/input0\" /\u003e\n \u003cport display=\"1\" input=\"usb-xhci-hcd.0.auto-1.2/input0\" /\u003e\n \u003c/ports\u003e\n\nIn the example above, `display=\"0\"` specifies the port to which the\ndisplay is connected. `input=\"usb-xhci-hcd.0.auto-1.1/input0\"`\nspecifies the port to which the input device is connected. To determine the ports\nassociated with specific devices, use the following terminal command, and then\nreview the`location` property of those devices in the Event Hub State. \n\n```\nadb shell dumpsys input\n```\n\nIf many devices are connected, tap a specific device to examine the\n`RecentQueue` array in the Input Dispatcher State. You can then identify\nthose devices that generated the most recent event. You can then find the\ncorresponding device in the Event Hub State.\n\nTo determine the display ports assigned to the connected displays, use\n`adb shell dumpsys display` and then look for the `address`\nproperty of `DisplayDeviceInfo` for each display under Display Devices.\nAlternatively, use `adb shell dumpsys SurfaceFlinger --display-id` to dump\nidentification information for all connected displays. See also\n[Static display identifiers](/docs/core/display/multi_display/displays#static).\n\nIf you specify an association for a specific input device and the corresponding\ndisplay isn't present in the system, the input device is disabled until the respective\ndisplay appears. The association is performed only for touch devices.\n\nRouting for dynamic multi-displays\n----------------------------------\n\nAndroid 10 enables you to set up static multi-display\ndevices. Dynamic associations are not yet enabled. However, some use cases can be\naddressed by providing routing information for displays and input panels that aren't\nalways present or using virtual input devices and then providing additional routing\ninformation to those virtual devices. If a device implementation supports a:\n\n- Desktop-like experience with a docking station, then a routing config could be provided to target input from input accessory connected to the dock (identified uniquely by port) to the external display (identified by port).\n- Primary screen acting as an input source (such as a touchpad) when connected to the external display, then a routing config could be provided to target input from virtual touch panel (identified by unique virtual ID) to the external display (identified by port).\n\n### Implementation\n\n- For physical devices, the port to which the input device is connected and the port to which the display is connected, are used to match the displays with touchscreens.\n- The mappings are stored in `InputReaderConfiguration`.\n- `TouchInputMapper.mViewport` is set to the viewport that matches the port specified for `InputDevice.location`.\n- If an input device port is specified in the mapping file, and there currently isn't a viewport that has a matching display port, then the input device on that port is disabled.\n- If a port isn't specified for a particular input device, then viewport is set according to the existing rules.\n- No kernel changes are required in the input drivers.\n- The input device ports are determined using the EVIOCGPHYS ioctl."]]