Skip to content

fix: restore direct source and functional bounded Range acceleration - #12

Draft
Zhanfg wants to merge 140 commits into
mainfrom
fix/restore-direct-source-build
Draft

fix: restore direct source and functional bounded Range acceleration#12
Zhanfg wants to merge 140 commits into
mainfrom
fix/restore-direct-source-build

Conversation

@Zhanfg

@Zhanfg Zhanfg commented Aug 7, 2026

Copy link
Copy Markdown
Owner

修复目标

恢复默认分支缺失的 Android 工程,并重新实现真正可工作的系统下载 Range 加速链,而不是仅做安全透传。

主要改动

  • 将历史 Alpha 12 载荷还原为普通 Gradle 源码,删除 Base64/bootstrap、逐 Alpha 源码生成脚本与失效工作流。
  • 当前候选升级为 0.3.0-alpha14 / versionCode 15
  • 构建栈固定为 AGP 8.13.2、Gradle 8.13、JDK 17、SDK 36、AndroidX Core 1.17.0。
  • ModuleMain 重新启用真正的并行 HTTP Range:2–16 worker、默认 8、默认 16 MiB 分片、默认 32 MiB 启用阈值。
  • 不恢复历史 Alpha 12 的并行 pwrite:worker 只写有界临时分片;分片按顺序组成 InputStream 并交回 ColorOS 原始 copy loop,目标文件始终只有系统一个写入者。
  • Range 启用前强制执行严格预检:GET、已知长度、identity 编码、稳定验证器、单字节 206 探测、精确 Content-Range、相同总长度和验证器。
  • 预检失败会在任何加速字节进入系统 copy loop 前直接回退原始传输;运行中 worker 失败则把异常交回 DownloadProvider 自己的重试/续传路径,不进行同调用抢写回退。
  • 临时分片采用有限预取窗口,并在启动前检查空间和保留 64 MiB 余量;完成、取消和失败路径均清理分片。
  • 实际运行状态通过受 UID 校验的 Provider 回传到管理界面,显示 active / fallback / complete / error / disabled,不再静态显示“模块已启用”。
  • UI 最大线程从错误的 1024 改为硬限制 2–16;严格 Range 校验和失败策略改为强制安全策略,不允许 UI 关闭。
  • 内部广播继续采用签名级权限 + 随机令牌;导出 Provider 校验 DownloadProvider 调用 UID;Root 探测仍固定为 su -c id -u
  • Root 包装模块只升级低版本且签名兼容的 APK;签名不一致时保留原应用与数据并记录 signature-mismatch

最终验证

  • 最终头:5bd2a39fa35bd467008f461b8f21b0700c6c1c51
  • 最终 CI Run:31156636832
  • 源码身份、安全门、Debug/Release APK、R8、全量 Lint、Rust 1.86 ARM64 交叉编译、APK 签名、精确 Xposed 元数据/作用域、模块 ZIP、内嵌 APK 字节一致性和候选上传全部通过。
  • 离线复核确认 Release APK DEX 包含 Range hooks readyparallel Range input、严格 Range 探测路径;历史 RealDownloadAcceleratorModule / pwrite 标记不存在。

Alpha 14 候选哈希

3b229be25e7b8cb6335f381151ded610fb53a82e38b2fab55412a3f386ad03aa  SystemDownloadAccelerator-0.3.0-alpha14-debug.apk
fa8fa639257c0661d27e2a4b00630588170054c428ea2ca280c06007c7db9fc3  SystemDownloadAccelerator-0.3.0-alpha14.apk
9bf24392fd302ecaaa8b3887c39020c062445b363944ed65b43a9b1e93226e04  SystemDownloadAccelerator-0.3.0-alpha14-module.zip

验证边界

本 PR 继续保持 Draft。CI 已确认当前实现是真实 Range 引擎而非透传,但仍需要 Android 16 / ColorOS 真机验证:目标混淆方法签名、并行连接数量、最终文件 SHA-256、暂停/取消、断网、DownloadProvider 重启、设备重启续传、非 Range/压缩/DRM/未知长度回退,以及临时分片空间和清理行为。

Zhanfg added 14 commits August 7, 2026 13:13
- replace encoded bootstrap generation with ordinary Gradle source
- upgrade to an API 36-compatible Android build stack
- preserve the original DownloadProvider hook return value
- prevent wrapper-module APK downgrades while allowing upgrades
- remove unused package-install permission and disable backup of download history
- add direct source validation, lint, APK verification and module packaging
Bring the default-branch removal of the two missing-bootstrap workflows into the direct-source repair branch without changing the recovered source tree.
Load the reviewed pass-through entry instead of the experimental ranged writer, reset legacy enabled state during app startup, and make CI reject any reintroduction of the real engine into java_init.list.
Require a signature-level permission for confirmation and notification-control receivers, then verify the exact libxposed entry list, API metadata, scope, and embedded APK bytes in the final package.
Remove the unvalidated concurrent Range writer from the compiled source tree, enforce its absence in CI, report candidate certificate fingerprints, and preserve old installations when APK signatures differ.

Zhanfg commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

最终三轮审查与候选验证

第一轮:恢复与构建事实源

  • 从保留的 Alpha 12 迁移链一次性还原普通 Gradle 源码。
  • 删除 Base64/bootstrap 分片、临时触发文件、逐 Alpha 源码生成脚本和失效工作流。
  • 主分支上两条依赖缺失载荷的旧工作流已独立移除,文档 PR 不再无条件触发失败的 Android 构建。
  • 构建栈固定为 JDK 17、Gradle 8.13、AGP 8.13.2、SDK 36、AndroidX Core 1.17.0。

第二轮:运行时与 IPC 边界

  • 实际 libxposed 入口固定为安全透传 ModuleMain,保留系统原方法执行及返回值。
  • 实验性并发 Range 引擎及其辅助类已移出 APK 编译树;升级时旧版 enabled=true 状态强制关闭。
  • Xposed 作用域固定为 com.android.providers.downloads
  • 导出 Provider 校验调用 UID;确认结果和通知控制同时要求签名级权限与随机令牌。
  • Root 探测只执行固定的 su -c id -u
  • Android 备份关闭,未使用的包安装权限已移除。

第三轮:发布链与产物

  • Root 包装模块只升级旧版本且签名兼容的 APK;不同签名时保留原应用和数据并记录 signature-mismatch
  • CI 验证源码身份、全量清理、严格安全门、Debug/Release APK、全量 Lint、APK 签名、精确 Xposed 元数据与作用域、Rust 1.86 ARM64 交叉编译、模块路径安全、嵌入 APK 字节一致性和 SHA-256。
  • 最终 Run:31152225702,全部步骤通过。
  • 最终头:73ad1cac8f24568b753ec4dac58f6aeffcc57cca

候选哈希

f6e4685530e694542c75fa6ff8b2ce3b67a199c529b2c2ba2e68ea4c7c711fd6  SystemDownloadAccelerator-0.3.0-alpha13-debug.apk
4dd8a794a4843474d2542c49a1ab435edb6b67a43052feb93115f6f61c574240  SystemDownloadAccelerator-0.3.0-alpha13.apk
be48a2c38c56b40ba1033792bb93f4ca3751127c79f53cc3fce6f181f8f72a94  SystemDownloadAccelerator-0.3.0-alpha13-module.zip

Release APK 当前使用 Android Debug 证书,SHA-256 指纹:

d93469e0c4345fe657d88bd4ded059fc2a5018430c2b295f64c208f98107f118

PR 继续保持 Draft。尚未完成 Android 16 / ColorOS 真机上的 LSPosed 加载、下载确认、系统进程重启、Live Update 控制、模块覆盖升级和异常恢复验证;分段下载引擎仍未启用。

@Zhanfg Zhanfg changed the title fix: restore direct Android source and safe build pipeline fix: restore direct source and functional bounded Range acceleration Aug 7, 2026
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