From 7e5514a15411302d0684d19e104f0a63a8ad9b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 16:49:38 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E7=BC=96=E8=BE=91=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- frameworks/js/napi/form_provider/js_form_provider.cpp | 1 + frameworks/js/napi/form_provider/js_form_provider.h | 1 + frameworks/js/napi/form_provider/native_module.cpp | 1 + interfaces/inner_api/include/form_constants.h | 1 + interfaces/inner_api/include/form_mgr_interface.h | 1 + interfaces/inner_api/include/form_mgr_proxy.h | 1 + interfaces/inner_api/include/form_mgr_stub.h | 1 + interfaces/inner_api/src/form_mgr_proxy.cpp | 1 + interfaces/inner_api/src/form_mgr_stub.cpp | 1 + interfaces/kits/native/include/form_mgr.h | 1 + interfaces/kits/native/src/form_mgr.cpp | 1 + services/include/form_mgr_service.h | 1 + services/src/form_mgr_service.cpp | 1 + 13 files changed, 13 insertions(+) diff --git a/frameworks/js/napi/form_provider/js_form_provider.cpp b/frameworks/js/napi/form_provider/js_form_provider.cpp index cb02efa4fc..292b092b46 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.cpp +++ b/frameworks/js/napi/form_provider/js_form_provider.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/frameworks/js/napi/form_provider/js_form_provider.h b/frameworks/js/napi/form_provider/js_form_provider.h index db2991b89d..c5ac111020 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.h +++ b/frameworks/js/napi/form_provider/js_form_provider.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/frameworks/js/napi/form_provider/native_module.cpp b/frameworks/js/napi/form_provider/native_module.cpp index 66f10bcfcd..a3b0ade03d 100644 --- a/frameworks/js/napi/form_provider/native_module.cpp +++ b/frameworks/js/napi/form_provider/native_module.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/include/form_constants.h b/interfaces/inner_api/include/form_constants.h index 4b7e83768c..34013be99b 100644 --- a/interfaces/inner_api/include/form_constants.h +++ b/interfaces/inner_api/include/form_constants.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/include/form_mgr_interface.h b/interfaces/inner_api/include/form_mgr_interface.h index b28610280b..1dd6e1fc6c 100644 --- a/interfaces/inner_api/include/form_mgr_interface.h +++ b/interfaces/inner_api/include/form_mgr_interface.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/include/form_mgr_proxy.h b/interfaces/inner_api/include/form_mgr_proxy.h index d5fe8aca32..85faa18c65 100644 --- a/interfaces/inner_api/include/form_mgr_proxy.h +++ b/interfaces/inner_api/include/form_mgr_proxy.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index 7c7efe5a99..1dae9e9bb3 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/src/form_mgr_proxy.cpp b/interfaces/inner_api/src/form_mgr_proxy.cpp index 71eeccdc13..23415b838c 100644 --- a/interfaces/inner_api/src/form_mgr_proxy.cpp +++ b/interfaces/inner_api/src/form_mgr_proxy.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/inner_api/src/form_mgr_stub.cpp b/interfaces/inner_api/src/form_mgr_stub.cpp index d9d92e088a..7c60f1f2a4 100644 --- a/interfaces/inner_api/src/form_mgr_stub.cpp +++ b/interfaces/inner_api/src/form_mgr_stub.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/kits/native/include/form_mgr.h b/interfaces/kits/native/include/form_mgr.h index d01bb62a02..59b10f1ad0 100644 --- a/interfaces/kits/native/include/form_mgr.h +++ b/interfaces/kits/native/include/form_mgr.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/interfaces/kits/native/src/form_mgr.cpp b/interfaces/kits/native/src/form_mgr.cpp index 0c46770f68..0aaa292b67 100644 --- a/interfaces/kits/native/src/form_mgr.cpp +++ b/interfaces/kits/native/src/form_mgr.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/services/include/form_mgr_service.h b/services/include/form_mgr_service.h index 9e9af0223c..d55fed9df2 100644 --- a/services/include/form_mgr_service.h +++ b/services/include/form_mgr_service.h @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/services/src/form_mgr_service.cpp b/services/src/form_mgr_service.cpp index 98eb051f47..cb65c8d46e 100644 --- a/services/src/form_mgr_service.cpp +++ b/services/src/form_mgr_service.cpp @@ -1,3 +1,4 @@ +1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); -- Gitee From f9b87ebd79c417b9ea711ea3699315333d25f9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:01:29 +0000 Subject: [PATCH 02/26] update frameworks/js/napi/form_provider/js_form_provider.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- .../napi/form_provider/js_form_provider.cpp | 80 +++++++++++++++---- 1 file changed, 63 insertions(+), 17 deletions(-) diff --git a/frameworks/js/napi/form_provider/js_form_provider.cpp b/frameworks/js/napi/form_provider/js_form_provider.cpp index 292b092b46..9c7be37562 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.cpp +++ b/frameworks/js/napi/form_provider/js_form_provider.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,7 +58,7 @@ bool CheckParamNum(napi_env env, size_t argc, size_t minParamNum, size_t maxPara return true; } -bool ConvertFormInfoFilterThrow(napi_env env, napi_value jsValue, AppExecFwk::FormInfoFilter &formInfoFilter) +static bool ConvertFormInfoFilterThrow(napi_env env, napi_value jsValue, AppExecFwk::FormInfoFilter &formInfoFilter) { napi_valuetype jsValueType = napi_undefined; napi_typeof(env, jsValue, &jsValueType); @@ -89,6 +88,26 @@ bool ConvertFormInfoFilterThrow(napi_env env, napi_value jsValue, AppExecFwk::Fo return true; } + +static bool ConvertFromId(napi_env env, napi_value jsValue, int64_t &formId) +{ + std::string strFormId; + if (!ConvertFromJsValue(env, jsValue, strFormId)) { + HILOG_ERROR("convert strFormId failed"); + return false; + } + + if (strFormId.empty()) { + HILOG_ERROR("empty strFormId"); + return false; + } + + if (!ConvertStringToInt64(strFormId, formId)) { + HILOG_ERROR("convert string formId to int64 failed"); + return false; + } + return true; +} } static std::string GetStringByProp(napi_env env, napi_value value, const std::string &prop) @@ -412,21 +431,7 @@ napi_value JsFormProvider::OnUpdateFormParseParam(napi_env env, size_t argc, nap if (CheckParamNum(env, argc, ARGS_SIZE_TWO, ARGS_SIZE_THREE) == false) { return CreateJsUndefined(env); } - napi_valuetype paramZeroType = napi_undefined; - napi_typeof(env, argv[PARAM0], ¶mZeroType); - if (paramZeroType != napi_string) { - HILOG_ERROR("formId not napi_string"); - NapiFormUtil::ThrowParamTypeError(env, "formId", "string"); - return CreateJsUndefined(env); - } - std::string strFormId; - bool confirm = ConvertFromJsValue(env, argv[PARAM0], strFormId); - if (!confirm) { - HILOG_ERROR("ConvertFromJsValue failed"); - NapiFormUtil::ThrowParamTypeError(env, "formId", "string"); - return CreateJsUndefined(env); - } - if (!ConvertStringToInt64(strFormId, formId)) { + if (!ConvertFromId(env, argv[PARAM0], formId)) { HILOG_ERROR("convert form string failed"); NapiFormUtil::ThrowParamError(env, "Failed to convert formId."); return CreateJsUndefined(env); @@ -640,5 +645,46 @@ bool JsFormProvider::ConvertFormDataProxy(napi_env env, napi_value value, formDataProxy.subscribeId.c_str()); return true; } + +napi_value JsFormProvider::OpenFormEditAbility(napi_env env, napi_callback_info info) +{ + GET_CB_INFO_AND_CALL(env, info, JsFormProvider, OnOpenFormEditAbility); +} + +napi_value JsFormProvider::OnOpenFormEditAbility(napi_env env, size_t argc, napi_value* argv) +{ + HILOG_DEBUG("call"); + if (!CheckParamNum(env, argc, ARGS_SIZE_TWO, ARGS_SIZE_THREE)) { + NapiFormUtil::ThrowParamNumError(env, std::to_string(argc), "2 or 3"); + return CreateJsUndefined(env); + } + std::string abilityName; + if (!ConvertFromJsValue(env, argv[PARAM0], abilityName)) { + HILOG_ERROR("ConvertFromJsValue failed"); + NapiFormUtil::ThrowParamTypeError(env, "abilityName", "string"); + return CreateJsUndefined(env); + } + + int64_t formId = 0; + if (!ConvertFromId(env, argv[PARAM1], formId)) { + HILOG_ERROR("ConvertFromJsValue"); + NapiFormUtil::ThrowParamTypeError(env, "formId", "string"); + return CreateJsUndefined(env); + } + + bool isMainPage = true; + if (argc == ARGS_SIZE_THREE) { + if (!ConvertFromJsValue(env, argv[PARAM2], isMainPage)) { + isMainPage = true; + } + } + HILOG_INFO("OnOpenFormEditAbility abilityName: %{public}s, formId: %{public}" PRId64 "isMainPage: %{public}s", + abilityName.c_str(), formId, isMainPage ? "true" : "false"); + auto ret = FormMgr::GetInstance().OpenFormEditAbility(abilityName, formId, isMainPage); + if (ret != ERR_OK) { + NapiFormUtil::ThrowByInternalErrorCode(env, ret); + } + return CreateJsUndefined(env); +} } // namespace AbilityRuntime } // namespace OHOS -- Gitee From 14338da9ac59e7b4a37bb59deb527dff7074be03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:03:41 +0000 Subject: [PATCH 03/26] update frameworks/js/napi/form_provider/js_form_provider.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- frameworks/js/napi/form_provider/js_form_provider.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frameworks/js/napi/form_provider/js_form_provider.h b/frameworks/js/napi/form_provider/js_form_provider.h index c5ac111020..84ba1164ec 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.h +++ b/frameworks/js/napi/form_provider/js_form_provider.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,6 +70,7 @@ public: static napi_value GetPublishedFormInfoById(napi_env env, napi_callback_info info); static napi_value GetPublishedFormInfos(napi_env env, napi_callback_info info); static napi_value OpenFormManager(napi_env env, napi_callback_info info); + static napi_value OpenFormEditAbility(napi_env env, napi_callback_info info); private: napi_value OnGetFormsInfo(napi_env env, size_t argc, napi_value* argv); napi_value OnGetPublishedFormInfoById(napi_env env, size_t argc, napi_value* argv); @@ -87,6 +87,7 @@ private: bool OnGetFormsInfoParseParam(NapiParamPackage &napiParam, size_t &convertArgc, bool &isPromise, AppExecFwk::FormInfoFilter &formInfoFilter); napi_value OnUpdateFormParseParam(napi_env env, size_t argc, napi_value* argv, int64_t &formId); + napi_value OnOpenFormEditAbility(napi_env env, size_t argc, napi_value* argv); }; } // namespace AbilityRuntime } // namespace OHOS -- Gitee From 82043b87dc04989a3fafca23e5cf270f5d3d2be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:12:01 +0000 Subject: [PATCH 04/26] update frameworks/js/napi/form_provider/native_module.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- frameworks/js/napi/form_provider/native_module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/form_provider/native_module.cpp b/frameworks/js/napi/form_provider/native_module.cpp index a3b0ade03d..c1753fc308 100644 --- a/frameworks/js/napi/form_provider/native_module.cpp +++ b/frameworks/js/napi/form_provider/native_module.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,6 +39,7 @@ static napi_value JsProviderInit(napi_env env, napi_value exports) BindNativeFunction(env, exports, "requestPublishForm", moduleName, JsFormProvider::RequestPublishForm); BindNativeFunction(env, exports, "isRequestPublishFormSupported", moduleName, JsFormProvider::IsRequestPublishFormSupported); + BindNativeFunction(env, exports, "openFormEditAbility", moduleName, JsFormProvider::OpenFormEditAbility); return exports; } -- Gitee From 8be9f31579451ac9b04368218a5078fd111e37d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:13:01 +0000 Subject: [PATCH 05/26] update interfaces/inner_api/include/form_constants.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_constants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_api/include/form_constants.h b/interfaces/inner_api/include/form_constants.h index 34013be99b..00ff067607 100644 --- a/interfaces/inner_api/include/form_constants.h +++ b/interfaces/inner_api/include/form_constants.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,6 +73,7 @@ namespace Constants { 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 = "requestMethod"; + constexpr const char* PARMA_OPEN_FORM_EDIT_VIEW = "openFormEditView"; 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"; -- Gitee From 1557b82b58a6dcc6bd7c3bdd5680c336781293cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:14:25 +0000 Subject: [PATCH 06/26] update interfaces/inner_api/include/form_mgr_interface.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_interface.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/include/form_mgr_interface.h b/interfaces/inner_api/include/form_mgr_interface.h index 1dd6e1fc6c..ea3abc3b3b 100644 --- a/interfaces/inner_api/include/form_mgr_interface.h +++ b/interfaces/inner_api/include/form_mgr_interface.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -753,6 +752,18 @@ public: return ERR_OK; } + /** + * @brief Open the form edit ability. + * @param abilityName The form edit ability name. + * @param formId The edit form ID. + * @param isMainPage Open the main edit page. + * @return Returns ERR_OK on success, others on failure. + */ + virtual ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) + { + return ERR_OK; + } + enum class Message { // ipc id 1-1000 for kit // ipc id 1001-2000 for DMS @@ -843,6 +854,7 @@ public: FORM_MGR_START_ABILITY_BY_FMS, FORM_MGR_GET_PUBLISHED_FORM_INFOS, FORM_MGR_GET_PUBLISHED_FORM_INFO_BY_ID, + FORM_MGR_OPEN_FORM_EDIT_ABILITY }; }; } // namespace AppExecFwk -- Gitee From 474b93cc6d9d21356e6ebc26dec41988a1ae0462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:15:40 +0000 Subject: [PATCH 07/26] update interfaces/inner_api/include/form_mgr_proxy.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_proxy.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/include/form_mgr_proxy.h b/interfaces/inner_api/include/form_mgr_proxy.h index 85faa18c65..229b5e249f 100644 --- a/interfaces/inner_api/include/form_mgr_proxy.h +++ b/interfaces/inner_api/include/form_mgr_proxy.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -670,6 +669,16 @@ public: * @return Returns ERR_OK on success, others on failure. */ ErrCode UpdateFormSize(const int64_t &formId, float width, float height, float borderWidth) override; + + /** + * @brief Open the form edit ability. + * @param abilityName The form edit ability name. + * @param formId The edit form ID. + * @param isMainPage Open the main edit page. + * @return Returns ERR_OK on success, others on failure. + */ + ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) override; + private: template int GetParcelableInfos(MessageParcel &reply, std::vector &parcelableInfos); -- Gitee From b33c3391643324ba2b1c5374e35d5bf710860de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:17:47 +0000 Subject: [PATCH 08/26] update interfaces/inner_api/include/form_mgr_stub.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_stub.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index 1dae9e9bb3..09094011e6 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -656,6 +656,14 @@ private: * @return Returns ERR_OK on success, others on failure. */ ErrCode HandleUpdateFormSize(MessageParcel &data, MessageParcel &reply); + + /** + * @brief Handle open form edit ability. + * @param data input param. + * @param reply output param. + * @return Returns ERR_OK on success, others on failure. + */ + ErrCode HandleOpenFormEditAbility(MessageParcel &data, MessageParcel &reply); private: DISALLOW_COPY_AND_MOVE(FormMgrStub); -- Gitee From 6851773c16234868d6dda1492c99f3babac52210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:18:17 +0000 Subject: [PATCH 09/26] update interfaces/inner_api/include/form_mgr_stub.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_stub.h | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index 09094011e6..41ad1f09c4 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); -- Gitee From 808c98f23efa62d31f30c3d9ff64a105fe868afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:19:40 +0000 Subject: [PATCH 10/26] update interfaces/inner_api/src/form_mgr_proxy.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/src/form_mgr_proxy.cpp | 32 ++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/src/form_mgr_proxy.cpp b/interfaces/inner_api/src/form_mgr_proxy.cpp index 23415b838c..3fe858769e 100644 --- a/interfaces/inner_api/src/form_mgr_proxy.cpp +++ b/interfaces/inner_api/src/form_mgr_proxy.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2631,5 +2630,36 @@ ErrCode FormMgrProxy::UpdateFormSize(const int64_t &formId, float width, float h } return reply.ReadInt32(); } + +ErrCode FormMgrProxy::OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) +{ + HILOG_DEBUG("start"); + MessageParcel data; + if (!WriteInterfaceToken(data)) { + HILOG_ERROR("write interface token failed"); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + if (!data.WriteString(abilityName)) { + HILOG_ERROR("fail write abilityName "); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + if (!data.WriteInt64(formId)) { + HILOG_ERROR("fail write formId "); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + if (!data.WriteBool(isMainPage)) { + HILOG_ERROR("fail write isMainPage "); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + + MessageParcel reply; + MessageOption option(MessageOption::TF_SYNC); + int32_t error = SendTransactCmd(IFormMgr::Message::FORM_MGR_OPEN_FORM_EDIT_ABILITY, data, reply, option); + if (error != ERR_OK) { + HILOG_ERROR("SendTransactCmd:%{public}d failed", error); + return error; + } + return reply.ReadInt32(); +} } // namespace AppExecFwk } // namespace OHOS -- Gitee From 5aabfa83d8718d07b2110c12d3f14c0d0fe3a531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:21:04 +0000 Subject: [PATCH 11/26] update interfaces/inner_api/src/form_mgr_stub.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/src/form_mgr_stub.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/src/form_mgr_stub.cpp b/interfaces/inner_api/src/form_mgr_stub.cpp index 7c60f1f2a4..b851b1865e 100644 --- a/interfaces/inner_api/src/form_mgr_stub.cpp +++ b/interfaces/inner_api/src/form_mgr_stub.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -273,6 +272,8 @@ int FormMgrStub::OnRemoteRequestFourth(uint32_t code, MessageParcel &data, Messa return HandleUpdateFormSize(data, reply); case static_cast(IFormMgr::Message::FORM_MGR_LOCK_FORMS): return HandleLockForms(data, reply); + case static_cast(IFormMgr::Message::FORM_MGR_OPEN_FORM_EDIT_ABILITY): + return HandleOpenFormEditAbility(data, reply); default: return OnRemoteRequestFifth(code, data, reply, option); } @@ -1796,5 +1797,19 @@ ErrCode FormMgrStub::HandleUpdateFormSize(MessageParcel &data, MessageParcel &re } return result; } + +ErrCode FormMgrStub::HandleOpenFormEditAbility(MessageParcel &data, MessageParcel &reply) +{ + HILOG_DEBUG("call"); + std::string abilityName = data.ReadString(); + int64_t formId = data.ReadInt64(); + bool isMainPage = data.ReadBool(); + ErrCode result = OpenFormEditAbility(abilityName, formId, isMainPage); + if (!reply.WriteInt32(result)) { + HILOG_ERROR("write result failed"); + return ERR_APPEXECFWK_PARCEL_ERROR; + } + return result; +} } // namespace AppExecFwk } // namespace OHOS \ No newline at end of file -- Gitee From ca6e0ef50c4a306b29531805e693485bbef32296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:21:57 +0000 Subject: [PATCH 12/26] update interfaces/kits/native/include/form_mgr.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/kits/native/include/form_mgr.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/native/include/form_mgr.h b/interfaces/kits/native/include/form_mgr.h index 59b10f1ad0..d119f7551d 100644 --- a/interfaces/kits/native/include/form_mgr.h +++ b/interfaces/kits/native/include/form_mgr.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -725,6 +724,15 @@ public: * @return Returns ERR_OK on success, others on failure. */ int32_t UpdateFormSize(const int64_t formId, float width, float height, float borderWidth); + + /** + * @brief Open the form edit ability. + * @param abilityName The form edit ability name. + * @param formId The edit form ID. + * @param isMainPage Open the main edit page. + * @return Returns ERR_OK on success, others on failure. + */ + ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage); private: /** * @brief Connect form manager service. -- Gitee From b4ecd74d92a04dfb226975280ca6b1c38d6e1376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:22:41 +0000 Subject: [PATCH 13/26] update interfaces/kits/native/src/form_mgr.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/kits/native/src/form_mgr.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/native/src/form_mgr.cpp b/interfaces/kits/native/src/form_mgr.cpp index 0aaa292b67..c9545e555e 100644 --- a/interfaces/kits/native/src/form_mgr.cpp +++ b/interfaces/kits/native/src/form_mgr.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2003,5 +2002,24 @@ int32_t FormMgr::NotifyFormLocked(const int64_t &formId, bool isLocked) return resultCode; } +ErrCode FormMgr::OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) +{ + HILOG_INFO("abilityName: %{public}s, formId: %{public}" PRId64 ", isMainPage: %{public}s", + abilityName.c_str(), formId, isMainPage ? "true" : "false"); + ErrCode resultCode = Connect(); + if (resultCode != ERR_OK) { + return resultCode; + } + std::shared_lock lock(connectMutex_); + if (remoteProxy_ == nullptr) { + HILOG_ERROR("null remoteProxy_"); + return ERR_APPEXECFWK_FORM_COMMON_CODE; + } + resultCode = remoteProxy_->OpenFormEditAbility(abilityName, formId, isMainPage); + if (resultCode != ERR_OK) { + HILOG_ERROR("fail OpenFormEditAbility,errCode %{public}d", resultCode); + } + return resultCode; +} } // namespace AppExecFwk } // namespace OHOS -- Gitee From 825f67b0ddd2d5176919a0e00e79515f2dcecb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:23:47 +0000 Subject: [PATCH 14/26] update services/include/form_mgr_service.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- services/include/form_mgr_service.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/include/form_mgr_service.h b/services/include/form_mgr_service.h index d55fed9df2..e91a0cc1ae 100644 --- a/services/include/form_mgr_service.h +++ b/services/include/form_mgr_service.h @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -727,6 +726,14 @@ public: void SubscribeNetConn(); + /** + * @brief Handle open form edit ability. + * @param data input param. + * @param reply output param. + * @return Returns ERR_OK on success, others on failure. + */ + ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) override; + friend class NetConnCallbackObserver; private: /** -- Gitee From b4df5b5aeef3ce026c4fc3745fb0f04db26a5665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 09:25:31 +0000 Subject: [PATCH 15/26] update services/src/form_mgr_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- services/src/form_mgr_service.cpp | 60 ++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/services/src/form_mgr_service.cpp b/services/src/form_mgr_service.cpp index cb65c8d46e..c6b520d33c 100644 --- a/services/src/form_mgr_service.cpp +++ b/services/src/form_mgr_service.cpp @@ -1,4 +1,3 @@ -1 /* * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -65,6 +64,9 @@ #include "net_handle.h" #include "form_bundle_lock_mgr.h" #include "form_exempt_lock_mgr.h" +#include "string_wrapper.h" +#include "int_wrapper.h" +#include "want_params_wrapper.h" #ifdef MEM_MGR_ENABLE #include "mem_mgr_client.h" #endif @@ -1964,5 +1966,61 @@ void FormMgrService::SetDisConnectTypeTime() lastNetLostTime_ = FormUtil::GetCurrentMillisecond(); } +ErrCode FormMgrService::OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) +{ + int uid = IPCSkeleton::GetCallingUid(); + std::string callerName; + ErrCode ret = FormBmsHelper::GetInstance().GetBundleNameByUid(uid, callerName); + if (ret != ERR_OK) { + HILOG_ERROR("Get bundleName by uid failed"); + return ret; + } + + RunningFormInfo runningFormInfo; + ret = FormDataMgr::GetInstance().GetRunningFormInfosByFormId(formId, runningFormInfo); + if (ret != ERR_OK) { + HILOG_ERROR("Get form instance by id failed"); + return ret; + } + HILOG_INFO("callerName: %{public}s, hostBundleName: %{public}s uid: %{public}d, formVisiblity: %{public}s", + callerName.c_str(), runningFormInfo.hostBundleName.c_str(), uid, + runningFormInfo.formVisiblity == FormVisibilityType::VISIBLE ? "true" : "false"); + + if (runningFormInfo.bundleName != callerName) { + HILOG_ERROR("check bundleName fialed"); + return ERR_APPEXECFWK_FORM_OPERATION_NOT_SELF; + } + + if (runningFormInfo.formVisiblity != FormVisibilityType::VISIBLE) { + HILOG_ERROR("check form visibility fialed"); + return ERR_APPEXECFWK_FORM_NOT_TRUST; + } + + WantParams wantarams; + if (isMainPage) { + WantParams formInfoParam; + formInfoParam.SetParam("bundleName", String::Box(runningFormInfo.bundleName)); + formInfoParam.SetParam("abilityName", String::Box(runningFormInfo.abilityName)); + formInfoParam.SetParam("moduleName", String::Box(runningFormInfo.moduleName)); + formInfoParam.SetParam("cardDimension", Integer::Box(runningFormInfo.dimension)); + formInfoParam.SetParam("cardName", String::Box(runningFormInfo.formName)); + formInfoParam.SetParam("cardId", String::Box(std::to_string(formId))); + formInfoParam.SetParam("formConfigAbility", String::Box(abilityName)); + wantarams.SetParam("formInfo", WantParamWrapper::Box(formInfoParam)); + wantarams.SetParam(Constants::PARMA_REQUEST_METHOD, String::Box(Constants::PARMA_OPEN_FORM_EDIT_VIEW)); + } else { + wantarams.SetParam(Constants::PARMA_REQUEST_METHOD, String::Box(Constants::PARMA_OPEN_FORM_EDIT_SEC_PAGE_VIEW)); + wantarams.SetParam(Constants::PARAM_SEC_PAGE_ABILITY_NAME, String::Box(abilityName)); + } + wantarams.SetParam(Constants::PARAM_PAGE_ROUTER_SERVICE_CODE, + Integer::Box(Constants::PAGE_ROUTER_SERVICE_CODE_FORM_EDIT)); + + Want want; + want.SetAction(Constants::FORM_PAGE_ACTION); + want.SetElementName(callerName, abilityName); + want.SetParams(wantarams); + HILOG_WARN("StartAbility want:%{public}s", want.ToString().c_str()); + return FormMgrAdapter::GetInstance().StartAbilityByFms(want); +} } // namespace AppExecFwk } // namespace OHOS -- Gitee From b09405a3ed265fca02e6bf16a3be93d9c5c88b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 11:16:28 +0000 Subject: [PATCH 16/26] update services/include/form_mgr_service.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- services/include/form_mgr_service.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/include/form_mgr_service.h b/services/include/form_mgr_service.h index e91a0cc1ae..467c0f9d02 100644 --- a/services/include/form_mgr_service.h +++ b/services/include/form_mgr_service.h @@ -728,8 +728,9 @@ public: /** * @brief Handle open form edit ability. - * @param data input param. - * @param reply output param. + * @param abilityName The form edit ability name. + * @param formId The edit form ID. + * @param isMainPage Open the main edit page. * @return Returns ERR_OK on success, others on failure. */ ErrCode OpenFormEditAbility(const std::string &abilityName, const int64_t &formId, bool isMainPage) override; -- Gitee From 4279a258a60ff6d0cf9e75551a2d0e6b1417d78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 11:17:37 +0000 Subject: [PATCH 17/26] update services/src/form_mgr_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- services/src/form_mgr_service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/form_mgr_service.cpp b/services/src/form_mgr_service.cpp index c6b520d33c..2cf7b7bc16 100644 --- a/services/src/form_mgr_service.cpp +++ b/services/src/form_mgr_service.cpp @@ -1979,7 +1979,7 @@ ErrCode FormMgrService::OpenFormEditAbility(const std::string &abilityName, cons RunningFormInfo runningFormInfo; ret = FormDataMgr::GetInstance().GetRunningFormInfosByFormId(formId, runningFormInfo); if (ret != ERR_OK) { - HILOG_ERROR("Get form instance by id failed"); + HILOG_ERROR("Get running form info by id failed"); return ret; } HILOG_INFO("callerName: %{public}s, hostBundleName: %{public}s uid: %{public}d, formVisiblity: %{public}s", -- Gitee From e62460bad9752520575262547c67f67fc7da46e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 11:18:28 +0000 Subject: [PATCH 18/26] update frameworks/js/napi/form_provider/js_form_provider.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- frameworks/js/napi/form_provider/js_form_provider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/form_provider/js_form_provider.cpp b/frameworks/js/napi/form_provider/js_form_provider.cpp index 9c7be37562..18bd39d53a 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.cpp +++ b/frameworks/js/napi/form_provider/js_form_provider.cpp @@ -89,7 +89,7 @@ static bool ConvertFormInfoFilterThrow(napi_env env, napi_value jsValue, AppExec return true; } -static bool ConvertFromId(napi_env env, napi_value jsValue, int64_t &formId) +static bool ConvertFormId(napi_env env, napi_value jsValue, int64_t &formId) { std::string strFormId; if (!ConvertFromJsValue(env, jsValue, strFormId)) { @@ -431,7 +431,7 @@ napi_value JsFormProvider::OnUpdateFormParseParam(napi_env env, size_t argc, nap if (CheckParamNum(env, argc, ARGS_SIZE_TWO, ARGS_SIZE_THREE) == false) { return CreateJsUndefined(env); } - if (!ConvertFromId(env, argv[PARAM0], formId)) { + if (!ConvertFormId(env, argv[PARAM0], formId)) { HILOG_ERROR("convert form string failed"); NapiFormUtil::ThrowParamError(env, "Failed to convert formId."); return CreateJsUndefined(env); -- Gitee From 0fe661cb3449a1e189fdb56509ccdb256fa4c471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 11:56:23 +0000 Subject: [PATCH 19/26] update services/src/form_mgr_service.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- services/src/form_mgr_service.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/services/src/form_mgr_service.cpp b/services/src/form_mgr_service.cpp index 2cf7b7bc16..edb3a05c8a 100644 --- a/services/src/form_mgr_service.cpp +++ b/services/src/form_mgr_service.cpp @@ -1982,9 +1982,6 @@ ErrCode FormMgrService::OpenFormEditAbility(const std::string &abilityName, cons HILOG_ERROR("Get running form info by id failed"); return ret; } - HILOG_INFO("callerName: %{public}s, hostBundleName: %{public}s uid: %{public}d, formVisiblity: %{public}s", - callerName.c_str(), runningFormInfo.hostBundleName.c_str(), uid, - runningFormInfo.formVisiblity == FormVisibilityType::VISIBLE ? "true" : "false"); if (runningFormInfo.bundleName != callerName) { HILOG_ERROR("check bundleName fialed"); @@ -2019,7 +2016,6 @@ ErrCode FormMgrService::OpenFormEditAbility(const std::string &abilityName, cons want.SetAction(Constants::FORM_PAGE_ACTION); want.SetElementName(callerName, abilityName); want.SetParams(wantarams); - HILOG_WARN("StartAbility want:%{public}s", want.ToString().c_str()); return FormMgrAdapter::GetInstance().StartAbilityByFms(want); } } // namespace AppExecFwk -- Gitee From 64f5541815cd37700da4ddefd01ea11d37d46eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 12:21:20 +0000 Subject: [PATCH 20/26] update frameworks/js/napi/form_provider/js_form_provider.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- frameworks/js/napi/form_provider/js_form_provider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/form_provider/js_form_provider.cpp b/frameworks/js/napi/form_provider/js_form_provider.cpp index 18bd39d53a..f24eaffa34 100644 --- a/frameworks/js/napi/form_provider/js_form_provider.cpp +++ b/frameworks/js/napi/form_provider/js_form_provider.cpp @@ -666,7 +666,7 @@ napi_value JsFormProvider::OnOpenFormEditAbility(napi_env env, size_t argc, napi } int64_t formId = 0; - if (!ConvertFromId(env, argv[PARAM1], formId)) { + if (!ConvertFormId(env, argv[PARAM1], formId)) { HILOG_ERROR("ConvertFromJsValue"); NapiFormUtil::ThrowParamTypeError(env, "formId", "string"); return CreateJsUndefined(env); -- Gitee From 2f1ddbcfc8891bbfa2ce1de87a4f1d46d1f45c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:22:31 +0000 Subject: [PATCH 21/26] update interfaces/inner_api/src/form_mgr_stub.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/src/form_mgr_stub.cpp | 91 +++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/src/form_mgr_stub.cpp b/interfaces/inner_api/src/form_mgr_stub.cpp index b851b1865e..88582d0f36 100644 --- a/interfaces/inner_api/src/form_mgr_stub.cpp +++ b/interfaces/inner_api/src/form_mgr_stub.cpp @@ -27,6 +27,9 @@ namespace OHOS { namespace AppExecFwk { +#define BIND_REQUEST_FUNC(msgId, func) \ + { IFormMgr::Message::msgId, std::bind(&FormMgrStub::func, this, std::placeholders::_1, std::placeholders::_2) } +using RemoteRequestFunction = std::function; const int32_t LIMIT_PARCEL_SIZE = 1024; constexpr size_t MAX_PARCEL_CAPACITY = 4 * 1024 * 1024; // 4M static constexpr int32_t MAX_ALLOW_SIZE = 8 * 1024; @@ -50,6 +53,86 @@ FormMgrStub::FormMgrStub() FormMgrStub::~FormMgrStub() {} +std::map FormMgrStub::RequestFuncMap() +{ + const static std::map requestFuncMap = { + BIND_REQUEST_FUNC(FORM_MGR_ADD_FORM, HandleAddForm), + BIND_REQUEST_FUNC(FORM_MGR_DELETE_FORM, HandleDeleteForm), + BIND_REQUEST_FUNC(FORM_MGR_RELEASE_FORM, HandleReleaseForm), + BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM, HandleUpdateForm), + BIND_REQUEST_FUNC(FORM_MGR_REQUEST_FORM, HandleRequestForm), + BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORM_WHETHER_VISIBLE, HandleNotifyWhetherVisibleForms), + BIND_REQUEST_FUNC(FORM_MGR_CAST_TEMP_FORM, HandleCastTempForm), + BIND_REQUEST_FUNC(FORM_MGR_STORAGE_FORM_INFOS, HandleDumpStorageFormInfos), + BIND_REQUEST_FUNC(FORM_MGR_FORM_INFOS_BY_NAME, HandleDumpFormInfoByBundleName), + BIND_REQUEST_FUNC(FORM_MGR_FORM_INFOS_BY_ID, HandleDumpFormInfoByFormId), + BIND_REQUEST_FUNC(FORM_MGR_FORM_TIMER_INFO_BY_ID, HandleDumpFormTimerByFormId), + BIND_REQUEST_FUNC(FORM_MGR_SET_NEXT_REFRESH_TIME, HandleSetNextRefreshTime), + BIND_REQUEST_FUNC(FORM_MGR_LIFECYCLE_UPDATE, HandleLifecycleUpdate), + BIND_REQUEST_FUNC(FORM_MGR_MESSAGE_EVENT, HandleMessageEvent), + BIND_REQUEST_FUNC(FORM_MGR_DELETE_INVALID_FORMS, HandleDeleteInvalidForms), + BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_FORM_STATE, HandleAcquireFormState), + BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_VISIBLE, HandleNotifyFormsVisible), + BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_PRIVACY_PROTECTED, HandleNotifyFormsPrivacyProtected), + BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_ENABLE_UPDATE, HandleNotifyFormsEnableUpdate), + BIND_REQUEST_FUNC(FORM_MGR_GET_ALL_FORMS_INFO, HandleGetAllFormsInfo), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_APP, HandleGetFormsInfoByApp), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_MODULE, HandleGetFormsInfoByModule), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_FILTER, HandleGetFormsInfoByFilter), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO, HandleGetFormsInfo), + BIND_REQUEST_FUNC(FORM_MGR_ROUTER_EVENT, HandleRouterEvent), + BIND_REQUEST_FUNC(FORM_MGR_BACKGROUND_EVENT, HandleBackgroundEvent), + BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_FORM, HandleRequestPublishForm), + BIND_REQUEST_FUNC(FORM_MGR_SHARE_FORM, HandleShareForm), + BIND_REQUEST_FUNC(FORM_MGR_RECV_FORM_SHARE_INFO_FROM_REMOTE, HandleRecvFormShareInfoFromRemote), + BIND_REQUEST_FUNC(FORM_MGR_IS_REQUEST_PUBLISH_FORM_SUPPORTED, HandleIsRequestPublishFormSupported), + BIND_REQUEST_FUNC(FORM_MGR_START_ABILITY, HandleStartAbility), + BIND_REQUEST_FUNC(FORM_MGR_CHECK_FMS_READY, HandleCheckFMSReady), + BIND_REQUEST_FUNC(FORM_MGR_STOP_RENDERING_FORM, HandleStopRenderingForm), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_ADD_OBSERVER_BY_BUNDLE, HandleRegisterFormAddObserverByBundle), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_REMOVE_OBSERVER_BY_BUNDLE, HandleRegisterFormRemoveObserverByBundle), + BIND_REQUEST_FUNC(FORM_MGR_START_ABILITY_BY_FMS, HandleStartAbilityByFms), + BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_DATA, HandleAcquireFormData), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_COUNT, HandleGetFormsCount), + BIND_REQUEST_FUNC(FORM_MGR_GET_HOST_FORMS_COUNT, HandleGetHostFormsCount), + BIND_REQUEST_FUNC(FORM_MGR_GET_RUNNING_FORM_INFOS, HandleGetRunningFormInfos), + BIND_REQUEST_FUNC(FORM_MGR_GET_RUNNING_FORM_INFOS_BY_BUNDLE, HandleGetRunningFormInfosByBundleName), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORM_INSTANCES_FROM_BY_FILTER, HandleGetFormInstancesByFilter), + BIND_REQUEST_FUNC(FORM_MGR_GET_FORM_INSTANCES_FROM_BY_ID, HandleGetFormInstanceById), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_ADD_OBSERVER, HandleRegisterAddObserver), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_REMOVE_OBSERVER, HandleRegisterRemoveObserver), + BIND_REQUEST_FUNC(FORM_MGR_UPDATE_PROXY_FORM, HandleUpdateProxyForm), + BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_PROXY_FORM, HandleRequestPublishProxyForm), + BIND_REQUEST_FUNC(FORM_MGR_RELEASE_RENDERER, HandleReleaseRenderer), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_PUBLISH_FORM_INTERCEPTOR, HandleRegisterPublishFormInterceptor), + BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_PUBLISH_FORM_INTERCEPTOR, HandleUnregisterPublishFormInterceptor), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_CLICK_EVENT_OBSERVER, HandleRegisterClickCallbackEventObserver), + BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_PEOTECTED, HandleIsFormProtected), + BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_EXEMPT, HandleIsFormExempt), + BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORM_LOCKED, HandleNotifyFormLocked), + BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_CLICK_EVENT_OBSERVER, HandleUnregisterClickCallbackEventObserver), + BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_ROUTER_PROXY, HandleRegisterFormRouterProxy), + BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_FORM_ROUTER_PROXY, HandleUnregisterFormRouterProxy), + BIND_REQUEST_FUNC(FORM_MGR_SET_FORMS_RECYCLABLE, HandleSetFormsRecyclable), + BIND_REQUEST_FUNC(FORM_MGR_RECYCLE_FORMS, HandleRecycleForms), + BIND_REQUEST_FUNC(FORM_MGR_RECOVER_FORMS, HandleRecoverForms), + BIND_REQUEST_FUNC(FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID, HandleHasFormVisible), + BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM_LOCATION, HandleUpdateFormLocation), + BIND_REQUEST_FUNC(FORM_MGR_PUBLISH_FORM_ERRCODE_RESULT, HandleSetPublishFormResult), + BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_ADD_FORM_RESULT, HandleAcquireAddFormResult), + BIND_REQUEST_FUNC(FORM_MGR_CREATE_FORM, HandleCreateForm), + BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_FORM_WITH_SNAPSHOT, HandleRequestPublishFormWithSnapshot), + BIND_REQUEST_FUNC(FORM_MGR_BATCH_REFRESH_FORMS, HandleBatchRefreshForms), + BIND_REQUEST_FUNC(FORM_MGR_ENABLE_FORMS, HandleEnableForms), + BIND_REQUEST_FUNC(FORM_MGR_IS_SYSTEM_APP_FORM, HandleIsSystemAppForm), + BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_FORBIDDEN, HandleIsFormBundleForbidden), + BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM_SIZE, HandleUpdateFormSize), + BIND_REQUEST_FUNC(FORM_MGR_LOCK_FORMS, HandleLockForms), + BIND_REQUEST_FUNC(FORM_MGR_OPEN_FORM_EDIT_ABILITY, HandleOpenFormEditAbility) + }; + return requestFuncMap; +} + /** * @brief handle remote request. * @param code ipc code. @@ -68,7 +151,13 @@ int FormMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParc return ERR_APPEXECFWK_FORM_INVALID_PARAM; } - return OnRemoteRequestFirst(code, data, reply, option); + auto funcMap = RequestFuncMap(); + auto func = funcMap.find(static_cast(code)); + if (func != funcMap.end()) { + func->second(data, reply); + } + + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } /** -- Gitee From c784689fe0aa5230806be9f71e00c4bdb6cb1f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:24:10 +0000 Subject: [PATCH 22/26] update interfaces/inner_api/include/form_mgr_stub.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_stub.h | 41 +------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index 41ad1f09c4..199e1de55f 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -598,46 +598,6 @@ private: */ int32_t HandleNotifyFormLocked(MessageParcel &data, MessageParcel &reply); - /** - * @brief the first part of handle remote request. - * @param code ipc code. - * @param data input param. - * @param reply output param. - * @param option message option. - * @return Returns ERR_OK on success, others on failure. - */ - int OnRemoteRequestFirst(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - - /** - * @brief the second part of handle remote request. - * @param code ipc code. - * @param data input param. - * @param reply output param. - * @param option message option. - * @return Returns ERR_OK on success, others on failure. - */ - int OnRemoteRequestSecond(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - - /** - * @brief the third part of handle remote request. - * @param code ipc code. - * @param data input param. - * @param reply output param. - * @param option message option. - * @return Returns ERR_OK on success, others on failure. - */ - int OnRemoteRequestThird(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - - /** - * @brief the fourth part of handle remote request. - * @param code ipc code. - * @param data input param. - * @param reply output param. - * @param option message option. - * @return Returns ERR_OK on success, others on failure. - */ - int OnRemoteRequestFourth(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - /** * @brief the fifth part of handle remote request. * @param code ipc code. @@ -674,6 +634,7 @@ private: */ template bool WriteParcelableVector(std::vector &parcelableVector, Parcel &reply); + std::map> RequestFuncMap(); }; } // namespace AppExecFwk } // namespace OHOS -- Gitee From 54c166ffbc277c454f41abd51a765961ac354eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:26:46 +0000 Subject: [PATCH 23/26] update interfaces/inner_api/src/form_mgr_stub.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/src/form_mgr_stub.cpp | 87 +--------------------- 1 file changed, 2 insertions(+), 85 deletions(-) diff --git a/interfaces/inner_api/src/form_mgr_stub.cpp b/interfaces/inner_api/src/form_mgr_stub.cpp index 88582d0f36..c85c51f2c7 100644 --- a/interfaces/inner_api/src/form_mgr_stub.cpp +++ b/interfaces/inner_api/src/form_mgr_stub.cpp @@ -27,9 +27,6 @@ namespace OHOS { namespace AppExecFwk { -#define BIND_REQUEST_FUNC(msgId, func) \ - { IFormMgr::Message::msgId, std::bind(&FormMgrStub::func, this, std::placeholders::_1, std::placeholders::_2) } -using RemoteRequestFunction = std::function; const int32_t LIMIT_PARCEL_SIZE = 1024; constexpr size_t MAX_PARCEL_CAPACITY = 4 * 1024 * 1024; // 4M static constexpr int32_t MAX_ALLOW_SIZE = 8 * 1024; @@ -53,86 +50,6 @@ FormMgrStub::FormMgrStub() FormMgrStub::~FormMgrStub() {} -std::map FormMgrStub::RequestFuncMap() -{ - const static std::map requestFuncMap = { - BIND_REQUEST_FUNC(FORM_MGR_ADD_FORM, HandleAddForm), - BIND_REQUEST_FUNC(FORM_MGR_DELETE_FORM, HandleDeleteForm), - BIND_REQUEST_FUNC(FORM_MGR_RELEASE_FORM, HandleReleaseForm), - BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM, HandleUpdateForm), - BIND_REQUEST_FUNC(FORM_MGR_REQUEST_FORM, HandleRequestForm), - BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORM_WHETHER_VISIBLE, HandleNotifyWhetherVisibleForms), - BIND_REQUEST_FUNC(FORM_MGR_CAST_TEMP_FORM, HandleCastTempForm), - BIND_REQUEST_FUNC(FORM_MGR_STORAGE_FORM_INFOS, HandleDumpStorageFormInfos), - BIND_REQUEST_FUNC(FORM_MGR_FORM_INFOS_BY_NAME, HandleDumpFormInfoByBundleName), - BIND_REQUEST_FUNC(FORM_MGR_FORM_INFOS_BY_ID, HandleDumpFormInfoByFormId), - BIND_REQUEST_FUNC(FORM_MGR_FORM_TIMER_INFO_BY_ID, HandleDumpFormTimerByFormId), - BIND_REQUEST_FUNC(FORM_MGR_SET_NEXT_REFRESH_TIME, HandleSetNextRefreshTime), - BIND_REQUEST_FUNC(FORM_MGR_LIFECYCLE_UPDATE, HandleLifecycleUpdate), - BIND_REQUEST_FUNC(FORM_MGR_MESSAGE_EVENT, HandleMessageEvent), - BIND_REQUEST_FUNC(FORM_MGR_DELETE_INVALID_FORMS, HandleDeleteInvalidForms), - BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_FORM_STATE, HandleAcquireFormState), - BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_VISIBLE, HandleNotifyFormsVisible), - BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_PRIVACY_PROTECTED, HandleNotifyFormsPrivacyProtected), - BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORMS_ENABLE_UPDATE, HandleNotifyFormsEnableUpdate), - BIND_REQUEST_FUNC(FORM_MGR_GET_ALL_FORMS_INFO, HandleGetAllFormsInfo), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_APP, HandleGetFormsInfoByApp), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_MODULE, HandleGetFormsInfoByModule), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO_BY_FILTER, HandleGetFormsInfoByFilter), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_INFO, HandleGetFormsInfo), - BIND_REQUEST_FUNC(FORM_MGR_ROUTER_EVENT, HandleRouterEvent), - BIND_REQUEST_FUNC(FORM_MGR_BACKGROUND_EVENT, HandleBackgroundEvent), - BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_FORM, HandleRequestPublishForm), - BIND_REQUEST_FUNC(FORM_MGR_SHARE_FORM, HandleShareForm), - BIND_REQUEST_FUNC(FORM_MGR_RECV_FORM_SHARE_INFO_FROM_REMOTE, HandleRecvFormShareInfoFromRemote), - BIND_REQUEST_FUNC(FORM_MGR_IS_REQUEST_PUBLISH_FORM_SUPPORTED, HandleIsRequestPublishFormSupported), - BIND_REQUEST_FUNC(FORM_MGR_START_ABILITY, HandleStartAbility), - BIND_REQUEST_FUNC(FORM_MGR_CHECK_FMS_READY, HandleCheckFMSReady), - BIND_REQUEST_FUNC(FORM_MGR_STOP_RENDERING_FORM, HandleStopRenderingForm), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_ADD_OBSERVER_BY_BUNDLE, HandleRegisterFormAddObserverByBundle), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_REMOVE_OBSERVER_BY_BUNDLE, HandleRegisterFormRemoveObserverByBundle), - BIND_REQUEST_FUNC(FORM_MGR_START_ABILITY_BY_FMS, HandleStartAbilityByFms), - BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_DATA, HandleAcquireFormData), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORMS_COUNT, HandleGetFormsCount), - BIND_REQUEST_FUNC(FORM_MGR_GET_HOST_FORMS_COUNT, HandleGetHostFormsCount), - BIND_REQUEST_FUNC(FORM_MGR_GET_RUNNING_FORM_INFOS, HandleGetRunningFormInfos), - BIND_REQUEST_FUNC(FORM_MGR_GET_RUNNING_FORM_INFOS_BY_BUNDLE, HandleGetRunningFormInfosByBundleName), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORM_INSTANCES_FROM_BY_FILTER, HandleGetFormInstancesByFilter), - BIND_REQUEST_FUNC(FORM_MGR_GET_FORM_INSTANCES_FROM_BY_ID, HandleGetFormInstanceById), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_ADD_OBSERVER, HandleRegisterAddObserver), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_REMOVE_OBSERVER, HandleRegisterRemoveObserver), - BIND_REQUEST_FUNC(FORM_MGR_UPDATE_PROXY_FORM, HandleUpdateProxyForm), - BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_PROXY_FORM, HandleRequestPublishProxyForm), - BIND_REQUEST_FUNC(FORM_MGR_RELEASE_RENDERER, HandleReleaseRenderer), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_PUBLISH_FORM_INTERCEPTOR, HandleRegisterPublishFormInterceptor), - BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_PUBLISH_FORM_INTERCEPTOR, HandleUnregisterPublishFormInterceptor), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_CLICK_EVENT_OBSERVER, HandleRegisterClickCallbackEventObserver), - BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_PEOTECTED, HandleIsFormProtected), - BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_EXEMPT, HandleIsFormExempt), - BIND_REQUEST_FUNC(FORM_MGR_NOTIFY_FORM_LOCKED, HandleNotifyFormLocked), - BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_CLICK_EVENT_OBSERVER, HandleUnregisterClickCallbackEventObserver), - BIND_REQUEST_FUNC(FORM_MGR_REGISTER_FORM_ROUTER_PROXY, HandleRegisterFormRouterProxy), - BIND_REQUEST_FUNC(FORM_MGR_UNREGISTER_FORM_ROUTER_PROXY, HandleUnregisterFormRouterProxy), - BIND_REQUEST_FUNC(FORM_MGR_SET_FORMS_RECYCLABLE, HandleSetFormsRecyclable), - BIND_REQUEST_FUNC(FORM_MGR_RECYCLE_FORMS, HandleRecycleForms), - BIND_REQUEST_FUNC(FORM_MGR_RECOVER_FORMS, HandleRecoverForms), - BIND_REQUEST_FUNC(FORM_MGR_HAS_FORM_VISIBLE_WITH_TOKENID, HandleHasFormVisible), - BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM_LOCATION, HandleUpdateFormLocation), - BIND_REQUEST_FUNC(FORM_MGR_PUBLISH_FORM_ERRCODE_RESULT, HandleSetPublishFormResult), - BIND_REQUEST_FUNC(FORM_MGR_ACQUIRE_ADD_FORM_RESULT, HandleAcquireAddFormResult), - BIND_REQUEST_FUNC(FORM_MGR_CREATE_FORM, HandleCreateForm), - BIND_REQUEST_FUNC(FORM_MGR_REQUEST_PUBLISH_FORM_WITH_SNAPSHOT, HandleRequestPublishFormWithSnapshot), - BIND_REQUEST_FUNC(FORM_MGR_BATCH_REFRESH_FORMS, HandleBatchRefreshForms), - BIND_REQUEST_FUNC(FORM_MGR_ENABLE_FORMS, HandleEnableForms), - BIND_REQUEST_FUNC(FORM_MGR_IS_SYSTEM_APP_FORM, HandleIsSystemAppForm), - BIND_REQUEST_FUNC(FORM_MGR_IS_FORM_BUNDLE_FORBIDDEN, HandleIsFormBundleForbidden), - BIND_REQUEST_FUNC(FORM_MGR_UPDATE_FORM_SIZE, HandleUpdateFormSize), - BIND_REQUEST_FUNC(FORM_MGR_LOCK_FORMS, HandleLockForms), - BIND_REQUEST_FUNC(FORM_MGR_OPEN_FORM_EDIT_ABILITY, HandleOpenFormEditAbility) - }; - return requestFuncMap; -} - /** * @brief handle remote request. * @param code ipc code. @@ -361,8 +278,6 @@ int FormMgrStub::OnRemoteRequestFourth(uint32_t code, MessageParcel &data, Messa return HandleUpdateFormSize(data, reply); case static_cast(IFormMgr::Message::FORM_MGR_LOCK_FORMS): return HandleLockForms(data, reply); - case static_cast(IFormMgr::Message::FORM_MGR_OPEN_FORM_EDIT_ABILITY): - return HandleOpenFormEditAbility(data, reply); default: return OnRemoteRequestFifth(code, data, reply, option); } @@ -385,6 +300,8 @@ int FormMgrStub::OnRemoteRequestFifth(uint32_t code, MessageParcel &data, Messag return HandleGetPublishedFormInfos(data, reply); case static_cast(IFormMgr::Message::FORM_MGR_IS_FORM_BUNDLE_EXEMPT): return HandleIsFormExempt(data, reply); + case static_cast(IFormMgr::Message::FORM_MGR_OPEN_FORM_EDIT_ABILITY): + return HandleOpenFormEditAbility(data, reply); default: return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } -- Gitee From f2ad6ec0d71b2383da6b2b3494c3844fc56e2f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:27:40 +0000 Subject: [PATCH 24/26] update interfaces/inner_api/src/form_mgr_stub.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/src/form_mgr_stub.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/interfaces/inner_api/src/form_mgr_stub.cpp b/interfaces/inner_api/src/form_mgr_stub.cpp index c85c51f2c7..9b0f1a27df 100644 --- a/interfaces/inner_api/src/form_mgr_stub.cpp +++ b/interfaces/inner_api/src/form_mgr_stub.cpp @@ -68,13 +68,7 @@ int FormMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParc return ERR_APPEXECFWK_FORM_INVALID_PARAM; } - auto funcMap = RequestFuncMap(); - auto func = funcMap.find(static_cast(code)); - if (func != funcMap.end()) { - func->second(data, reply); - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + return OnRemoteRequestFirst(code, data, reply, option); } /** -- Gitee From fb9b97620ee678513e9f62f5b5b3fd7501ffabee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:30:33 +0000 Subject: [PATCH 25/26] update interfaces/inner_api/include/form_mgr_stub.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_stub.h | 41 +++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index 199e1de55f..d19c73b8ab 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -598,6 +598,46 @@ private: */ int32_t HandleNotifyFormLocked(MessageParcel &data, MessageParcel &reply); + /** + * @brief the first part of handle remote request. + * @param code ipc code. + * @param data input param. + * @param reply output param. + * @param option message option. + * @return Returns ERR_OK on success, others on failure. + */ + int OnRemoteRequestFirst(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + + /** + * @brief the second part of handle remote request. + * @param code ipc code. + * @param data input param. + * @param reply output param. + * @param option message option. + * @return Returns ERR_OK on success, others on failure. + */ + int OnRemoteRequestSecond(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + + /** + * @brief the third part of handle remote request. + * @param code ipc code. + * @param data input param. + * @param reply output param. + * @param option message option. + * @return Returns ERR_OK on success, others on failure. + */ + int OnRemoteRequestThird(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + + /** + * @brief the fourth part of handle remote request. + * @param code ipc code. + * @param data input param. + * @param reply output param. + * @param option message option. + * @return Returns ERR_OK on success, others on failure. + */ + int OnRemoteRequestFourth(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + /** * @brief the fifth part of handle remote request. * @param code ipc code. @@ -634,7 +674,6 @@ private: */ template bool WriteParcelableVector(std::vector &parcelableVector, Parcel &reply); - std::map> RequestFuncMap(); }; } // namespace AppExecFwk } // namespace OHOS -- Gitee From c31f61e3e276e3401e4161ffe7645f10cbe07df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=BB=E5=BF=97=E5=8B=87?= Date: Mon, 3 Mar 2025 14:31:15 +0000 Subject: [PATCH 26/26] update interfaces/inner_api/include/form_mgr_stub.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 喻志勇 --- interfaces/inner_api/include/form_mgr_stub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_api/include/form_mgr_stub.h b/interfaces/inner_api/include/form_mgr_stub.h index d19c73b8ab..41ad1f09c4 100644 --- a/interfaces/inner_api/include/form_mgr_stub.h +++ b/interfaces/inner_api/include/form_mgr_stub.h @@ -607,7 +607,7 @@ private: * @return Returns ERR_OK on success, others on failure. */ int OnRemoteRequestFirst(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); - + /** * @brief the second part of handle remote request. * @param code ipc code. -- Gitee