fix gn error & add extension process mode

Signed-off-by: zexin_c <chenzexin14@huawei.com>
This commit is contained in:
zexin_c
2026-02-10 21:52:07 +08:00
parent 53052e9553
commit 630c4bc4e2
7 changed files with 23 additions and 13 deletions
@@ -28,8 +28,7 @@ gen_js_obj("agent_ui_extension_ability_js") {
}
gen_js_obj("agent_ui_extension_ability_abc") {
input =
get_label_info(":gen_agent_ui_extension_ability_abc",
input = get_label_info(":gen_agent_ui_extension_ability_abc",
"target_out_dir") + "/agent_ui_extension_ability.abc"
output = target_out_dir + "/agent_ui_extension_ability_abc.o"
dep = ":gen_agent_ui_extension_ability_abc"
@@ -22,5 +22,6 @@ group("agent_runtime_napi_packages") {
"${agent_runtime_framework_path}/frameworks/js/napi/agent_extension_context:js_agent_extension_context",
"${agent_runtime_framework_path}/frameworks/js/napi/agent_manager:agentmanager_napi",
"${agent_runtime_framework_path}/frameworks/js/napi/agent_ui_extension_ability:agentuiextensionability",
"${agent_runtime_framework_path}/frameworks/js/napi/agent_ui_extension_ability:js_agent_ui_extension",
]
}
@@ -73,10 +73,11 @@ ohos_shared_library("js_agent_ui_extension") {
include_dirs = [
"include",
"${agent_runtime_framework_path}/frameworks/native/agent_ui_extension_ability/include",
]
sources = [
"src/js_agent_extension.cpp",
"src/js_agent_ui_extension.cpp",
]
deps = [
@@ -20,14 +20,15 @@
#include "agent_ui_extension.h"
namespace OHOS::AbilityRuntime {
class Runtime;
class JsUIExtensionBase;
namespace OHOS {
namespace AbilityRuntime {
class Runtime;
}
namespace OHOS {
namespace AgentRuntime {
using namespace OHOS::AbilityRuntime;
class AgentUIExtension;
/**
* @brief Basic action extension components.
*/
@@ -19,6 +19,12 @@
#include "hitrace_meter.h"
#include "js_ui_extension_base.h"
#ifdef WINDOWS_PLATFORM
#define JS_EXPORT __declspec(dllexport)
#else
#define JS_EXPORT __attribute__((visibility("default")))
#endif
namespace OHOS {
namespace AgentRuntime {
JsAgentUIExtension::JsAgentUIExtension(const std::unique_ptr<AbilityRuntime::Runtime> &runtime)
@@ -33,9 +39,10 @@ JsAgentUIExtension::~JsAgentUIExtension()
TAG_LOGD(AAFwkTag::SER_ROUTER, "destructor");
}
extern "C" JS_EXPORT AgentUIExtension* OHOS_CreateJsAgentUIExtension(const std::unique_ptr<Runtime> &runtime)
extern "C" JS_EXPORT AgentUIExtension* OHOS_CreateJsAgentUIExtension(
const std::unique_ptr<Runtime> &runtime)
{
return new JsAgentUIExtension(static_cast<JsRuntime&>(*runtime));
return new JsAgentUIExtension(runtime);
}
} // namespace AgentRuntime
} // namespace OHOS
@@ -93,8 +93,7 @@ ohos_shared_library("agent_ui_extension") {
debug = false
}
branch_protector_ret = "pac_ret"
defines = [ "AMS_LOG_TAG = \"Agent\"" ]
defines += [ "AMS_LOG_DOMAIN = 0xD001353" ]
configs = [
":agent_ui_extension_config",
"${ability_runtime_services_path}/common:optimize_config",
@@ -102,7 +101,7 @@ ohos_shared_library("agent_ui_extension") {
include_dirs = [
"include",
"${agent_runtime_framework_path}/frameworks/js/napi/agent_ui_extension_ability/include",
"${agent_runtime_framework_path}/frameworks/native/agent_ui_extension_ability/include",
]
sources = [
@@ -31,6 +31,8 @@ constexpr const char *EMBEDDEDUI = "embeddedUI";
const std::string IS_PRELOAD_UIEXTENSION_ABILITY = "ability.want.params.is_preload_uiextension_ability";
constexpr const char* UIEXTENSION_TYPE_KEY = "ability.want.params.uiExtensionType";
constexpr size_t HOST_PID_INDEX = 3;
constexpr const char* AGENT_EXTENSION_TYPE = "agent";
int32_t GetAppIndexByRecord(std::shared_ptr<AAFwk::AbilityRecord> abilityRecord,
std::shared_ptr<AAFwk::AbilityRecord> callerRecord, const AAFwk::AbilityRequest &abilityRequest)
{
@@ -295,7 +297,7 @@ int32_t ExtensionRecordManager::UpdateProcessName(const AAFwk::AbilityRequest &a
switch (record->processMode_) {
case PROCESS_MODE_AGENT_UI: {
std::string process = abilityRequest.abilityInfo.bundleName
+ SEPARATOR + abilityRequest.abilityInfo.extensionTypeName;
+ SEPARATOR + AGENT_EXTENSION_TYPE;
abilityRecord->SetProcessName(process);
break;
}