diff --git a/BUILD.gn b/BUILD.gn index f9ce5a2065e3263af4d2ea7750bd32a0e9a43a06..dc16e3fc761ab62b56e2bac5d307864405336626 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -389,9 +389,13 @@ ohos_prebuilt_etc("form_config") { group("form_napi_packages") { if (ability_runtime_graphics) { deps = [ + "${form_fwk_napi_path}:form_edit_extension", + "${form_fwk_napi_path}:form_edit_extension_module", "${form_fwk_napi_path}:formagent", "${form_fwk_napi_path}:formbindingdata", "${form_fwk_napi_path}:formbindingdata_napi", + "${form_fwk_napi_path}:formeditextensionability_napi", + "${form_fwk_napi_path}:formeditextensioncontext_napi", "${form_fwk_napi_path}:formerror_napi", "${form_fwk_napi_path}:formextension_napi", "${form_fwk_napi_path}:formextensionability", diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index 662511c261fbe12c0686c6bbc1c51b359f244ad9..4891013102109d37ab96055b10764090eccea81d 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -554,3 +554,157 @@ ohos_shared_library("formerror_napi") { subsystem_name = "ability" part_name = "form_fwk" } + +################################### gen_form_edit_extension_ability_abc ######################################## +es2abc_gen_abc("gen_form_edit_extension_ability_abc") { + src_js = + rebase_path("form_edit_extension_ability/form_edit_extension_ability.js") + dst_file = rebase_path(target_out_dir + "/form_edit_extension_ability.abc") + in_puts = [ "form_edit_extension_ability/form_edit_extension_ability.js" ] + out_puts = [ target_out_dir + "/form_edit_extension_ability.abc" ] + extra_args = [ "--module" ] +} + +gen_js_obj("form_edit_extension_ability_js") { + input = "form_edit_extension_ability/form_edit_extension_ability.js" + output = target_out_dir + "/form_edit_extension_ability.o" +} + +gen_js_obj("form_edit_extension_ability_abc") { + input = get_label_info(":gen_form_edit_extension_ability_abc", + "target_out_dir") + "/form_edit_extension_ability.abc" + output = target_out_dir + "/form_edit_extension_ability_abc.o" + dep = ":gen_form_edit_extension_ability_abc" +} + +ohos_shared_library("formeditextensionability_napi") { + sources = + [ "form_edit_extension_ability/form_edit_extension_ability_module.cpp" ] + + configs = [ ":fmskit_config" ] + + deps = [ + ":form_edit_extension_ability_abc", + ":form_edit_extension_ability_js", + ] + + external_deps = [ "napi:ace_napi" ] + + relative_install_dir = "module/app/form" + subsystem_name = "ability" + part_name = "form_fwk" +} + +################################### gen_form_edit_extension_context_abc ######################################## +es2abc_gen_abc("gen_form_edit_extension_context_abc") { + src_js = + rebase_path("form_edit_extension_context/form_edit_extension_context.js") + dst_file = rebase_path(target_out_dir + "/form_edit_extension_context.abc") + in_puts = [ "form_edit_extension_context/form_edit_extension_context.js" ] + out_puts = [ target_out_dir + "/form_edit_extension_context.abc" ] + extra_args = [ "--module" ] +} + +gen_js_obj("form_edit_extension_context_js") { + input = "form_edit_extension_context/form_edit_extension_context.js" + output = target_out_dir + "/form_edit_extension_context.o" +} + +gen_js_obj("form_edit_extension_context_abc") { + input = get_label_info(":gen_form_edit_extension_context_abc", + "target_out_dir") + "/form_edit_extension_context.abc" + output = target_out_dir + "/form_edit_extension_context_abc.o" + dep = ":gen_form_edit_extension_context_abc" +} + +ohos_shared_library("formeditextensioncontext_napi") { + sources = + [ "form_edit_extension_context/form_edit_extension_context_module.cpp" ] + + configs = [ ":fmskit_config" ] + + deps = [ + ":form_edit_extension_context_abc", + ":form_edit_extension_context_js", + ] + + external_deps = [ "napi:ace_napi" ] + + relative_install_dir = "module/application" + subsystem_name = "ability" + part_name = "form_fwk" +} + +################################### gen_form_edit_extension_ability ######################################## +ohos_shared_library("form_edit_extension") { + include_dirs = [] + + sources = [ + "form_edit_extension_ability/form_edit_extension.cpp", + "form_edit_extension_ability/js_form_edit_extension.cpp", + "form_edit_extension_context/form_edit_extension_context.cpp", + "form_edit_extension_context/js_form_edit_extension_context.cpp", + "form_edit_extension_context/js_form_edit_extension_impl.cpp", + ] + + configs = [ ":fmskit_config" ] + + deps = [ + ":formutil_napi", + "${form_fwk_path}:fmskit_native", + "${form_fwk_path}:fmskit_provider_client", + "${form_fwk_path}:form_manager", + ] + + external_deps = [ + "ability_base:want", + "ability_runtime:ability_context_native", + "ability_runtime:abilitykit_native", + "ability_runtime:app_context", + "ability_runtime:napi_common", + "ability_runtime:runtime", + "ability_runtime:ui_extension", + "c_utils:utils", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_napi", + "napi:ace_napi", + ] + + subsystem_name = "ability" + part_name = "form_fwk" +} + +ohos_shared_library("form_edit_extension_module") { + include_dirs = [] + + sources = + [ "form_edit_extension_ability/form_edit_extension_module_loader.cpp" ] + + configs = [ ":fmskit_config" ] + + deps = [ ":form_edit_extension" ] + + external_deps = [ + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "ability_runtime:abilitykit_native", + "ability_runtime:appkit_native", + "ability_runtime:extensionkit_native", + "ability_runtime:runtime", + "ability_runtime:ui_extension", + "bundle_framework:appexecfwk_core", + "hilog:libhilog", + "napi:ace_napi", + ] + + if (ability_runtime_graphics) { + deps += [ "${form_fwk_path}:form_manager" ] + } + + relative_install_dir = "extensionability" + subsystem_name = "ability" + part_name = "form_fwk" +} diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.cpp b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8541e4e2319e4fe1a11a370a9a1a8a6d5bd19cb --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "form_edit_extension.h" +#include "hilog_tag_wrapper.h" +#include "js_form_edit_extension.h" +#include "runtime.h" +#include "../form_edit_extension_context/form_edit_extension_context.h" +namespace OHOS { +namespace AbilityRuntime { +FormEditExtension::FormEditExtension() +{ + TAG_LOGI(AAFwkTag::FORM_EDIT_EXT, "call"); +} + +FormEditExtension *FormEditExtension::Create(const std::unique_ptr &runtime) +{ + if (!runtime) { + return new FormEditExtension(); + } + switch (runtime->GetLanguage()) { + case Runtime::Language::JS: + return JsFormEditExtension::Create(runtime); + default: + return new FormEditExtension(); + } +} +} // namespace AbilityRuntime +} // namespace OHOS diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.h b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.h new file mode 100644 index 0000000000000000000000000000000000000000..2f95f935a364fa9a492d4fc86f0ff15693cbdbc7 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_H +#define OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_H + +#include "ui_extension_base.h" +#include "../form_edit_extension_context/form_edit_extension_context.h" +namespace OHOS { +namespace AbilityRuntime { +class FormEditExtensionContext; +class Runtime; +/** + * @brief FormEdit Extension components. + */ +class FormEditExtension : public UIExtensionBase, + public std::enable_shared_from_this { +public: + explicit FormEditExtension(); + virtual ~FormEditExtension() = default; + + /** + * @brief Create FormEditExtension UI extension. + * + * @param runtime The runtime. + * @return The FormEdit Extension instance. + */ + static FormEditExtension *Create(const std::unique_ptr &runtime); +}; +} // namespace AbilityRuntime +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_H diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability.js b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability.js new file mode 100644 index 0000000000000000000000000000000000000000..523ec055e4727dc4b8b169f65567fe7f8a4a6f69 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability.js @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let UIExtensionAbility = requireNapi('app.ability.UIExtensionAbility'); + +export default class FormEditExtensionAbility extends UIExtensionAbility {} \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability_module.cpp b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability_module.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee1d50a295a616fd1a5fe9ffba6ee2c248526263 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_ability_module.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "native_engine/native_engine.h" +#include "napi/native_api.h" + +extern const char _binary_form_edit_extension_ability_js_start[]; +extern const char _binary_form_edit_extension_ability_js_end[]; +extern const char _binary_form_edit_extension_ability_abc_start[]; +extern const char _binary_form_edit_extension_ability_abc_end[]; + +static napi_module _module = { + .nm_version = 0, + .nm_filename = "app/form/libformeditextensionability_napi.so/form_edit_extension_ability.js", + .nm_modname = "app.form.FormEditExtensionAbility", +}; +extern "C" __attribute__((constructor))void NAPI_app_form_FormEditExtensionAbility_AutoRegister() +{ + napi_module_register(&_module); +} + +extern "C" __attribute__((visibility("default")))void NAPI_app_form_FormEditExtensionAbility_GetJSCode( + const char **buf, int *bufLen) +{ + if (buf != nullptr) { + *buf = _binary_form_edit_extension_ability_js_start; + } + + if (bufLen != nullptr) { + *bufLen = _binary_form_edit_extension_ability_js_end - _binary_form_edit_extension_ability_js_start; + } +} + +extern "C" __attribute__((visibility("default")))void NAPI_app_form_FormEditExtensionAbility_GetABCCode( + const char **buf, int *buflen) +{ + if (buf != nullptr) { + *buf = _binary_form_edit_extension_ability_abc_start; + } + if (buflen != nullptr) { + *buflen = _binary_form_edit_extension_ability_abc_end - _binary_form_edit_extension_ability_abc_start; + } +} \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.cpp b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe7e5ef6ccd8d46791125d825239e4329af4ccd9 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "form_edit_extension_module_loader.h" + +#include "form_edit_extension.h" +#include "hilog_tag_wrapper.h" + +namespace OHOS { +namespace AbilityRuntime { +FormEditExtensionModuleLoader::FormEditExtensionModuleLoader() = default; +FormEditExtensionModuleLoader::~FormEditExtensionModuleLoader() = default; + +Extension *FormEditExtensionModuleLoader::Create(const std::unique_ptr &runtime) const +{ + TAG_LOGD(AAFwkTag::FORM_EDIT_EXT, "called"); + return FormEditExtension::Create(runtime); +} + +std::map FormEditExtensionModuleLoader::GetParams() +{ + TAG_LOGD(AAFwkTag::FORM_EDIT_EXT, "called"); + std::map params; + // type means extension type in ExtensionAbilityType of + // extension_ability_info.h, 27 means formEditExtension. + params.insert(std::pair("type", "27")); + params.insert(std::pair("name", "FormEditExtensionAbility")); + return params; +} + +extern "C" __attribute__((visibility("default"))) void *OHOS_EXTENSION_GetExtensionModule() +{ + return &FormEditExtensionModuleLoader::GetInstance(); +} +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.h b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.h new file mode 100644 index 0000000000000000000000000000000000000000..de29055ee1b53ab111c2f029402756499fe17a16 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/form_edit_extension_module_loader.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_MODULE_LOADER_H +#define OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_MODULE_LOADER_H + +#include "extension_module_loader.h" + +namespace OHOS { +namespace AbilityRuntime { +class FormEditExtensionModuleLoader : public ExtensionModuleLoader, public Singleton { + DECLARE_SINGLETON(FormEditExtensionModuleLoader); + +public: + /** + * @brief Create Extension. + * + * @param runtime The runtime. + * @return The Extension instance. + */ + Extension *Create(const std::unique_ptr& runtime) const override; + + /** + * @brief Get the params object + * + * @param runtime runtime + * @return td::map The map of extension type and extension name. + */ + std::map GetParams() override; +}; +} +} +#endif // OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_MODULE_LOADER_H diff --git a/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.cpp b/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.cpp new file mode 100644 index 0000000000000000000000000000000000000000..567a0d1f86e8422bd897b7ba4d609d2d7c8211c3 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "js_form_edit_extension.h" +#include "hilog_tag_wrapper.h" +#include "hitrace_meter.h" +#include "js_ui_extension_base.h" +#include "../form_edit_extension_context/js_form_edit_extension_context.h" +#include "../form_edit_extension_context/js_form_edit_extension_impl.h" + +namespace OHOS { +namespace AbilityRuntime { +JsFormEditExtension *JsFormEditExtension::Create(const std::unique_ptr &runtime) +{ + return new JsFormEditExtension(runtime); +} + +JsFormEditExtension::JsFormEditExtension(const std::unique_ptr &runtime) +{ + impl_ = std::make_shared(runtime); + SetUIExtensionBaseImpl(impl_); +} + +void JsFormEditExtension::Init(const std::shared_ptr &record, + const std::shared_ptr &application, + std::shared_ptr &handler, + const sptr &token) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "Begin init form edit extension"); + std::shared_ptr context = std::make_shared(); + context->SetToken(token); + auto appContext = Context::GetApplicationContext(); + if (appContext == nullptr) { + TAG_LOGE(AAFwkTag::FORM_EDIT_EXT, "null appContext"); + return; + } + context->SetApplicationInfo(appContext->GetApplicationInfo()); + context->SetResourceManager(appContext->GetResourceManager()); + context->SetParentContext(appContext); + + if (record == nullptr) { + TAG_LOGE(AAFwkTag::FORM_EDIT_EXT, "null record"); + return; + } + auto abilityInfo = record->GetAbilityInfo(); + context->SetAbilityInfo(abilityInfo); + context->InitHapModuleInfo(abilityInfo); + context->SetConfiguration(appContext->GetConfiguration()); + if (abilityInfo->applicationInfo.multiProjects) { + std::shared_ptr moduleContext = context->CreateModuleContext(abilityInfo->moduleName); + if (moduleContext != nullptr) { + auto rm = moduleContext->GetResourceManager(); + context->SetResourceManager(rm); + } + } + + Extension::Init(record, application, handler, token); + impl_->SetContext(context); + impl_->SetAbilityInfo(Extension::abilityInfo_); + auto extensionCommon = impl_->Init(record, application, handler, token); + ExtensionBase::SetExtensionCommon(extensionCommon); +} + +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.h b/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.h new file mode 100644 index 0000000000000000000000000000000000000000..4ec88965bfbcc450f4be7cff3503e4495e12f189 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_ability/js_form_edit_extension.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H +#define OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H + +#include "form_edit_extension.h" +#include "configuration.h" +#include "js_ui_extension_base.h" +#include + +class NativeReference; + +namespace OHOS { +namespace AbilityRuntime { +class JsRuntime; +class JsFormEditExtensionImpl; + +/** + * @brief Basic form edit extension components. + */ +class JsFormEditExtension : public FormEditExtension, public std::enable_shared_from_this { +public: + explicit JsFormEditExtension(const std::unique_ptr &runtime); + virtual ~JsFormEditExtension() override = default; + +/** + * @brief Init the form edit extension. + * + * @param record the form edit extension record. + * @param application the application info. + * @param handler the form edit extension handler. + * @param token the remote token. + */ + virtual void Init(const std::shared_ptr &record, + const std::shared_ptr &application, + std::shared_ptr &handler, const sptr &token) override; + + /** + * @brief Create JsFormEditExtension. + * + * @param runtime The runtime. + * @return The JsFormEditExtension instance. + */ + static JsFormEditExtension *Create(const std::unique_ptr &runtime); + +private: + std::shared_ptr impl_ = nullptr; +}; +} // namespace AbilityRuntime +} // namespace OHOS +#endif // OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.cpp b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.cpp new file mode 100644 index 0000000000000000000000000000000000000000..de9520e9115231dd7f2e87f34a4a3bbd47980039 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "../form_edit_extension_context/form_edit_extension_context.h" +#include "hilog_tag_wrapper.h" +#include "form_constants.h" +#include "form_mgr.h" + + +namespace OHOS { +namespace AbilityRuntime { +using namespace OHOS::AppExecFwk; +void FormEditExtensionContext::SetWant(const std::shared_ptr &want) +{ + want_ = want; + TAG_LOGD(AAFwkTag::UI_EXT, "Set want done"); +} + +ErrCode FormEditExtensionContext::StartAbilityByFms(const AAFwk::Want &want) +{ + TAG_LOGI(AAFwkTag::UI_EXT, "StartAbilityByFms wantToHost: %{public}s", want.ToString().c_str()); + Want wantToHost(want); + std::string requestMethod = "openFormEditSecPageView"; + wantToHost.SetParam(Constants::PARAM_PAGE_ROUTER_SERVICE_CODE, Constants::PAGE_ROUTER_SERVICE_CODE_FORM_EDIT); + wantToHost.SetParam(Constants::PARMA_REQUEST_METHOD, requestMethod); + wantToHost.SetAction(Constants::FORM_PAGE_ACTION); + + TAG_LOGI(AAFwkTag::UI_EXT, "StartAbilityByFms wantToHost: %{public}s", wantToHost.ToString().c_str()); + ErrCode err = AppExecFwk::FormMgr::GetInstance().StartAbilityByFms(wantToHost); + if (err != ERR_OK) { + TAG_LOGE(AAFwkTag::UI_EXT, "ret = %{public}d", err); + return err; + } + TAG_LOGI(AAFwkTag::UI_EXT, "StartAbilityByFms success"); + return ERR_OK; +} +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.h b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.h new file mode 100644 index 0000000000000000000000000000000000000000..adfc6d75573a704264b1461a78fa4dd5dc88ef4f --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_CONTEXT_H +#define OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_CONTEXT_H + +#include "ui_extension_context.h" +namespace OHOS { +namespace AbilityRuntime { + +enum class FormEditErrorCode { + // success + ERROR_OK = 0, + + // param error + ERROR_CODE_PARAM_ERROR = 401, + + // internal error + ERROR_CODE_INTERNAL_ERROR = 16501000 +}; + +class FormEditExtensionContext : public UIExtensionContext { +public: + FormEditExtensionContext() = default; + + virtual ~FormEditExtensionContext() = default; + + void SetWant(const std::shared_ptr &want); + + static const size_t CONTEXT_TYPE_ID; + + ErrCode StartAbilityByFms(const AAFwk::Want &want); + +private: + std::shared_ptr want_; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_FORM_EDIT_EXTENSION_CONTEXT_H \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.js b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.js new file mode 100644 index 0000000000000000000000000000000000000000..2a40f52122caeeea3553a77a38fb0ad93bd38044 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +let UIExtensionContext = requireNapi('application.UIExtensionContext'); + +export class FormEditExtensionContext extends UIExtensionContext { + constructor(obj) { + super(obj); + } + + startSecondPage(want, asyncCallback) { + console.log('FormEditExtensionContext startSecondPage want: ' + want); + return this.__context_impl__.startSecondPage(want, asyncCallback); + } +} \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context_module.cpp b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context_module.cpp new file mode 100644 index 0000000000000000000000000000000000000000..048dd37a41dec164db417e6442385892ff828f8e --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/form_edit_extension_context_module.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "native_engine/native_engine.h" + +extern const char _binary_form_edit_extension_context_js_start[]; +extern const char _binary_form_edit_extension_context_js_end[]; +extern const char _binary_form_edit_extension_context_abc_start[]; +extern const char _binary_form_edit_extension_context_abc_end[]; + +static napi_module _module = { + .nm_version = 0, + .nm_filename = "application/libformeditextensioncontext_napi.so/form_edit_extension_context.js", + .nm_modname = "application.FormEditExtensionContext", +}; +extern "C" __attribute__((constructor)) void NAPI_application_FormEditExtensionContext_AutoRegister() +{ + napi_module_register(&_module); +} + +extern "C" __attribute__((visibility("default")))void NAPI_application_FormEditExtensionContext_GetJSCode( + const char **buf, int *bufLen) +{ + if (buf != nullptr) { + *buf = _binary_form_edit_extension_context_js_start; + } + + if (bufLen != nullptr) { + *bufLen = _binary_form_edit_extension_context_js_end - _binary_form_edit_extension_context_js_start; + } +} + +// ability_context JS register +extern "C" __attribute__((visibility("default")))void NAPI_application_FormEditExtensionContext_GetABCCode( + const char **buf, int *buflen) +{ + if (buf != nullptr) { + *buf = _binary_form_edit_extension_context_abc_start; + } + if (buflen != nullptr) { + *buflen = _binary_form_edit_extension_context_abc_end - _binary_form_edit_extension_context_abc_start; + } +} \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.cpp b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c05ec0dfd5559e1f3ad499b2af7a4d45ef9e136 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "../form_edit_extension_context/js_form_edit_extension_context.h" +#include "hilog_tag_wrapper.h" +#include "js_ui_extension_context.h" +#include "js_runtime.h" +#include "js_runtime_utils.h" +#include "napi_common_util.h" +#include "napi_common_want.h" +#include "form_constants.h" +#include "element_name.h" +#include "js_error_utils.h" + +namespace OHOS { +namespace AbilityRuntime { +namespace { +constexpr size_t ARGC_TWO = 2; +constexpr const char *ERR_MSG_PARAMS_ERROR = "Params error"; +constexpr const char *ERR_MSG_INTERNAL_ERROR = "Internal error"; +constexpr int32_t INDEX_ONE = 1; +} // namespace +using namespace OHOS::AppExecFwk; + +void JsFormEditExtensionContext::Finalizer(napi_env env, void *data, void *hint) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "called"); + std::unique_ptr(static_cast(data)); +} + +napi_value JsFormEditExtensionContext::CreateJsFormEditExtensionContext( + napi_env env, std::shared_ptr context) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "begin"); + std::shared_ptr abilityInfo = nullptr; + if (context) { + abilityInfo = context->GetAbilityInfo(); + } + + napi_value objValue = JsUIExtensionContext::CreateJsUIExtensionContext(env, context); + std::unique_ptr jsContext = std::make_unique(context); + napi_status status = napi_wrap(env, objValue, jsContext.release(), Finalizer, nullptr, nullptr); + if (status != napi_ok) { + TAG_LOGE(AAFwkTag::UI_EXT, "Failed to do napi wrap"); + } + + const char *moduleName = "JsFormEditExtensionContext"; + BindNativeFunction(env, objValue, "startSecondPage", moduleName, StartSecondPage); + + return objValue; +} + +napi_value JsFormEditExtensionContext::StartSecondPage(napi_env env, napi_callback_info info) +{ + TAG_LOGI(AAFwkTag::UI_EXT, "called"); + GET_NAPI_INFO_AND_CALL(env, info, JsFormEditExtensionContext, OnStartSecondPage); +} + +napi_value JsFormEditExtensionContext::OnStartSecondPage(napi_env env, NapiCallbackInfo &info) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "called: param size: %{public}d", static_cast(info.argc)); + if (info.argc != ARGC_TWO) { + ThrowError(env, static_cast(FormEditErrorCode::ERROR_CODE_PARAM_ERROR), ERR_MSG_PARAMS_ERROR); + return CreateJsUndefined(env); + } + + auto context = context_.lock(); + if (context == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released"); + ThrowError(env, static_cast(FormEditErrorCode::ERROR_CODE_INTERNAL_ERROR), ERR_MSG_INTERNAL_ERROR); + return CreateJsUndefined(env); + } + + AAFwk::Want want; + OHOS::AppExecFwk::UnwrapWant(env, info.argv[0], want); + NapiAsyncTask::CompleteCallback complete = [weak = context_, want](napi_env env, NapiAsyncTask &task, + int32_t status) { + TAG_LOGD(AAFwkTag::UI_EXT, "OnStartSecondPage begin"); + auto context = weak.lock(); + if (!context) { + TAG_LOGE(AAFwkTag::UI_EXT, "Context is released"); + task.Reject(env, CreateJsError(env, static_cast(FormEditErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + ErrCode errCode = context->StartAbilityByFms(want); + napi_value abilityResult = AppExecFwk::WrapAbilityResult(env, static_cast(errCode), want); + if (abilityResult == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Wrap abilityResult failed"); + task.Reject(env, CreateJsError(env, static_cast(FormEditErrorCode::ERROR_CODE_INTERNAL_ERROR))); + return; + } + + task.Resolve(env, abilityResult); + }; + + napi_value lastParam = (info.argc > INDEX_ONE) ? info.argv[INDEX_ONE] : nullptr; + napi_value result = nullptr; + NapiAsyncTask::ScheduleHighQos("JsFormEditExtensionContext OnStartSecondPage", env, + CreateAsyncTaskWithLastParam(env, lastParam, nullptr, std::move(complete), &result)); + return result; +} +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.h b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.h new file mode 100644 index 0000000000000000000000000000000000000000..084b958b48e4dca5cbe240340fac5ff618c869ef --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_context.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_CONTEXT_H +#define OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_CONTEXT_H + +#include "../form_edit_extension_context/form_edit_extension_context.h" +#include "native_engine/native_engine.h" + +namespace OHOS { +namespace AbilityRuntime { +struct NapiCallbackInfo; +class JsFormEditExtensionContext { +public: + explicit JsFormEditExtensionContext(const std::shared_ptr &context) + : context_(context) + {} + + virtual ~JsFormEditExtensionContext() = default; + + static void Finalizer(napi_env env, void *data, void *hint); + + static napi_value CreateJsFormEditExtensionContext(napi_env env, + std::shared_ptr context); + + static napi_value StartSecondPage(napi_env env, napi_callback_info info); + +private: + napi_value OnStartSecondPage(napi_env env, NapiCallbackInfo &info); + +private: + std::weak_ptr context_; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_CONTEXT_H \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.cpp b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afa54b70235f1c93e7cf2d117601b6c2c003aab3 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "js_form_edit_extension_impl.h" +#include "hilog_tag_wrapper.h" +#include "napi/native_api.h" +#include "napi/native_node_api.h" +#include "../form_edit_extension_context/js_form_edit_extension_context.h" +#include "js_ui_extension_content_session.h" +#include "napi_common_want.h" + +namespace OHOS { +namespace AbilityRuntime { + +namespace { +constexpr size_t ARGC_ONE = 1; +} // namespace + +napi_value AttachUIExtensionContext(napi_env env, void *value, void *) +{ + TAG_LOGD(AAFwkTag::UI_EXT, "called"); + if (value == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Invalid param value"); + return nullptr; + } + + auto ptr = reinterpret_cast *>(value)->lock(); + if (ptr == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Invalid context"); + return nullptr; + } + napi_value object = JsFormEditExtensionContext::CreateJsFormEditExtensionContext(env, ptr); + auto contextRef = + JsRuntime::LoadSystemModuleByEngine(env, "application.FormEditExtensionContext", &object, ARGC_ONE); + if (contextRef == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to load module"); + return nullptr; + } + auto contextObj = contextRef->GetNapiValue(); + if (contextObj == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Load context error"); + return nullptr; + } + napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc, AttachUIExtensionContext, value, nullptr); + auto workContext = new (std::nothrow) std::weak_ptr(ptr); + napi_status status = napi_wrap( + env, contextObj, workContext, + [](napi_env, void *data, void *) { + TAG_LOGD(AAFwkTag::UI_EXT, "Finalizer called"); + if (data == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr"); + return; + } + delete static_cast *>(data); + }, + nullptr, nullptr); + if (status != napi_ok && workContext != nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "napi_wrap Failed: %{public}d", status); + delete workContext; + return nullptr; + } + + return contextObj; +} + +JsFormEditExtensionImpl::JsFormEditExtensionImpl(const std::unique_ptr &runtime) + : JsUIExtensionBase(runtime) +{} + +void JsFormEditExtensionImpl::BindContext() +{ + HandleScope handleScope(jsRuntime_); + if (jsObj_ == nullptr) { + return; + } + napi_env env = jsRuntime_.GetNapiEnv(); + napi_value obj = jsObj_->GetNapiValue(); + if (!CheckTypeForNapiValue(env, obj, napi_object)) { + TAG_LOGE(AAFwkTag::UI_EXT, "obj is not object"); + return; + } + if (context_ == nullptr) { + return; + } + napi_value contextObj = JsFormEditExtensionContext::CreateJsFormEditExtensionContext(env, context_); + if (contextObj == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Create js ui extension context error"); + return; + } + shellContextRef_ = + JsRuntime::LoadSystemModuleByEngine(env, "application.FormEditExtensionContext", &contextObj, ARGC_ONE); + if (shellContextRef_ == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get loadSystemModuleByEngine"); + return; + } + contextObj = shellContextRef_->GetNapiValue(); + if (!CheckTypeForNapiValue(env, contextObj, napi_object)) { + TAG_LOGE(AAFwkTag::UI_EXT, "Fail to get context native object"); + return; + } + auto workContext = new (std::nothrow) std::shared_ptr(context_); + napi_coerce_to_native_binding_object(env, contextObj, DetachCallbackFunc, AttachUIExtensionContext, workContext, + nullptr); + context_->Bind(jsRuntime_, shellContextRef_.get()); + napi_set_named_property(env, obj, "context", contextObj); + napi_status status = napi_wrap(env, contextObj, workContext, + [](napi_env, void *data, void *) { + if (data == nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "Finalizer for weak_ptr is nullptr"); + return; + } + delete static_cast *>(data); + }, nullptr, nullptr); + if (status != napi_ok && workContext != nullptr) { + TAG_LOGE(AAFwkTag::UI_EXT, "napi_wrap Failed: %{public}d", status); + delete workContext; + return; + } +} + +} // namespace AbilityRuntime +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.h b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..70668dcf8615bb0fc7190ea3488ae19a6a4e6365 --- /dev/null +++ b/frameworks/js/napi/form_edit_extension_context/js_form_edit_extension_impl.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_IMPL_H +#define OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_IMPL_H + +#include "js_ui_extension_base.h" +#include "../form_edit_extension_context/form_edit_extension_context.h" +#include + +namespace OHOS { +namespace AbilityRuntime { + +class FormEditExtensionContext; + +class JsFormEditExtensionImpl : public JsUIExtensionBase { +public: + explicit JsFormEditExtensionImpl(const std::unique_ptr &runtime); + virtual ~JsFormEditExtensionImpl() override = default; + + void SetContext(const std::shared_ptr &context) + { + context_ = context; + JsUIExtensionBase::SetContext(context); + } + +protected: + void BindContext() override; + +protected: + std::shared_ptr context_ = nullptr; + std::set uiExtensionComponentIdSet_; + +private: + using JsUIExtensionBase::SetContext; +}; +} // namespace AbilityRuntime +} // namespace OHOS + +#endif // OHOS_ABILITY_RUNTIME_JS_PHOTO_EDITOR_EXTENSION_IMPL_H \ No newline at end of file diff --git a/interfaces/inner_api/include/form_constants.h b/interfaces/inner_api/include/form_constants.h index 0a53c66607aa41c8745f0f8e8ca44752529d4e90..1072aa01a65443aebaa80df6dc3223b29515176f 100644 --- a/interfaces/inner_api/include/form_constants.h +++ b/interfaces/inner_api/include/form_constants.h @@ -67,6 +67,16 @@ namespace Constants { constexpr const char* LOCAL_CODE_PATH = "/data/storage/el1/bundle"; constexpr const char* LOCAL_BUNDLES = "/data/bundles"; constexpr const char* FORM_PUBLISH_ACTION = "action.form.publish"; + constexpr const char* FORM_PAGE_ACTION = "action.form.page"; + constexpr const char* OPEN_FORM_MANAGE_VIEW = "openFormManageView"; + constexpr const char* OPEN_FORM_MANAGE_VIEW_ACTION = "action.form.openFormManageView"; + constexpr int32_t PAGE_ROUTER_SERVICE_CODE_FORM_MANAGE = 1; + constexpr int32_t PAGE_ROUTER_SERVICE_CODE_CONTROL_CENTER = 2; + constexpr int32_t PAGE_ROUTER_SERVICE_CODE_FORM_EDIT = 3; + constexpr const char* PARMA_REQUEST_METHOD = "requestMehod"; + constexpr const char* PARMA_OPEN_FORM_EDIT_SEC_PAGE_VIEW = "openFormEditSecPageView"; + constexpr const char* PARAM_PAGE_ROUTER_SERVICE_CODE = "pageRouterServiceCode"; + constexpr const char* PARAM_SEC_PAGE_ABILITY_NAME = "secPageAbilityName"; constexpr const char* PARAM_DEVICE_ID_KEY = "ohos.extra.param.key.device_id"; constexpr const char* PARAM_FORM_HOST_TOKEN = "ohos.extra.param.form.host.token"; constexpr const char* PARAM_PUBLISH_FORM_HOST_BUNDLE_KEY = "ohos.extra.param.key.form_host_bundle_name";