Skip to content

runtime: 在线导入在 android-side 层缺失时秒级失败,避免无限循环下载 - #97

Open
oleenwang wants to merge 1 commit into
WSK-build:mainfrom
oleenwang:fix/aside-preflight
Open

oleenwang wants to merge 1 commit into
WSK-build:mainfrom
oleenwang:fix/aside-preflight

Conversation

@oleenwang

Copy link
Copy Markdown

问题

在线导入 Debian 运行环境时,如果包里没有 android-side 层,用户会看到无限循环下载:
正在下载软件包 73/159 … → 重新开始 → 73/159 …,每轮数分钟,永不收敛。

根因

prepareAndroidSide()(OnlineRuntimeImportManager.kt:786)只有两条来源:

  1. 已安装运行树 runtime-current/android-side;
  2. 随包资产 assets/runtime/android-side.tar.*。

两者都缺时(典型场景:CI 只 clone 源码、未生成 runtime/android-assets 的构建产物——
runtime/ 不在源码仓库内),该函数在下载完 159 个包之后才返回 false,
报 ONLINE_ASIDE: cannot prepare android-side layer。用户视角即"反复下载、始终装不上",
且容易被误判为网络问题。

实测复现(iQOO 15 / Android 17 / SDK 37)

  • 用 CI 产出的 APK(缺 assets/runtime/):三台环境一致的设备上 100% 复现循环;
  • 从官方发布包提取 android-side.tar.zst(sha256 与官方清单一致)注入
    files/runtime/runtime-current/android-side 后重启,立即成功:
    installAssembledRuntime: assembled body installed (layers=[base, android-side]),
    界面转「Debian 层 已就绪」。

修改

把同一个判断提前到 manifest 校验之后、下载之前(新增 hasAndroidSideSource(),
15 行)。错误码 ONLINE_ASIDE 与用户文案完全不变(不新增字符串资源,不影响 i18n),
只是把数分钟的无效下载缩短到秒级,并把失败原因暴露在第一时间。

已在 fork 的 build-only 工作流验证编译通过(commit 33f07ac)。

关联

prepareAndroidSide() 只有两条来源:已安装的 runtime-current/android-side,
或随包 assets/runtime/android-side.tar.*。两者都缺时(典型:CI 只 clone 源码、
未生成 runtime/android-assets 的构建产物),当前实现会先下载完 base 清单的
全部软件包,才在 prepareAndroidSide 返回 false 时报 ONLINE_ASIDE —— 用户看到
的就是"反复下载 159 个包、始终装不上",而失败与网络无关。

本补丁把同一判断提前到 manifest 校验之后、下载之前;错误码与用户文案
保持不变,只把数分钟的无效下载缩短到秒级。在真机(iQOO 15 / Android 17)
上验证:注入 android-side 层后 layers=[base, android-side] 安装成功。

This branch has not been deployed

No deployments
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