Schema default for executeMode is "background" (lowercase), but
ResolveExecuteModeFromOption's MODE_MAP only had enum-full-name keys
("UI_ABILITY_BACKGROUND"). Add lowercase aliases matching both the
schema default and the profile JSON executeMode strings so callers
can pass "background" / "foreground" / "serviceextension" /
"uiextension" directly.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Static analysis flags FilterGeneric at depth 5 (function → for → if
Entry → for mode → if mode==). Pull the Entry executeMode check into
IsQualifiedEntry helper so FilterGeneric stays at depth 4.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Single Binder IPC has a ~1 MB mmap ceiling; a large FunctionInfo
vector (~2KB per entry due to inputSchema) can exceed the safe
threshold at 100+ entries. Split the vector into batches of 50
(~100KB each) and issue one IPC per batch. successCount is
accumulated across batches; any batch failure aborts early.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Unify on Generic (ExtractInsightIntentInfo) as the sole data format
for registration. Drop ConvertFromExtractProfile, FilterProfile, the
PrepareForRegister template, and the three ExtractFrom* helpers. Each
remaining Filter (Config/Generic) now inlines rule-1 filtering and
(moduleName, abilityName) sort directly.
event_mgr now converts Profile→Generic via ProfileInfoFormat before
filtering and registering, matching the sys_event_receiver path.
ConvertFromExtractIntentInfo is completed to emit the same full
FunctionInfo (options schema, inputSchema, outputSchema) that the old
Profile path produced, so both registration paths yield identical
KVStore entries.
Net effect: ~50 lines removed, one conversion path, two self-contained
filters, and consistent FunctionInfo output across all callers.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Remove deviceId from the registered options schema, drop the
ResolveDeviceId parser step (deviceId stays at its default empty
string), and delete the DispatchDistributedIntent helper plus the
distributed branch in ExecuteIntentByFunctionCall. ignoreAbilityName
no longer considers deviceId. The intent now always dispatches
locally via ExecuteIntentCommon.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Drop the two extra BatchRegisterFunctions failure-path cases that
came in from the upstream cherry-pick. Keep 001/002 which already
cover the happy path.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[0%]
ExecuteIntentByFunctionCall grew past 50 lines after adding the want
param cleanup. Pull wantParam cleanup + multi-candidate match +
paramParser.Build into PrepareFunctionCallParam so the entry function
stays focused on permission checks, dispatch routing, and common
handoff. Both functions are now under the 50-line cap.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Mirror StartAbility path which calls InsightIntentExecuteParam::
RemoveInsightIntent to strip residual INSIGHT_INTENT_* keys from the
want before downstream dispatch. Build a temporary Want from the input
WantParams, remove the intent params, then feed the cleaned WantParams
to InsightIntentParamParser::Build so downstream StartAbility*/DMS
paths no longer carry the intent execute metadata.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (unknown) <ai@local>
mock_insight_intent_db_cache.{h,cpp} for the thirteenth test lacked
GetAllInsightIntentInfoForRegister (added on the real cache), so test
targets linking the mock hit undefined symbol. Add the mock declaration
and a stub implementation that just delegates to GetAllInsightIntentInfo.
CliFunctionDataManager::BatchRegisterFunctions returns ERR_KVSTORE_ERROR
instead of ERR_INVALID_PARAM when no functions were registered, matching
the rest of the KVStore error reporting.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[89%] 👌 AI Adopted[89%] 🧑 Human[11%]
Co-authored-by: claude (glm-5.2) <ai@local>
Add abilityms_cli_tool_function_include config and attach it as a
public_config on the abilityms target. All test targets that depend
on :abilityms now automatically pick up the cli_tool function include
path, removing the need to patch each test's BUILD.gn when
insight_intent_db_cache.cpp (which transitively includes
function_info.h) is compiled into the test.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Same as insight_intent_execute_manager_second_test: the test compiles
insight_intent_db_cache.cpp, which now includes function_call_convert.h
(needed by GetAllInsightIntentInfoForRegister) which in turn pulls in
function_info.h from cli_tool_framework/interfaces/function/include.
Add the include path and cli_tool_client dep so function_info.h resolves.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
insight_intent_execute_manager_second_test compiles
insight_intent_db_cache.cpp which now includes function_call_convert.h
(needed by GetAllInsightIntentInfoForRegister), which in turn includes
function_info.h from cli_tool_framework/interfaces/function/include.
Add the include path so the test can resolve function_info.h.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
ResolveUserId now defaults to -1 (INVALID_USER_ID) instead of
callerUserId, so InsightIntentExecuteManager::CheckAndUpdateParam can
fall back to calling-UID-derived userId exactly like the ExecuteIntent
path. options.userId still overrides.
ExecuteIntentByFunctionCall now honors param->deviceId_: when non-empty
the function dispatches via DispatchDistributedIntent (flood attack
check, PERMISSION_EXECUTE_DISTRIBUTED_INTENT, GenerateWant,
dmsClient.StartRemoteIntent, SetRemoteIntentTimeout) instead of falling
through to ExecuteIntentCommon. ignoreAbilityName also becomes true when
deviceId is set, matching ExecuteIntent's existing behavior.
DispatchDistributedIntent is a new private helper so the distributed
dispatch body stays under the 50-line function cap.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%]
CliToolMgrClient::BatchRegisterFunctions returns ErrCode (int alias).
Use ErrCode instead of int32_t for the local ret variable so the type
matches the API declaration exactly, in line with the rest of the
CliTool client surface.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%]
Rename c/s/rep to candidate/str/matched inside InsightIntentParamParser
helpers and Build. Rename GetAbilityNameFromRep/GetExecuteModeFromRep
to GetAbilityNameFromMatched/GetExecuteModeFromMatched so the helper
names line up with the ParseResult.matchedInfo field they feed.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
sys_event_receiver's RegisterAllFunctions now collects every bundle's
FunctionInfo into one vector and calls CliToolMGRClient::BatchRegisterFunctions
in a single IPC instead of looping RegisterInsightIntentFunctions per
bundle. Cuts N bundle IPCs down to 1 on the boot/shutdown registration
path. New helper BatchRegisterInsightIntentFunctions in function_call_convert
covers convert + version stamping + batch call.
event_mgr path (per-module install) is untouched and still uses
RegisterInsightIntentFunctions. This commit depends on the pending
BatchRegisterFunctions API in cli_tool_framework.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
The field holds the candidate picked by the executor after rule-1
filtering and sort. 'matchedInfo' describes that purpose more directly
than 'representative' (which read as if the candidate were a spokesperson
for some group). Caller in ExecuteIntentByFunctionCall updated.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
IntentParamParser::Build now applies the same rule-1 filter and
(moduleName, abilityName) sort as IntentFilterUtil::FilterGeneric, then
picks the sorted vector's last element as the single representative.
All param fields come from that one representative (moduleName,
abilityName, executeMode, decoratorType), so registration and execution
end up choosing the same candidate for a given (bundleName, intentName).
wantParam.options overridess still apply on top of representative
fields. PickActiveCandidates and per-field Resolve* helpers are removed
since representative selection replaces them. FilterGeneric is reused
rather than duplicating rule-1 logic in the executor.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Rename FilterCandidate to RegisterSortKey (it is a sort key, not a
selection candidate after rules 2+3 were dropped), give it operator<
so the sort comparator reads naturally. Rename FilterAndSort template
to PrepareForRegister to surface the business intent (data prep for
KVStore registration). Replace the index-sort trick with std::pair
(key, item) pairing for a linear read.
No public API change. IntentFilterUtil::FilterProfile/FilterConfig/
FilterGeneric retain their names.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Re-introduce GetAllInsightIntentInfoForRegister on DbCache that returns
rule-1 filtered and (moduleName, abilityName) sorted data. sys_event_receiver
now calls this ForRegister variant and gets ready-to-register data.
RegisterInsightIntentFunctions drops its inline IntentFilterUtil call
back to pure convert+register semantics.
event_mgr (whose data comes from profile file parsing, not DbCache)
does explicit IntentFilterUtil.FilterProfile/FilterConfig before
Register, since it cannot use the ForRegister shortcut. Net effect:
each caller filters at its own data source instead of Register doing
all work, and the original GetAllInsightIntentInfo stays untouched.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Drop GetAllInsightIntentInfoForRegister and ApplyFilterPerBundle from
DbCache; rule 1 filter and (moduleName, abilityName) sort now live
inside RegisterInsightIntentFunctions where they belong as registration
business logic. DbCache reverts to pure CRUD.
Callers simplified: BackupAndScheduleRegister uses raw
GetAllInsightIntentInfo; event_mgr no longer constructs IntentFilterUtil
explicitly. Both paths converge on a single filter point inside
RegisterInsightIntentFunctions, ensuring consistent rule application.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Drop rules 2+3 (cross-module dedup, same-module multi-ability dedup)
from IntentFilterUtil. Each Filter* now does only rule 1 (drop
non-background-UIAbility / non-ServiceExtension) plus a sort by
(moduleName, abilityName). Sort guarantees deterministic KVStore
last-write-wins ordering for duplicate intentNames.
Adjust RegisterInsightIntentFunctions ConvertFrom* call order to
Config -> Profile/Generic so decorator-based intents overwrite
config-based ones on KVStore collisions.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Simplify rule 2 to "moduleName alphabetical first" without entry
preference. Removes entryModuleNames parameter from IntentFilterUtil
ctor, FilterCandidate.isEntryModule field, CandidateOrdering entry
dimension, DbCache GetAllInsightIntentInfoForRegister signature, and
bundleToEntryModules plumbing in sys_event_receiver/event_mgr. Callers
no longer need to extract entry modules from BundleInfo.
Also rename FilterAndDedup overloads to FilterProfile/FilterConfig/
FilterGeneric for explicit data-source semantics.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Wrap GetAllInsightIntentInfo + per-bundle IntentFilterUtil into a single
DbCache entry. sys_event_receiver's BackupAndScheduleRegister now reads
already-filtered data, removing the FilterAndDedup call from
RegisterAllFunctions. event_mgr still uses IntentFilterUtil directly
(its data comes from profile files, not DbCache).
Co-Authored-By: Agent
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
Move parameter parsing/assembly for ExecuteIntentByFunctionCall out of
AbilityManagerService anonymous helpers into a dedicated
InsightIntentParamParser class with explicit, unit-testable rules.
Expose multi-candidate matcher API (GetMatchedIntentInfos).
Drop SA-only check on ExecuteIntentByFunctionCall entry so function
calling agents can invoke intents directly.
Add IntentFilterUtil for CliTool registration path: callers preprocess
intent lists before RegisterInsightIntentFunctions to (1) drop intents
not bound to background UIAbility or ServiceExtension, (2) pick entry
module first when same intentName spans modules, (3) prefer UIAbility
over ServiceExtension when same module has multiple abilities.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>