Repository navigation
fix: prevent delayed accessibility events from overwriting foreground cache - #571
Closed
DeanTMaxim wants to merge 1366 commits into
Closed
DeanTMaxim wants to merge 1366 commits into
DeanTMaxim wants to merge 1366 commits into
Conversation
… -> ui.(status/navigation)BarIconLight[By]
…Hex/ColorName 等颜色参数
…03#416); 移除 UiObject#hashCode/equals 覆写; 新增 UiObject#isShifted 方法
…er003#414, SuperMonster003#340); 修复错误报告页面复制详细信息功能失效的问题
…yout, Expandable RecyclerView, Recyclerview Flexible Divider
Fix ConcatReader.close() to close all readers on failure
- 新增 LogBottomSheet 底部日志面板 - ConsoleView 支持堆栈帧点击跳转 - EditorView 添加 LogPanelCallback 接口 - EditActivity 集成日志面板与代码跳转 - 添加日志菜单项和图标资源
feat: 添加底部日志面板功能
Prevent delayed window-state events from replacing the foreground package cache unless the active root confirms both the event window and package. Add policy tests for both maintained namespaces.
SuperMonster003
force-pushed
the
master
branch
from
November 3, 2026 07:28
ed3eb10 to
c9e081f
Compare
SuperMonster003
pushed a commit
that referenced
this pull request
Nov 3, 2026
…e foreground cache When getWindow(event.windowId) returned null, `window?.isFocused != false` treated a delayed TYPE_WINDOW_STATE_CHANGED event of a window that had already disappeared as focused, so currentPackage()/currentActivity() could report SystemUI, the launcher or a closed app. A missing window now updates the cached package and activity only when rootInActiveWindow has the same window ID and package; focused windows are accepted and unfocused ones rejected as before. The Activity identity used by flow keeps its own windowKnown handling. Ported from #571 (reported in #570); the com.stardust copy it also patched no longer exists.
SuperMonster003
added a commit
that referenced
this pull request
Nov 3, 2026
…nd the contributor table Add the fix entries of the ported PRs #571 (DeanTMaxim, reported in #570), #558 and #557 (djbclark) to the 6.8.0 notes in all ten languages, and add both contributors to the README contributor table by hand, sorted by the date of their latest pull request (2026/08/21 and 2026/07/14), with the counts of all their pull requests, including #556 and #573 whose fixes were already in place. Regenerate the changelog and README files, record the translation baseline, and set VERSION_BUILD to 4982.
Owner
|
感谢修复! 今天本仓库改写了历史 (清理作者邮箱) 并强制推送, GitHub 因此自动关闭了所有未合并的 PR, 本 PR 已无法在 GitHub 上重新打开或合并. 问题在当前代码中仍然存在, 已按你的策略移植为 b589e7b (提交作者为你), 并带上 org 命名空间的 6 个用例; com.stardust 副本已在 6.8.0 中移除, flow 使用的 Activity 身份逻辑保持其原有的 windowKnown 处理. 6.8.0 发行记录与 README 贡献者列表中均已署名, #570 将在 6.8.0 正式发布后关闭. Thanks for the fix! Today's history rewrite (force push) made GitHub close all open pull requests, so this one can no longer be merged here. The bug is still present, so your policy has been ported as b589e7b with you as the commit author, together with the 6 test cases of the org namespace (the com.stardust copy was removed in 6.8.0). It is credited in the 6.8.0 release notes and the README contributor table; #570 will be closed once 6.8.0 is released. |
SuperMonster003
added a commit
that referenced
this pull request
Nov 3, 2026
The contributor table scraper rebuilt the table from merged pull requests only, so it would have dropped the rows added by hand for the ported pull requests. Pull requests #556, #557, #558, #571 and #573 are now recorded with the author's commit count and latest commit time as they were in each pull request (their GitHub commit lists span the whole old history after the 2026-11-03 rewrite) and are counted like merged ones; authors with such pull requests link to all their pull requests instead of merged ones only. Running the scraper corrects the commit count of djbclark from 3 to 5 (#556 and #558 have two commits each).
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.
Summary / 变更概述
Prevent delayed accessibility window-state events from overwriting the cached foreground package/activity when their original window no longer exists.
避免原窗口已经消失的延迟无障碍窗口状态事件覆盖当前前台包名/Activity 缓存。
Closes #570. Related symptom report: #529.
Root cause / 根因
Both
ActivityInfoProviderimplementations used:If
getWindow(event.windowId)returnsnull, Kotlin evaluatesnull != falseastrue. A delayed event from a disappeared SystemUI/launcher/app window could therefore be accepted as if it were focused and replacemLatestPackage/mLatestActivity.两个
ActivityInfoProvider实现都使用了上述判断。当getWindow(event.windowId)返回null时,Kotlin 中null != false的结果为true,所以来自已消失窗口的延迟事件可能被当作聚焦事件接纳,并覆盖mLatestPackage/mLatestActivity。Fix / 修复方式
Apply the following policy consistently to both maintained namespaces:
rootInActiveWindow.在两个维护中的命名空间内统一应用以下策略:
rootInActiveWindow一致时接纳。Changed namespaces / 修改的命名空间:
org.autojs.autojs.core.activitycom.stardust.autojs.core.activityTests / 测试
Added six policy cases for each namespace (12 tests total):
两个命名空间各增加 6 个策略用例,共 12 个测试,覆盖聚焦、未聚焦、活动根窗口 ID 不匹配、活动根包名不匹配、活动根确认以及缺少包名证据。
TDD evidence / TDD 证据:
eventWindowFocused != falsepolicy, all six missing-window regression cases failed across the two namespaces.tests="6",failures="0",errors="0"(12/12 passed).Full verification command / 完整验证命令:
Result / 结果:
Verification note / 验证说明
Current
masterhas unrelated compilation errors introduced with the bottom log sheet (console_debug/console_verboseresource references and obsoleteAutoJs.getInstance()calls). They are already covered by #556. To run the full unit-test task, equivalent corrections were applied locally only, the full task was rerun, and those corrections were then reverted. This PR does not contain the unrelated bottom-sheet changes.当前
master的底部日志面板存在与本修复无关的编译错误(console_debug/console_verbose资源引用以及过时的AutoJs.getInstance()调用),#556 已处理这些问题。为执行完整单元测试,本地仅临时应用了等效修正;测试完成后已恢复。本 PR 不包含这些无关的底部日志面板改动。The original symptom and event/window mismatch were also reproduced on an OPPO Android test device using ADB and accessibility-window inspection. Device identifiers, accounts, and application data are omitted.
原始现象及事件/窗口不匹配也已在一台 OPPO Android 测试机上通过 ADB 和无障碍窗口检查复现;设备标识、账号和应用数据均已省略。