feat(android): Android 应用内自动更新与 release JNI 修复#664
Open
HKLHaoBin wants to merge 9 commits into
Open
Conversation
Align updateChannel prefs with background AutoUpdateGate, add symmetric manual stable/beta check buttons, Android auto-download after check, and settings toggle; extract updater_logic helpers with unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
call_static_method caused NoSuchMethodError on Thread-8 during AutoUpdateGate background check, killing the app ~4s after launch. Co-authored-by: Cursor <cursoragent@cursor.com>
Manual workflow_dispatch builds signed release APKs when ANDROID_KEYSTORE_* is configured (overlay install, data preserved); otherwise falls back to unsigned debug with job summary notice. Tag releases still require all secrets; minisign/manifest/GitHub Release remain tag-only. Co-authored-by: Cursor <cursoragent@cursor.com>
Sync UPDATER_PUBKEY_B64 with tauri.conf.json; fail download when installApk returns false; put Beta channel above auto-update toggle; add pubkey CI check script. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid squeezing the toggle beside long description text on narrow mobile layouts; align with AutoUpdateSection pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Exclude Playwright/ui-check-screenshots outputs from version control and update the lockfile after tauri-nspanel resolution. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid NoSuchMethodError when installed APK dex lacks OpenLessAccessibilityService.isEnabled static bridge; query enabled services and heartbeat prefs directly. Co-authored-by: Cursor <cursoragent@cursor.com>
Add @keep and @JvmStatic on Rust-invoked bridge methods; default overlay service starts to startService and only START_RECORDING uses startForegroundService on API 26+; abort recording when foreground promotion fails. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
15 tasks
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.
User description
摘要
Fixes #。
为 Android APK 补齐应用内自动更新(Stable / Beta 渠道、后台检查、手动检查、自动下载安装),并修复 release 构建下 JNI 桥接被 R8 裁剪、更新签名校验不一致、overlay 前台服务误启动等真机问题。
修复 / 新增 / 改进
updateChannel与AutoUpdateGate对齐;高级页 Beta 开关 + 自动更新开关;关于页 / 高级页分别手动查 Stable / Beta;Android 检查到新版本后可自动下载并打开系统安装器。updater_logic.rs(manifest URL、版本比较、单测);Androidupdater.rs拉取 GitHub Release manifest、minisign 校验、系统安装器安装。UPDATER_PUBKEY_B64与tauri.conf.json同步;installApk返回false时向前端报错;新增check-android-updater-pubkey.mjs与 CI 检查。Build.SUPPORTED_ABIS改读 static field;无障碍状态改 JNI 直读Settings.Secure;release APK 为 JNI 入口加@Keep/@JvmStatic;overlay 默认startService,仅录音 action 在 API 26+ 使用startForegroundService,前台失败则取消录音并stopSelf。SettingRow,避免窄屏挤压。workflow_dispatch在 keystore secrets 齐全时构建 signed release APK(可覆盖安装);否则回退 unsigned debug 并写 job summary。兼容
npm run check:android-updater-pubkey,公钥与tauri.conf.json不一致时构建失败。测试计划
命令:
npm run build结果:通过
证据路径:本地 / CI
Android cargo checkjob命令:
npm run check:android-updater-pubkey结果:通过
证据路径:CI android-check job
命令:
cargo test updater_logic(Linux CI)结果:通过
证据路径:CI Linux / macOS checks
命令:CI workflow
Android APK (debug)+CI(run 27503851924 / 27503852955)结果:success
证据路径:https://github.com/HKLHaoBin/openless/actions
命令:真机
adb install -rrelease APK,冷启动 25s logcat结果:无
NoSuchMethodError、ForegroundServiceDidNotStartInTimeException、FATAL EXCEPTION证据路径:dex 扫描确认
onCapsuleStateChanged等 6 个 JNI 方法名存在命令:禁止「安装未知应用」后触发更新 → 授权后重试;Stable / Beta 手动检查回归
结果:待 reviewer 真机复测
证据路径:—
PR Type
Enhancement, Bug fix
Description
Android 应用内自动更新
修复 release JNI 崩溃
Beta 渠道开关与 UI
提取更新逻辑与测试
Diagram Walkthrough
flowchart LR A[AutoUpdateGate] -- background check --> B{Found update?} B -- Yes --> C[Download + verify APK] C --> D[Open system installer] B -- No --> E[Idle]File Walkthrough
7 files
修复 overlay 前台服务与 accessibility JNI使用 updater_logic 并修复 ABI 读取为 JNI 入口添加 @Keep 注解为 JNI 入口添加 @Keep 注解修复录制动作前台服务失败处理添加 @Keep 注解添加 @Keep 与 @JvmStatic 注解9 files
添加 updater_logic 模块声明新增更新逻辑纯函数与单元测试添加 autoInstallAndroid 选项后台检查传入 autoInstallAndroid添加 Beta 与自动更新翻译新增 Android 自动更新开关重构 Beta 渠道开关与按钮布局根据渠道显示不同按钮标签高级页添加 AutoUpdateSection1 files
更新 UpdateChannel 注释2 files
workflow_dispatch 支持 release 签名添加 updater pubkey 检查步骤1 files
新增 pubkey 一致性检查脚本8 files