Open
Conversation
根因:外接显示器连接时 surfaceView 被设为 GONE, AndroidNativePointerCaptureProvider 对隐藏 View 调用 requestPointerCapture() 失败,导致物理鼠标无法被捕获。 修复:getInputCaptureProviderForExternalDisplay() 在 Evdev 不可用时,使用仍然可见的 backgroundTouchView 作为指针捕获 目标,而非被隐藏的 surfaceView。 - 仅影响外接显示器回退路径,getInputCaptureProvider() 未改动 - Evdev 和 SHIELD 路径不受影响 - 指针捕获成功后,SOURCE_MOUSE_RELATIVE 相对轴走原有流程 Ref: #228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
关联 #228
外接显示器连接时,USB/蓝牙物理鼠标在非「本地指针」模式下无法移动光标。本地指针模式正常(用户 @To0nyZ 确认)。
根因
ExternalDisplayManager将surfaceView设为View.GONE,视频画面改在外接屏的Presentation上显示。InputCaptureManager.getInputCaptureProviderForExternalDisplay()在 Evdev 不可用时回退到getInputCaptureProvider(),该方法创建AndroidNativePointerCaptureProvider仍然绑定到被隐藏的surfaceView。Android 对
GONE的 View 调用requestPointerCapture()不会生效,物理鼠标事件因此无法获取SOURCE_MOUSE_RELATIVE相对轴数据。修复
在
getInputCaptureProviderForExternalDisplay()的非 Evdev 回退路径中,使用仍然可见的backgroundTouchView作为指针捕获目标:backgroundTouchView在主屏仍然 VISIBLE,requestPointerCapture()可以成功SOURCE_MOUSE_RELATIVE事件通过 ActivityonGenericMotionEvent→ 相对轴流程正常处理getInputCaptureProvider()完全未改动,不影响普通模式