mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
63a9231e3e
Two related fixes folded together:
1. Revert the L2 RemoveSkillParam calls added in
"fix(skill): strip skill params from non-skill want paths".
The L2 strip in AbilityRecord::ForegroundAbility and
ForegroundUIExtensionAbility breaks the legitimate cold-start
skill path:
StartAbilityByCallWithSkill (target not yet started)
-> StartAbilityByCall -> ResolveLocked
-> target launches and enters ForegroundAbility
-> ForegroundNew(GetWant(), ...) IPCs the want (with skill
params) to the app, but the FOREGROUND_NEW branch in
UIAbilityImpl::AbilityTransaction only checks
InsightIntent, not skill, so HandleExecuteSkill is NOT
called here
-> L2 then strips skill params from want_
-> later the ability moves to BACKGROUND_NEW
-> BackgroundNew(GetWant(), ...) reuses the now-stripped want_
-> app-side IsSkillExecute(want) returns false
-> HandleExecuteSkill is never called, skill silently drops
InsightIntent is unaffected because it triggers in FOREGROUND_NEW
(HandleExecuteInsightIntentForeground), so the params are consumed
before L2 clears them. Skill only triggers in BACKGROUND_NEW, which
makes L2 unsafe for skill. L1 (entry stripping) and L3
(ExecuteSkillDone cleanup) are sufficient.
2. Propagate AMS failure code to CLI exitCode.
BuildSkillSessionInfo sets ExecResult.exitCode from skillResult.code,
but SkillExecuteManager constructs a default SkillExecuteResult
(code=0) for OnTimeout / OnLaunchFailed / OnTargetProcessDied. The
OnExecuteDone resultCode carries the real error (e.g.
ERR_SKILL_EXECUTE_TARGET_DIED), yet CLI consumers saw exitCode=0
alongside status="failed", masking the failure.
Fix at two layers:
- CLI: BuildSkillSessionInfo falls back to resultCode when
skillResult.code==0 && resultCode!=ERR_OK.
- AMS: SkillExecuteManager now mirrors the resultCode into
emptyResult.code at all three failure sites, matching how the
app-side ReportSkillError already populates .code with errCode.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>