Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Android: expose Node::custom_actions as AccessibilityActions (design question: id mapping)

未关闭
#846 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
android, rust

调研方向

Read the core definitions of Action::CustomAction, CustomAction, and Node::custom_actions(), then inspect the Android adapter’s node-info and perform_action paths. The issue gives a prototype behavior, but implementation depends on resolving the Android ID mapping and whether core docs or other adapters should change. Done means an agreed design and Android actions that appear, dispatch to valid current custom actions, and handle stale IDs safely.

由索引模型根据 Issue 内容生成。

描述

The core crate already defines Action::CustomAction, ActionData::CustomAction(i32), CustomAction { id, description } and Node::custom_actions(), but no platform adapter currently exposes them (iOS only treats supports_action(CustomAction) as an "interactive" hint). The Android adapter could be the first to implement them, so before sending a PR I'd like to agree on how it should behave.

What I'd implement

  • For each node with supports_action(Action::CustomAction), add one AccessibilityNodeInfo.AccessibilityAction per entry in custom_actions(), using description as the label. These appear in TalkBack's Actions menu.
  • In perform_action, map an incoming custom id back to ActionRequest { action: Action::CustomAction, data: Some(ActionData::CustomAction(id)) }.
  • Only accept an id that is in the node's current custom_actions(), so stale cached node info can't trigger an action that was removed. Skip actions with an empty description.

The open question is the id mapping

CustomAction::id is an arbitrary i32 chosen by the application, while Android requires custom action ids to avoid the framework's own android.R.id ids and to be above the legacy range (ids ≤ 0x200000 are treated as legacy bitmask actions). Options I considered:

  1. Fixed offset: base + id, with id restricted to a documented range (my prototype uses 0x3f000000 + [0, 0xFFFFFF]). Stateless, round-trips exactly, and a stale id fails safely because it is checked against the node's current list. Flutter uses a similar offset scheme.
  2. Fixed slot pool (as Jetpack Compose does, 32 slots): a hard cap, and it relies on androidx resource ids that a standalone adapter doesn't have.
  3. Adapter-side table: allocate Android ids from a counter and keep a (node, custom id) map. Supports any i32, but adds state that can go stale with TalkBack's cached node info.
  4. Index in custom_actions(): no restriction on app ids, but the Android id changes whenever the list is reordered, so cached info could target the wrong action.

I lean towards option 1. Is restricting ids to a documented range acceptable, or would you prefer a different approach? If 1 is fine, I'd also document the supported range on CustomAction::id.

Related questions

  • Should the core docs say that adapters may reject ids outside a platform-specific range?
  • Should other adapters (AT-SPI actions, NSAccessibilityCustomAction) follow later, so the semantics stay consistent across platforms?

Context and disclosure

I maintain a fork used by NVGT (a game engine used by blind developers), where this is needed for TalkBack users: per-item actions on list items such as "Move up" or "Remove". I already have a working prototype in the fork, tested on a physical realme RMX5032 running Android 16 (API 36) with Google TalkBack 17.1.0 and with BackTalk: the actions appear in the TalkBack actions menu, run, and per-item actions on list items work.

I use AI tooling (Claude) for this work, including researching Android's behaviour, writing the implementation and unit tests, and reviewing it. I will review, test and take responsibility for anything I submit. I wanted to say that up front, in case the project has a position on AI-assisted contributions. If it does, I'll follow it, and I'm happy to open nothing further if it isn't welcome.

I saw that AccessKit no longer accepts external pull requests (#832), so this is an issue to agree on the design first. If the plan looks reasonable, I'd be glad to send the PR as a member.

主要语言
Rust
星标
1.5k
派生
127
平均合并
16 小时 45 分钟
30 天内合并 PR
12

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AccessKit/accesskit 的其他 Issue

查看 AccessKit/accesskit 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。