Skip to content

升级构建链与依赖、精简权限、适配边到边,满足当前 Play 上架要求 - #111

Merged
zfdang merged 3 commits into
masterfrom
chore/play-compliance
Sep 22, 2026
Merged

zfdang merged 3 commits into
masterfrom
chore/play-compliance

Conversation

@zfdang

@zfdang zfdang commented Sep 22, 2026

Copy link
Copy Markdown
Owner

背景

Play Console 对当前上架版本(234,2022 年)给出"androidx.activity SDK 版本已过时"警告;同时 Google Play 目标 API 要求自 2026-08-31 起为 API 36。本 PR 把 master 整体拉到当前 Play 基线。

改动

构建链与依赖

  • AGP 8.2.2 → 8.9.3,Gradle 8.4 → 8.11.1,compileSdk / targetSdk 35 → 36。
  • AndroidX 升到当前稳定版:appcompat 1.7.0、activity 1.9.3(原解析为 1.1.0)、fragment 1.8.5、material 1.12.0、constraintlayout 2.2.0、navigation 2.8.5、preference 1.2.1;已停更的 lifecycle-extensions 换为 lifecycle-viewmodel / lifecycle-livedata 2.8.7;gson 2.11.0;测试库同步升级。
  • 关闭 Jetifier(全部依赖已是 AndroidX / 纯 Java)。

Manifest 与政策合规

  • 删除未使用的 READ/WRITE_EXTERNAL_STORAGE、SYSTEM_ALERT_WINDOW、REQUEST_IGNORE_BATTERY_OPTIMIZATIONS、QUERY_ALL_PACKAGES:悬浮窗是无障碍服务的 TYPE_ACCESSIBILITY_OVERLAY,电池页用 ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS 打开,均不需要权限;启动器应用 / 桌面 / 输入法的包可见性改由 <queries> 提供。QUERY_ALL_PACKAGES 在 Play 需要单独申报且本应用难以通过,去掉后 release 包不再声明任何用户可见权限。
  • 无障碍服务配置声明 isAccessibilityTool="false"。
  • 前往系统无障碍设置前弹出显著披露对话框(读取什么、如何处理、不离开本机),满足 Play 无障碍 API / 用户数据政策。
  • 移除对第三方应用无效的 android:persistent。

UI(边到边)

  • targetSdk 35+ 强制边到边后,原窗口 ActionBar 压在内容上、内容顶到状态栏下面。改为 NoActionBar 主题 + 布局内 Toolbar(setSupportActionBar),根布局 fitsSystemWindows,浅色系统栏与白色标题栏 / 底部导航统一。
  • ViewModelProviders → ViewModelProvider,versionCode → PackageInfoCompat.getLongVersionCode,清理无用 import。

验证

  • 64 个单元测试全部通过;release 包无 native 库(不涉及 16 KB 页对齐要求),签名密钥不变。
  • 真机(OPPO PHY110 / Android 16):三个页面布局正常、披露对话框正常、无障碍服务正常绑定、开屏广告跳过正常,无崩溃。

上架前还需在 Play Console 完成的(代码之外)

  • 无障碍 API 使用申报表(本 PR 的披露对话框和 isAccessibilityTool=false 是其前提)。
  • 数据安全表单:不收集、不共享任何数据。
  • 用新构建(versionCode 271+)替换 2022 年的 234。

🤖 Generated with Claude Code

Play flagged the published build (234) for an outdated androidx.activity
and the target API deadline (API 36 from 31 Aug 2026) is in force. This
brings the project to the current baseline:

Build
- AGP 8.9.3, Gradle 8.11.1, compileSdk/targetSdk 36
- AndroidX to current stable: appcompat 1.7.0, activity 1.9.3, fragment
  1.8.5, material 1.12.0, constraintlayout 2.2.0, navigation 2.8.5,
  preference 1.2.1, lifecycle-viewmodel/livedata 2.8.7 (replacing the
  discontinued lifecycle-extensions), gson 2.11.0, test libs
- Jetifier off: every dependency is AndroidX or plain Java

Manifest / policy
- drop READ/WRITE_EXTERNAL_STORAGE, SYSTEM_ALERT_WINDOW,
  REQUEST_IGNORE_BATTERY_OPTIMIZATIONS and QUERY_ALL_PACKAGES: none is
  used. Overlays are accessibility-service windows, the battery page is
  opened via ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, and package
  visibility for launcher apps, home apps and input methods now comes
  from <queries> instead of the restricted QUERY_ALL_PACKAGES
- accessibility service declares isAccessibilityTool="false"
- prominent disclosure dialog before sending the user to the
  accessibility settings (what is read, that nothing leaves the device)
- remove the ignored android:persistent

UI
- edge-to-edge (enforced from targetSdk 35): the window ActionBar drew
  over the content and the content under the status bar. The activity
  now uses a NoActionBar theme with its own Toolbar, fitsSystemWindows
  on the root, and light system bars matching the white toolbar and
  bottom navigation
- ViewModelProviders -> ViewModelProvider, PackageInfo.versionCode ->
  PackageInfoCompat.getLongVersionCode, unused imports removed

Verified on a real device (Android 16): layout, disclosure dialog,
service binding and ad skipping; 64 unit tests pass.
checkout v7, setup-java v6, upload-artifact v7, action-gh-release v3;
setup-java v4 and the Node 20 runtime are deprecated. Pin ubuntu-24.04
because ubuntu-latest moves to Ubuntu 26 on 19 Oct 2026.
Google Play requires in-app disclosure and consent before the
accessibility service may process screen content. The dialog was only
shown when the service was not running yet, so enabling the service
from the system settings, or having enabled it before this release,
skipped it, and nothing recorded that the user agreed.

- Settings persists the consent; the dialog is shown whenever it is
  missing (button tap, or automatically when the home screen opens while
  the service already runs) and records it on "agree"
- the service ignores every accessibility event until the consent is
  recorded, and tells the user once per process to confirm it in the app
- the disclosure text now distinguishes automatic recognition (in-memory
  only) from the user-initiated features that do keep data: widget and
  position rules saved as local app data, and the window dump copied to
  the clipboard on request

Adds tests for the gate and the persisted flag; 66 unit tests in total.
@zfdang

zfdang commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

已按审查意见修复,见提交 record the accessibility disclosure consent and gate the service on it:

  1. 同意状态未保存/未校验:Settings 新增持久化的 ACCESSIBILITY_DISCLOSURE_ACCEPTED。披露对话框在未确认时一律显示(点击按钮时;或状态页打开时发现服务已在运行但未确认,自动弹出),点"同意"才记录。服务侧在 onAccessibilityEvent 入口校验:未确认前不读取任何界面内容、不点击,并在本进程内 Toast 提示一次"请打开应用确认说明"。从系统设置直接开启服务、以及老用户升级,都会被要求确认一次后才恢复工作。
  2. 披露与实际不符:文案改为分别说明——自动识别只在内存比对不保存;"添加程序的跳过方法"会把用户所选控件的文字/描述/坐标作为规则保存在本机应用数据(可在设置中查看删除);"复制窗口控件"按用户操作写入系统剪贴板;不联网、不上传。

回归测试:未确认时 STATE/CONTENT 事件被忽略、不读屏、不点击、提示一次,确认后下一事件即恢复处理;同意标记持久化到 SharedPreferences。单元测试共 66 个,全部通过。

@zfdang
zfdang merged commit 47cc4aa into master Sep 22, 2026
1 check passed
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.

1 participant