Skip to content

refactor: remove attach/detach thread management#1240

Merged
MistEO merged 1 commit intomainfrom
refactor/remove-thread-attach
Apr 2, 2026
Merged

refactor: remove attach/detach thread management#1240
MistEO merged 1 commit intomainfrom
refactor/remove-thread-attach

Conversation

@Aliothmoon
Copy link
Copy Markdown
Member

@Aliothmoon Aliothmoon commented Apr 1, 2026

Summary by Sourcery

从控制单元 API 及其使用位置中移除 Android 特定的线程 attach/detach 处理逻辑。

Enhancements:

  • 通过移除 attach_thread/detach_thread API 以及相关的 ScopedThreadAttach 工具,简化 Android 原生控制单元接口。
  • 通过删除未使用的 AttachThread/DetachThread 函数指针和符号加载,清理动态 Android 外部库绑定。
  • 通过不再在每次调用中执行线程 attach/detach 管理,简化 ControllerAgentAndroidNativeControlUnitMgr 的执行路径。
Original summary in English

Summary by Sourcery

Remove Android-specific thread attach/detach handling from the control unit APIs and their usage sites.

Enhancements:

  • Simplify Android native control unit interfaces by dropping attach_thread/detach_thread APIs and related ScopedThreadAttach utilities.
  • Clean up dynamic Android external library bindings by removing unused AttachThread/DetachThread function pointers and symbol loading.
  • Streamline ControllerAgent and AndroidNativeControlUnitMgr execution paths by no longer performing per-call thread attach/detach management.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些整体性的反馈:

  • 既然已经移除了 Android 线程 attach/detach 的职责,建议在调用 AndroidNativeControlUnitMgr::screencapdispatch_input_message 的地方,通过注释或运行时断言把新的线程假设显式表达出来,这样可以清楚地表明它们必须在已附加线程中被调用。
  • 由于 AttachThread/DetachThread 不再从外部库中加载,可能值得检查一下是否还存在对这些符号的剩余引用(例如在原生库或构建配置中),以便清理掉它们,避免关于未使用入口点的困惑。
给 AI 代理的提示
Please address the comments from this code review:

## Overall Comments
- 既然已经移除了 Android 线程 attach/detach 的职责,建议在调用 `AndroidNativeControlUnitMgr::screencap``dispatch_input_message` 的地方,通过注释或运行时断言把新的线程假设显式表达出来,这样可以清楚地表明它们必须在已附加线程中被调用。
- 由于 `AttachThread`/`DetachThread` 不再从外部库中加载,可能值得检查一下是否还存在对这些符号的剩余引用(例如在原生库或构建配置中),以便清理掉它们,避免关于未使用入口点的困惑。

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • Now that the Android thread attach/detach responsibilities are removed, consider making the new threading assumption explicit (e.g., via a comment or runtime assertion) at the call sites to AndroidNativeControlUnitMgr::screencap and dispatch_input_message so it’s clear they must be invoked from an already-attached thread.
  • Since AttachThread/DetachThread are no longer loaded from the external library, it may be worth checking whether any remaining references to those symbols (e.g., in native libraries or build configs) can be cleaned up to avoid confusion about unused entry points.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that the Android thread attach/detach responsibilities are removed, consider making the new threading assumption explicit (e.g., via a comment or runtime assertion) at the call sites to `AndroidNativeControlUnitMgr::screencap` and `dispatch_input_message` so it’s clear they must be invoked from an already-attached thread.
- Since `AttachThread`/`DetachThread` are no longer loaded from the external library, it may be worth checking whether any remaining references to those symbols (e.g., in native libraries or build configs) can be cleaned up to avoid confusion about unused entry points.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@MistEO
Copy link
Copy Markdown
Member

MistEO commented Apr 1, 2026

干嘛用的,不要这玩意了?

@Aliothmoon
Copy link
Copy Markdown
Member Author

干嘛用的,不要这玩意了?

对,我内化到Android实现上了,保证fw这边纯净一点

@MistEO MistEO merged commit 8e669eb into main Apr 2, 2026
19 checks passed
@MistEO MistEO deleted the refactor/remove-thread-attach branch April 2, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants