Skip to content

feat(harmonyos): prepare API 26 follow-ups#40

Merged
qiin2333 merged 4 commits into
masterfrom
codex/harmonyos-api-26-followups
Jun 15, 2026
Merged

feat(harmonyos): prepare API 26 follow-ups#40
qiin2333 merged 4 commits into
masterfrom
codex/harmonyos-api-26-followups

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 让 CI SDK 归一化和 patch 脚本认识 HarmonyOS 26.0.0 / API 26,旧工具链也别迷路啦,杂鱼路径映射退散
  • 补 NetworkBoostKit 的 netBoost stub,并在 NetworkBoostService 里预埋 API 26 setDataFlowDesc 可选入口
  • 把一批 API 26 下会报警的 Circle().fill()/stroke() 装饰圆点改成 Ellipse(),减少最新 SDK 下的兼容噪音
  • 更新 README 的 DevEco / SDK / JBR 开发环境说明

为啥要改

  • 我们已经升级到最新 DevEco,先让项目能稳定识别和使用 API 26 SDK,但不直接升 targetSdkVersion,避免一次性打开新的 ArkUI/权限/系统行为门控
  • setDataFlowDesc 对串流场景很香,先把接口和 CI 声明准备好,后面 native 暴露 socket fd 后就能接入

验证

  • bash -n ci/normalize-sdk.sh
  • bash -n ci/patch-sdk.sh
  • JAVA_HOME=/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home PATH="/Applications/DevEco-Studio.app/Contents/jbr/Contents/Home/bin:$PATH" DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk NODE_PATH="$PWD/node_modules:$PWD/hvigor/node_modules" node hvigorw.js assembleHap --mode module -p module=entry@default -p product=default --no-daemon
  • 模拟器验证:无明显回归

Summary by CodeRabbit

发布说明

  • 新特性

    • 支持 HarmonyOS 26.0.0 SDK 编译流程(含 CI/目标版本适配与映射)
    • 网络优化工具包新增数据流描述符能力:NetworkBoostService 支持在 >=26 条件下配置并设置数据流(setDataFlowDesc)
  • 改进

    • 多处 UI 状态指示器由圆形切换为椭圆形(运行/在线/摇杆/测试等)
  • 开发环境

    • 更新开发环境依赖门槛与本地打包 HAP 相关说明;完善 HarmonyOS 26.0.0 Beta1 编译验证与目标版本文案

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qiin2333, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 13 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3fb19bf7-a5a2-402f-9739-5fab59fba82a

📥 Commits

Reviewing files that changed from the base of the PR and between 9c776a9 and 6e9166c.

📒 Files selected for processing (2)
  • ci/patch-sdk.sh
  • entry/src/main/ets/service/network/NetworkBoostService.ets
📝 Walkthrough

Walkthrough

本 PR 新增 HarmonyOS API 26 的 CI SDK 规范化映射与 hos-config.json 别名补丁;新增 netBoost 完整 TypeScript 声明桩;在 NetworkBoostService 中实现 setDataFlowDesc 公开方法及相关导出类型;同时将项目全局 UI 状态指示器与摇杆绘制原语从 Circle() 统一替换为 Ellipse(),并更新 README 工具链版本说明。

Changes

API 26 SDK 支持与 NetworkBoost 数据流

Layer / File(s) Summary
README 开发环境说明更新
README.md
更新 DevEco Studio、HarmonyOS SDK、Node.js 版本要求;新增 Java Runtime/JBR 本地打包 HAP 依赖说明;补充 HarmonyOS 26.0.0 Beta1 SDK 编译流程验证说明。
CI SDK API 26 版本映射与平台别名
ci/normalize-sdk.sh
新增 26) 分支将 HOS_PLATFORM_VERSIONHOS_COMPILE_SDK_VERSIONHOS_TARGET_SDK_VERSION 映射至 26.0.0;平台别名循环新增 HarmonyOS-$HOS_PLATFORM_VERSIONHarmonyOS $HOS_PLATFORM_VERSION 两项;环境变量输出补充 HOS_COMPILE_SDK_VERSION
CI patch-sdk.sh 中 API 26 别名与 NetworkBoostKit netBoost 补丁
ci/patch-sdk.sh
新增 patch_ci_build_profile_versions() 函数调整 build-profile.json5 的版本字段;hos-config.json 补丁描述更新至 API 26,新增 26.0.0osVersionMapper/osNameMapper/pathVersionMapper setdefault 映射;@kit.NetworkBoostKit 分支增强:新增 netBoost.d.ts stub 复制,SDK 内置声明检测并在缺失 setDataFlowDesc 时追加 networkboost-dataflow-patch.d.ts
netBoost 声明桩文件
ci/sdk-stubs/ohos.networkBoost.netBoost.d.ts, ci/sdk-stubs/networkboost-dataflow-patch.d.ts, ci/sdk-stubs/kit.NetworkBoostKit.d.ts, ci/sdk-stubs/kit.NetworkBoostKit.json, ci/sdk-stubs/ohos.networkBoost.netQuality.d.ts
新增 ohos.networkBoost.netBoost.d.tssetSceneDesc/setDataFlowDesc/setLowPowerMode 及完整接口/枚举声明);新增 networkboost-dataflow-patch.d.ts(补充 dataflow 相关接口);kit.NetworkBoostKit 模块加入 netBoost 导出映射与 JSON 符号绑定;netQuality 桩注释对齐 API 26。
NetworkBoostService setDataFlowDesc 实现
entry/src/main/ets/service/network/NetworkBoostService.ets
新增 6 个导出类型/接口(协议、优先级、端点、期望、五元组流、socket 流);新增公开方法 setDataFlowDesc(flow): boolean;新增私有字段 activeDataFlow 缓存当前流;新增内部 API 26+ 实现方法(setDataFlowDescApi26clearDataFlowDesctoDataFlowInfotoExpectedDescription);stop() 补充清理调用。

全局 UI 形状 Circle → Ellipse 替换

Layer / File(s) Summary
状态指示器与页面 UI 形状替换
entry/src/main/ets/components/AppCard.ets, AppListItem.ets, ComputerCard.ets, PcListTitleBar.ets, components/test/GameControllerTestView.ets, components/test/SensorTestView.ets, components/test/UsbControllerTestView.ets, pages/AddPcPageV2.ets, pages/ControllerTestPage.ets
所有状态指示圆点、在线状态标记、光晕、摇杆测试视图外圈等绘制原语从 Circle() 替换为 Ellipse(),共 10 处变更。
虚拟摇杆组件形状替换
entry/src/main/ets/components/virtual/AnalogStick.ets, InvisibleJoystick.ets, VirtualJoystick.ets
外圈、摇杆头、死区圆、点击反馈等共 9 处 Circle() 替换为 Ellipse(),其余尺寸、填充、描边等渲染参数保持不变。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AlkaidLab/moonlight-harmony#32:主 PR 新增 NetworkBoostService 支持与 NetworkBoostKit 声明桩、setDataFlowDesc API,本 PR 实现该 API 的核心逻辑与类型声明。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地概括了PR的主要目标——为HarmonyOS API 26做准备工作,涵盖了CI工具链更新、NetworkBoostKit功能、UI组件兼容性和文档更新等核心变更。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/harmonyos-api-26-followups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@entry/src/main/ets/service/network/NetworkBoostService.ets`:
- Around line 222-227: The setDataFlowDesc method is missing cleanup of any
previously active flow before setting a new one, which can leave stale state on
the NetworkBoost side when called repeatedly. Before calling
setDataFlowDescApi26 to establish the new flow, first add logic to properly
release the old flow (such as sending a LEAVE command or calling an appropriate
cleanup method). This ensures that when a session repeatedly calls
setDataFlowDesc with different flows, each old flow is explicitly left before
the new one is entered, preventing descriptor residue from lingering on the
NetworkBoost side.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dbab9053-07f4-4507-8e07-7518c8f14499

📥 Commits

Reviewing files that changed from the base of the PR and between c683fbd and e7039dd.

📒 Files selected for processing (21)
  • README.md
  • ci/normalize-sdk.sh
  • ci/patch-sdk.sh
  • ci/sdk-stubs/kit.NetworkBoostKit.d.ts
  • ci/sdk-stubs/kit.NetworkBoostKit.json
  • ci/sdk-stubs/networkboost-dataflow-patch.d.ts
  • ci/sdk-stubs/ohos.networkBoost.netBoost.d.ts
  • ci/sdk-stubs/ohos.networkBoost.netQuality.d.ts
  • entry/src/main/ets/components/AppCard.ets
  • entry/src/main/ets/components/AppListItem.ets
  • entry/src/main/ets/components/ComputerCard.ets
  • entry/src/main/ets/components/PcListTitleBar.ets
  • entry/src/main/ets/components/test/GameControllerTestView.ets
  • entry/src/main/ets/components/test/SensorTestView.ets
  • entry/src/main/ets/components/test/UsbControllerTestView.ets
  • entry/src/main/ets/components/virtual/AnalogStick.ets
  • entry/src/main/ets/components/virtual/InvisibleJoystick.ets
  • entry/src/main/ets/components/virtual/VirtualJoystick.ets
  • entry/src/main/ets/pages/AddPcPageV2.ets
  • entry/src/main/ets/pages/ControllerTestPage.ets
  • entry/src/main/ets/service/network/NetworkBoostService.ets

Comment thread entry/src/main/ets/service/network/NetworkBoostService.ets

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
ci/patch-sdk.sh (1)

76-85: ⚡ Quick win

建议在替换后校验命中次数,避免静默未生效。

Line 76-85 当前直接 re.sub 后写回;若 build-profile.json5 结构未来变化,可能 0 命中但仍显示已修补。建议用 re.subn 校验至少命中一次,否则直接失败,避免 CI 在错误 SDK 配置下继续执行。

建议修改
-text = re.sub(
+text, compile_hits = re.subn(
     r'("compileSdkVersion"\s*:\s*")[^"]+(")',
     rf'\g<1>{compile_version}\2',
     text,
 )
-text = re.sub(
+text, target_hits = re.subn(
     r'("targetSdkVersion"\s*:\s*")[^"]+(")',
     rf'\g<1>{target_version}\2',
     text,
 )
+if compile_hits == 0 or target_hits == 0:
+    raise SystemExit(
+        f'build-profile.json5 patch failed: compile_hits={compile_hits}, target_hits={target_hits}'
+    )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ci/patch-sdk.sh` around lines 76 - 85, The re.sub calls for compileSdkVersion
and targetSdkVersion replacements do not verify whether they actually matched
and replaced any occurrences. If the build-profile.json5 structure changes,
these patterns might fail to match but the code will silently continue without
detecting the failure. Replace both re.sub calls with re.subn instead, which
returns a tuple containing the modified text and the count of substitutions
made. After each re.subn call, check that the substitution count is at least 1,
and if not, raise an error or exit the script to prevent CI from continuing with
an unmodified SDK configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@ci/patch-sdk.sh`:
- Around line 76-85: The re.sub calls for compileSdkVersion and targetSdkVersion
replacements do not verify whether they actually matched and replaced any
occurrences. If the build-profile.json5 structure changes, these patterns might
fail to match but the code will silently continue without detecting the failure.
Replace both re.sub calls with re.subn instead, which returns a tuple containing
the modified text and the count of substitutions made. After each re.subn call,
check that the substitution count is at least 1, and if not, raise an error or
exit the script to prevent CI from continuing with an unmodified SDK
configuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: db8bc64b-3784-4f4b-b90b-92cc24b740e5

📥 Commits

Reviewing files that changed from the base of the PR and between 55b3683 and 2db0076.

📒 Files selected for processing (1)
  • ci/patch-sdk.sh

@qiin2333 qiin2333 force-pushed the codex/harmonyos-api-26-followups branch 3 times, most recently from 9c776a9 to e9987b7 Compare June 15, 2026 10:07
@qiin2333 qiin2333 force-pushed the codex/harmonyos-api-26-followups branch from e9987b7 to 95ed0e6 Compare June 15, 2026 10:12
@qiin2333 qiin2333 merged commit 23dc03d into master Jun 15, 2026
2 checks passed
@qiin2333 qiin2333 deleted the codex/harmonyos-api-26-followups branch June 15, 2026 10:47
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