From 12dddddb73365232d6b066154567a8c8a9439033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 08:13:14 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E4=BB=B6?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E4=B8=BAso=20Signed-off-by:=20=E9=82=B9?= =?UTF-8?q?=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bundle.json | 8 +++ frameworks/js/napi/session/BUILD.gn | 58 +++++++++++++++++++ frameworks/js/napi/session/update_session.gni | 20 +++++++ 3 files changed, 86 insertions(+) create mode 100644 frameworks/js/napi/session/BUILD.gn diff --git a/bundle.json b/bundle.json index 10d428cf..e6468d76 100644 --- a/bundle.json +++ b/bundle.json @@ -58,6 +58,7 @@ "build": { "modules": [ "//base/update/updateservice/frameworks/js/napi/update:update", + "//base/update/updateservice/frameworks/js/napi/session:upd ate_session", "//base/update/updateservice/interfaces/inner_api/engine:updateservicekits", "//base/update/updateservice/interfaces/inner_api/modulemgr:update_module_mgr", "//base/update/updateservice/services/engine:dupdate_config.json", @@ -86,6 +87,13 @@ "header_files": [] }, "name": "//base/update/updateservice/interfaces/inner_api/modulemgr:update_module_mgr" + }, + { + "header": { + "header_base": "//base/update/updateservice/frameworks/js/napi/session/include", + "header_files": [] + }, + "name": "//base/update/updateservice/frameworks/js/napi/session:update_session" } ], "test": [ diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn new file mode 100644 index 00000000..4452bada --- /dev/null +++ b/frameworks/js/napi/session/BUILD.gn @@ -0,0 +1,58 @@ +# 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. + +import("//build/ohos.gni") +import("../../../js/napi/session/update_session.gni") + +config("update_session_library_native_config") { + include_dirs = session_include_dirs +} + +ohos_shared_library("update_session") { + sanitize = { + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + branch_protector_ret = "pac_ret" + + sources = session_sources + sources += [ + "$root_path/interfaces/inner_api/feature/update/model/message_parcel/src/message_parcel_helper.cpp", + "$root_path/interfaces/inner_api/feature/update/model/upgrade_info/src/business_error.cpp", + "$root_path/interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp", + "$root_path/interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp", + ] + + include_dirs = session_include_dirs + include_dirs += [ + "$root_path/foundations/ability/define/include", + "$root_path/foundations/ability/log/include", + "$root_path/foundations/ability/utils/include", + "$root_path/foundations/model/include", + "$root_path/interfaces/inner_api/feature/update/model/common", + "$root_path/interfaces/inner_api/feature/update/model/event", + "$root_path/interfaces/inner_api/feature/update/model/install", + "$root_path/interfaces/inner_api/feature/update/model/message_parcel/include", + "$root_path/interfaces/inner_api/feature/update/model/task", + "$root_path/interfaces/inner_api/feature/update/model/version_info", + "$root_path/interfaces/inner_api/feature/update/model/version_info/description", + ] + + external_deps = session_external_deps + part_name = "$updateengine_part_name" + subsystem_name = "updater" + cflags = session_cflags + public_configs = [ ":update_session_library_native_config" ] +} \ No newline at end of file diff --git a/frameworks/js/napi/session/update_session.gni b/frameworks/js/napi/session/update_session.gni index 369c6a9d..addee8e9 100644 --- a/frameworks/js/napi/session/update_session.gni +++ b/frameworks/js/napi/session/update_session.gni @@ -10,6 +10,7 @@ # 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. +import("//base/update/updateservice/updateengine.gni") root_path = "//base/update/updateservice" session_sources = [ @@ -18,3 +19,22 @@ session_sources = [ ] session_include_dirs = [ "$root_path/frameworks/js/napi/session/include" ] + +session_external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "c_utils:utils", # refbase + "hilog:libhilog", + "ipc:ipc_core", + "json:nlohmann_json_static", + "napi:ace_napi", + "safwk:system_ability_fwk", +] + +session_cflags = [ + "-fPIC", + "-Os", + "-Werror", + "-DNAPI_VERSION=8", + "-fstack-protector-strong", +] -- Gitee From 103fc25e9111df6c780179b973b6c1294ddb471f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 02:57:26 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- bundle.json | 2 +- frameworks/js/napi/session/BUILD.gn | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/bundle.json b/bundle.json index e6468d76..3c93d13e 100644 --- a/bundle.json +++ b/bundle.json @@ -58,7 +58,7 @@ "build": { "modules": [ "//base/update/updateservice/frameworks/js/napi/update:update", - "//base/update/updateservice/frameworks/js/napi/session:upd ate_session", + "//base/update/updateservice/frameworks/js/napi/session:update_session", "//base/update/updateservice/interfaces/inner_api/engine:updateservicekits", "//base/update/updateservice/interfaces/inner_api/modulemgr:update_module_mgr", "//base/update/updateservice/services/engine:dupdate_config.json", diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 4452bada..d559b2be 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -28,26 +28,13 @@ ohos_shared_library("update_session") { branch_protector_ret = "pac_ret" sources = session_sources - sources += [ - "$root_path/interfaces/inner_api/feature/update/model/message_parcel/src/message_parcel_helper.cpp", - "$root_path/interfaces/inner_api/feature/update/model/upgrade_info/src/business_error.cpp", - "$root_path/interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp", - "$root_path/interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp", - ] - + include_dirs = session_include_dirs include_dirs += [ "$root_path/foundations/ability/define/include", "$root_path/foundations/ability/log/include", "$root_path/foundations/ability/utils/include", "$root_path/foundations/model/include", - "$root_path/interfaces/inner_api/feature/update/model/common", - "$root_path/interfaces/inner_api/feature/update/model/event", - "$root_path/interfaces/inner_api/feature/update/model/install", - "$root_path/interfaces/inner_api/feature/update/model/message_parcel/include", - "$root_path/interfaces/inner_api/feature/update/model/task", - "$root_path/interfaces/inner_api/feature/update/model/version_info", - "$root_path/interfaces/inner_api/feature/update/model/version_info/description", ] external_deps = session_external_deps -- Gitee From aaee4e49c095cbc65618b7e9c9883a47486755aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 03:12:29 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index d559b2be..2cf37ee5 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -28,7 +28,7 @@ ohos_shared_library("update_session") { branch_protector_ret = "pac_ret" sources = session_sources - + include_dirs = session_include_dirs include_dirs += [ "$root_path/foundations/ability/define/include", -- Gitee From c822d46a67034cb1295c0d3add0d8f6ef44dcb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 15:15:13 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E4=B8=BAso=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/session/BUILD.gn | 1 + .../napi/session/update_session.versionscript | 21 ++ napi/include/client_contxt.h | 66 ------- napi/include/napi_auto_register.h | 73 ------- napi/include/napi_base.h | 184 ------------------ napi/include/napi_client_interface.h | 31 --- 6 files changed, 22 insertions(+), 354 deletions(-) create mode 100644 frameworks/js/napi/session/update_session.versionscript delete mode 100644 napi/include/client_contxt.h delete mode 100644 napi/include/napi_auto_register.h delete mode 100644 napi/include/napi_base.h delete mode 100644 napi/include/napi_client_interface.h diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 2cf37ee5..ed153772 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -41,5 +41,6 @@ ohos_shared_library("update_session") { part_name = "$updateengine_part_name" subsystem_name = "updater" cflags = session_cflags + version_script = "update_session.versionscript" public_configs = [ ":update_session_library_native_config" ] } \ No newline at end of file diff --git a/frameworks/js/napi/session/update_session.versionscript b/frameworks/js/napi/session/update_session.versionscript new file mode 100644 index 00000000..753ef3bd --- /dev/null +++ b/frameworks/js/napi/session/update_session.versionscript @@ -0,0 +1,21 @@ +# 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. + +1.0 { + global: + extern "C++" { + *NapiCommonUtils*; + }; + local: + *; +}; diff --git a/napi/include/client_contxt.h b/napi/include/client_contxt.h deleted file mode 100644 index fdce6cdb..00000000 --- a/napi/include/client_contxt.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2024 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 CLIENT_CONTEXT_H -#define CLIENT_CONTEXT_H - -#include - -#include "napi/native_api.h" -#include "napi/native_node_api.h" - -#include "common_error_define.h" - -namespace OHOS::UpdateEngine { -template -struct ClientContext { - typedef napi_value (*GetNapiParam)(napi_env env, napi_callback_info info, std::unique_ptr &clientContext); - typedef void (*GetIpcBusinessError)(const std::string &funcName, int32_t ipcRequestCode, - BusinessError &businessError); - typedef napi_value (*CreateNapiValue)(napi_env env, const T &context); - - ClientContext(std::string method, GetNapiParam getNapiParam, napi_async_execute_callback executeFunc, - std::vector> paramInfos, GetIpcBusinessError getIpcBusinessError) - : method_(std::move(method)), - getNapiParam_(getNapiParam), - executeFunc_(executeFunc), - paramInfos_(std::move(paramInfos)), - getIpcBusinessError_(getIpcBusinessError) - { - ENGINE_LOGD("ClientContext construct"); - } - - ~ClientContext() - { - ENGINE_LOGD("~ClientContext destruct"); - } - - std::string method_; // 执行的接口名 - BusinessError businessError_; - int32_t ipcRequestCode_ = 0; - - GetNapiParam getNapiParam_ = nullptr; // napi获取参数 - CreateNapiValue createValueFunc_ = nullptr; // 通过ipc返回结果, 构建napi结果对象函数 - - napi_async_execute_callback executeFunc_; // 异步执行函数 - napi_ref callbackRef_ = nullptr; // callback 回调 - napi_deferred deferred_ = nullptr; // promise deferred对象 - napi_async_work work_ = nullptr; - - std::vector> paramInfos_; // 入参校验异常返回结果 - GetIpcBusinessError getIpcBusinessError_; // 通过ipc返回异常,构造BusinessError -}; -} // namespace OHOS::UpdateEngine -#endif // CLIENT_CONTEXT_H \ No newline at end of file diff --git a/napi/include/napi_auto_register.h b/napi/include/napi_auto_register.h deleted file mode 100644 index f18f7d49..00000000 --- a/napi/include/napi_auto_register.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2024 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 AUTO_REGISTER_H -#define AUTO_REGISTER_H - -#include -#include -#include -#include - -namespace OHOS::UpdateEngine { -template class Container { -public: - using FuncType = std::function()>; - - ~Container() = default; - // 单例模式 - static Container &Instance() - { - static Container instance; // c++11 静态局部变量保证线程安全 - return instance; - } - - bool RegisterType(uint32_t functionType, FuncType type) - { - if (createMap_.find(functionType) != createMap_.end()) { - return false; - } - return createMap_.emplace(functionType, type).second; - } - - std::shared_ptr GetPtr(uint32_t functionType) - { - if (createMap_.find(functionType) == createMap_.end()) { - return nullptr; - } - FuncType function = createMap_[functionType]; - // 获取容器中对象时实例化 - return function(); - } - -private: - Container() = default; - Container(const Container &) = delete; - Container(Container &&) = delete; - -private: - // 存储注入对象的回调函数 - std::unordered_map createMap_; -}; - -template class NapiAutoRegister { -public: - explicit NapiAutoRegister(uint32_t FuncType) - { - Container::Instance().RegisterType(FuncType, []() { return std::make_shared(); }); - } -}; -} // namespace OHOS::UpdateEngine -#endif // AUTO_REGISTER_H \ No newline at end of file diff --git a/napi/include/napi_base.h b/napi/include/napi_base.h deleted file mode 100644 index 959f10dc..00000000 --- a/napi/include/napi_base.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2024 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 NAPI_BASE_H -#define NAPI_BASE_H - -#include - -#include "napi_common_utils.h" -#include "napi/native_api.h" -#include "napi/native_common.h" - -namespace OHOS::UpdateEngine { -template class NapiBase { -#define GET_PARAMS(env, info, num) \ - size_t argc = num; \ - napi_value args[num] = {nullptr}; \ - napi_get_cb_info(env, info, &argc, args, nullptr, nullptr) - -public: - NapiBase() = default; - ~NapiBase() = default; - - static napi_value HandleFunc(napi_env env, napi_callback_info info, - std::unique_ptr &clientContext) - { - if (clientContext == nullptr) { - ENGINE_LOGI("HandleFunc clientContext is null"); - return nullptr; - } - std::string method = clientContext->method_; - ENGINE_LOGI("HandleFunc method: %{public}s", method.c_str()); - napi_value result = clientContext->getNapiParam_(env, info, clientContext); - if (result == nullptr) { - ENGINE_LOGE("HandleFunc GetMigrateStatusParam fail"); - return nullptr; - } - if (!Execute(env, clientContext)) { - ENGINE_LOGE("HandleFunc Execute error"); - return result; - } - ENGINE_LOGI("HandleFunc method: %{public}s complete", method.c_str()); - return result; - } - - static napi_value GetCallbackParam(napi_env env, uint32_t argNum, size_t argc, napi_value args[], - std::unique_ptr &clientContext) - { - // 接口调用返回值,非返回内容 - napi_value result = nullptr; - if (argc >= argNum) { - PARAM_CHECK(argNum >= 1, return nullptr, "argNum is less than 1"); - uint32_t callbackPosition = argNum - 1; - napi_valuetype callbackValueType; - napi_typeof(env, args[callbackPosition], &callbackValueType); - std::vector> paramInfos; - paramInfos.emplace_back("callback", "napi_function"); - PARAM_CHECK(callbackValueType == napi_function, NapiCommonUtils::NapiThrowParamError(env, paramInfos); - return nullptr, "Failed to GetCallbackParam"); - napi_create_reference(env, args[callbackPosition], 1, &clientContext->callbackRef_); - napi_get_undefined(env, &result); // 创建接口返回值对象 - } else { - napi_create_promise(env, &clientContext->deferred_, &result); - } - return result; - } - - static bool Execute(napi_env env, std::unique_ptr &clientContext) - { - napi_value workName; - napi_create_string_utf8(env, clientContext->method_.c_str(), NAPI_AUTO_LENGTH, &workName); - if (napi_create_async_work(env, nullptr, workName, clientContext->executeFunc_, NapiBase::Complete, - static_cast(clientContext.get()), &clientContext->work_) != napi_ok) { - ENGINE_LOGE("Failed to create async work for %{public}s", clientContext->method_.c_str()); - return false; - } - if (napi_queue_async_work_with_qos(env, clientContext->work_, napi_qos_default) != napi_ok) { - ENGINE_LOGE("Failed to queue async work for %{public}s", clientContext->method_.c_str()); - return false; - } - ENGINE_LOGI("Execute finish"); - clientContext.release(); // unique_ptr release之后,释放指针的控制权,后续由complete里面释放指针内容 - return true; - } - - static void Complete(napi_env env, napi_status status, void *data) - { - if (data == nullptr) { - ENGINE_LOGE("Complete, data is null"); - return; - } - constexpr size_t resultLen = 2; - T *clientContext = static_cast(data); - if (clientContext == nullptr) { - ENGINE_LOGE("Complete clientContext is null"); - return; - } - - napi_value finalResult = nullptr; - if (clientContext->createValueFunc_ != nullptr) { - // 执行结果转换函数 - finalResult = clientContext->createValueFunc_(env, *clientContext); - } - - if (clientContext->ipcRequestCode_ != 0) { - // ipc失败,获取失败原因 - clientContext->getIpcBusinessError_(clientContext->method_, clientContext->ipcRequestCode_, - clientContext->businessError_); - } - - napi_value result[resultLen] = { nullptr, nullptr }; - bool isSuccess = BuildResult(env, clientContext, finalResult, result); - if (clientContext->deferred_) { // promise调用 - ExecutePromiseFunc(env, clientContext, result, resultLen, isSuccess); - } else { - ExecuteCallbackFunc(env, clientContext, result, resultLen); - } - napi_delete_async_work(env, clientContext->work_); - delete clientContext; // Execute 中释放控制权的指针,在此处释放 - clientContext = nullptr; - } - - static void ExecutePromiseFunc(napi_env env, T *clientContext, napi_value const * result, size_t len, - bool isSuccess) - { - constexpr size_t resultLength = 2; - if (len < resultLength) { - ENGINE_LOGE("length error:%{public}zu", len); - return; - } - napi_status callbackStatus = isSuccess ? napi_resolve_deferred(env, clientContext->deferred_, result[1]) : - napi_reject_deferred(env, clientContext->deferred_, result[0]); - if (callbackStatus != napi_ok) { - ENGINE_LOGE("ExecutePromiseFunc error: %{public}d", callbackStatus); - } - } - - static void ExecuteCallbackFunc(napi_env env, T *clientContext, napi_value *result, size_t len) - { - napi_value callback = nullptr; - napi_status resultStatus = napi_get_reference_value(env, clientContext->callbackRef_, &callback); - if (resultStatus != napi_ok) { - ENGINE_LOGE("napi_get_reference_value failed result=%{public}d", resultStatus); - return; - } - napi_value userRet = nullptr; - resultStatus = napi_call_function(env, nullptr, callback, len, result, &userRet); - if (resultStatus != napi_ok) { - ENGINE_LOGE("napi_call_function failed result=%{public}d", resultStatus); - return; - } - resultStatus = napi_delete_reference(env, clientContext->callbackRef_); - if (resultStatus != napi_ok) { - ENGINE_LOGE("napi_delete_reference failed result=%{public}d", resultStatus); - } - } - - static bool BuildResult(napi_env env, const T *clientContext, napi_value finalResult, napi_value *result) - { - bool isSuccess = clientContext->businessError_.errorNum == CallResult::SUCCESS; - if (isSuccess) { - napi_get_undefined(env, &result[0]); - result[1] = finalResult; - } else { - NapiCommonUtils::BuildBusinessError(env, result[0], clientContext->businessError_); - napi_get_undefined(env, &result[1]); - } - return isSuccess; - } -}; -} // namespace OHOS::UpdateEngine -#endif // NAPI_BASE_H \ No newline at end of file diff --git a/napi/include/napi_client_interface.h b/napi/include/napi_client_interface.h deleted file mode 100644 index 8e97756c..00000000 --- a/napi/include/napi_client_interface.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2024 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 NAPI_CLIENT_INTERFACE_H -#define NAPI_CLIENT_INTERFACE_H - -#include - -#include "napi/native_api.h" -#include "napi/native_node_api.h" - -namespace OHOS::UpdateEngine { -class NapiClientInterface { -public: - virtual ~NapiClientInterface() = default; - virtual napi_value HandleFunc(napi_env env, napi_callback_info info) = 0; -}; -} // OHOS::UpdateEngine -#endif // NAPI_CLIENT_INTERFACE_H \ No newline at end of file -- Gitee From e2a091eaf8a7dac7aa75e9063e6452c433396db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 07:55:32 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index ed153772..4216d30e 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -38,9 +38,9 @@ ohos_shared_library("update_session") { ] external_deps = session_external_deps + version_script = "update_session.versionscript" part_name = "$updateengine_part_name" subsystem_name = "updater" cflags = session_cflags - version_script = "update_session.versionscript" public_configs = [ ":update_session_library_native_config" ] -} \ No newline at end of file +} -- Gitee From b79bf76a241dad1b1f31ec192949d1ca47b4a4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 25 Mar 2025 17:41:41 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=20Signed-off-by:=20?= =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/session/BUILD.gn | 1 - .../napi/session/update_session.versionscript | 21 ------------------- 2 files changed, 22 deletions(-) delete mode 100644 frameworks/js/napi/session/update_session.versionscript diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 4216d30e..5d3ba62a 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -38,7 +38,6 @@ ohos_shared_library("update_session") { ] external_deps = session_external_deps - version_script = "update_session.versionscript" part_name = "$updateengine_part_name" subsystem_name = "updater" cflags = session_cflags diff --git a/frameworks/js/napi/session/update_session.versionscript b/frameworks/js/napi/session/update_session.versionscript deleted file mode 100644 index 753ef3bd..00000000 --- a/frameworks/js/napi/session/update_session.versionscript +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -1.0 { - global: - extern "C++" { - *NapiCommonUtils*; - }; - local: - *; -}; -- Gitee From cb707b94adf31e7600f21f55ab012604705348ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 26 Mar 2025 07:01:39 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 11 +---------- frameworks/js/napi/session/update_session.gni | 2 -- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 5d3ba62a..4539c686 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -19,16 +19,7 @@ config("update_session_library_native_config") { } ohos_shared_library("update_session") { - sanitize = { - boundary_sanitize = true - cfi = true - cfi_cross_dso = true - debug = false - } - branch_protector_ret = "pac_ret" - sources = session_sources - include_dirs = session_include_dirs include_dirs += [ "$root_path/foundations/ability/define/include", @@ -38,7 +29,7 @@ ohos_shared_library("update_session") { ] external_deps = session_external_deps - part_name = "$updateengine_part_name" + part_name = "update_service" subsystem_name = "updater" cflags = session_cflags public_configs = [ ":update_session_library_native_config" ] diff --git a/frameworks/js/napi/session/update_session.gni b/frameworks/js/napi/session/update_session.gni index addee8e9..3457fc90 100644 --- a/frameworks/js/napi/session/update_session.gni +++ b/frameworks/js/napi/session/update_session.gni @@ -23,12 +23,10 @@ session_include_dirs = [ "$root_path/frameworks/js/napi/session/include" ] session_external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libtokenid_sdk", - "c_utils:utils", # refbase "hilog:libhilog", "ipc:ipc_core", "json:nlohmann_json_static", "napi:ace_napi", - "safwk:system_ability_fwk", ] session_cflags = [ -- Gitee From d5b21eb1acb25b355e5fc7d32315a560d5e88ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 26 Mar 2025 07:33:46 +0000 Subject: [PATCH 08/11] =?UTF-8?q?cfi=20=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 4539c686..7db248b7 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -19,6 +19,14 @@ config("update_session_library_native_config") { } ohos_shared_library("update_session") { + sanitize = { + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + branch_protector_ret = "pac_ret" + sources = session_sources include_dirs = session_include_dirs include_dirs += [ -- Gitee From 4ade5e5143f724b4e776290e79a59a85d310724b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 26 Mar 2025 07:47:25 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 7db248b7..777ed0a3 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -19,7 +19,7 @@ config("update_session_library_native_config") { } ohos_shared_library("update_session") { - sanitize = { + sanitize = { boundary_sanitize = true cfi = true cfi_cross_dso = true -- Gitee From d77b0306f9f7a1f7293427fff97e59bfb9bf84c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 26 Mar 2025 10:57:19 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=E5=8E=BB=E6=8E=89cfi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 777ed0a3..6f90cb59 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -21,11 +21,7 @@ config("update_session_library_native_config") { ohos_shared_library("update_session") { sanitize = { boundary_sanitize = true - cfi = true - cfi_cross_dso = true - debug = false } - branch_protector_ret = "pac_ret" sources = session_sources include_dirs = session_include_dirs -- Gitee From 36d7071046b29015c384f81d284e3e1fc93cb45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 26 Mar 2025 11:08:07 +0000 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/session/BUILD.gn | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frameworks/js/napi/session/BUILD.gn b/frameworks/js/napi/session/BUILD.gn index 6f90cb59..4539c686 100644 --- a/frameworks/js/napi/session/BUILD.gn +++ b/frameworks/js/napi/session/BUILD.gn @@ -19,10 +19,6 @@ config("update_session_library_native_config") { } ohos_shared_library("update_session") { - sanitize = { - boundary_sanitize = true - } - sources = session_sources include_dirs = session_include_dirs include_dirs += [ -- Gitee