diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 209453af75ecc3787c00a9876c7351d9f38d549a..93f66b63adf59eb5a708e8c112acc79f9f246220 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -42,7 +42,11 @@ ohos_shared_library("update_foundations") { public_configs = [ ":update_service_foundations_config" ] - innerapi_tags = [ "platformsdk" ] + cflags = [ + "-fPIC", + "-Os", + "-Werror", + ] part_name = "$updateengine_part_name" subsystem_name = "updater" } diff --git a/foundations/model/include/call_result.h b/foundations/model/include/call_result.h index e32cff45a51a62ea85de29e22a838d642e88e908..ac5acda8fe665167cf30157c0d27bb4d95a88789 100644 --- a/foundations/model/include/call_result.h +++ b/foundations/model/include/call_result.h @@ -53,5 +53,7 @@ constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); +constexpr std::string_view NOT_SYSTEM_APP_INFO = + ": Permission verification failed. A non-system application calls a system API."; } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_CALL_RESULT_H diff --git a/frameworks/js/napi/session/include/napi_session.h b/frameworks/js/napi/session/include/napi_session.h index 0a3a761cbe2347f2d30e54d1f0e7448f0125c4f7..cbdfd4fd0b6b2a446fb352c67c0089ff03fdf26b 100644 --- a/frameworks/js/napi/session/include/napi_session.h +++ b/frameworks/js/napi/session/include/napi_session.h @@ -100,7 +100,7 @@ protected: std::string permissionName; switch (workResult_) { case INT_NOT_SYSTEM_APP: - msg = "BusinessError " + std::to_string(workResult_) + ": Caller not system app."; + msg = "BusinessError " + std::to_string(workResult_) + NOT_SYSTEM_APP_INFO.data(); break; case INT_APP_NOT_GRANTED: GetSessionFuncParameter(funcName, permissionName); diff --git a/frameworks/js/napi/session/src/napi_common_utils.cpp b/frameworks/js/napi/session/src/napi_common_utils.cpp index e7b8485358e4bde066258e7a071fc191e8fd61e8..f8dceac708852d48e86b49a72f0f970fbb596db0 100644 --- a/frameworks/js/napi/session/src/napi_common_utils.cpp +++ b/frameworks/js/napi/session/src/napi_common_utils.cpp @@ -225,7 +225,8 @@ void NapiCommonUtils::NapiThrowNotSystemAppError(napi_env env) { BusinessError businessError; CallResult errCode = CallResult::NOT_SYSTEM_APP; - std::string errMsg = "BusinessError " + std::to_string(CAST_INT(errCode)).append(": Caller not system app."); + std::string errMsg = "BusinessError " + std::to_string(CAST_INT(errCode)) + .append(": Permission verification failed. A non-system application calls a system API."); businessError.Build(errCode, errMsg); napi_value msg = BuildThrowError(env, businessError); napi_status status = napi_throw(env, msg); diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index 0d7b70f12358afdb05e01e73c1982082e5d10715..d7db63bcc92a691a41af77634b8ef0caa93c2056 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -16,21 +16,18 @@ import("../../../../updateengine.gni") import("../session/update_session.gni") ohos_shared_library("$updateengine_client_library_name") { - sources = [] - if (ability_ability_runtime_enable) { - sources += [ - "$updateengine_root_path/frameworks/js/napi/update/common/src/client_helper.cpp", - "$updateengine_root_path/frameworks/js/napi/update/common/src/iupdater.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/define_property.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/local_updater.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/restorer.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/session_manager.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/update_client.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/update_module.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/update_session.cpp", - ] - sources += session_sources - } + sources = [ + "$updateengine_root_path/frameworks/js/napi/update/common/src/client_helper.cpp", + "$updateengine_root_path/frameworks/js/napi/update/common/src/iupdater.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/define_property.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/local_updater.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/restorer.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/session_manager.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/update_client.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/update_module.cpp", + "$updateengine_root_path/frameworks/js/napi/update/src/update_session.cpp", + ] + sources += session_sources include_dirs = [ "$updateengine_root_path/frameworks/js/napi/update/common/include", @@ -50,12 +47,9 @@ ohos_shared_library("$updateengine_client_library_name") { "hilog:libhilog", "ipc:ipc_core", "json:nlohmann_json_static", + "napi:ace_napi", ] - if (ability_ability_runtime_enable) { - external_deps += [ "napi:ace_napi" ] - } - install_enable = true relative_install_dir = "module" part_name = "$updateengine_part_name" diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 9dcd2bb1dc12069a9b5ab694a2bffcb5569cf05f..a63ddb655b8f521b7293095740dd6c9c4fd5840e 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -41,9 +41,6 @@ ohos_shared_library("$updateengine_inner_library_name") { branch_protector_ret = "pac_ret" defines = [ "DUAL_ADAPTER" ] - if (!ability_ability_runtime_enable) { - defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] - } sources = [ "$updateengine_root_path/interfaces/inner_api/engine/src/update_callback.cpp", "$updateengine_root_path/interfaces/inner_api/engine/src/update_callback_stub.cpp", @@ -64,6 +61,7 @@ ohos_shared_library("$updateengine_inner_library_name") { ] external_deps = [ + "ability_runtime:ability_manager", "bounds_checking_function:libsec_static", "c_utils:utils", # sptr "hilog:libhilog", @@ -81,6 +79,13 @@ ohos_shared_library("$updateengine_inner_library_name") { if (ability_ability_runtime_enable) { external_deps += [ "ability_runtime:extension_manager" ] } + + cflags = [ + "-fPIC", + "-Os", + "-Werror", + ] + innerapi_tags = [ "platformsdk" ] part_name = "$updateengine_part_name" subsystem_name = "updater" diff --git a/interfaces/inner_api/modulemgr/BUILD.gn b/interfaces/inner_api/modulemgr/BUILD.gn index d145b344d32b8fb2af9da894127a790fd55ac1ac..a5f49b031abf611537b3a2ee66631fe5750ed47a 100644 --- a/interfaces/inner_api/modulemgr/BUILD.gn +++ b/interfaces/inner_api/modulemgr/BUILD.gn @@ -37,6 +37,7 @@ ohos_shared_library("update_module_mgr") { part_name = "$updateengine_part_name" subsystem_name = "updater" cflags = modulemgr_cflags + innerapi_tags = [ "sasdk" ] public_configs = [ ":module_mgr_library_native_config" ] } diff --git a/services/engine/etc/updater_sa.cfg b/services/engine/etc/updater_sa.cfg index 8e4ccd9ae51e334f1a97580673569d775b279ce7..83b8e8397480f96705eb50d573087978c1a241c1 100644 --- a/services/engine/etc/updater_sa.cfg +++ b/services/engine/etc/updater_sa.cfg @@ -14,8 +14,7 @@ "mkdir /data/update 0770 update update", "mkdir /data/update/ota_package 0770 update update", "mkdir /data/update/ota_package/firmware 0770 update update", - "mkdir /data/update/ota_package/firmware/versions 0770 update update", - "start updater_sa" + "mkdir /data/update/ota_package/firmware/versions 0770 update update" ] } ], diff --git a/services/engine/sa_profile/3006.json b/services/engine/sa_profile/3006.json index b3eab95687517a7b4a7a4b94ac8a661709d35222..8e3f0ac5975d0f4c3cf629c78a936b00d5d12c55 100644 --- a/services/engine/sa_profile/3006.json +++ b/services/engine/sa_profile/3006.json @@ -4,13 +4,18 @@ { "name": 3006, "libpath": "libupdateservice.z.so", - "run-on-create": true, + "run-on-create": false, "distributed": false, "bootphase": "BootStartPhase", "dump-level": 1, "auto-restart" : true, "start-on-demand": { "allow-update": true, + "commonevent": [ + { + "name": "usual.event.BOOT_COMPLETED" + } + ], "timedevent": [ { "name": "loopevent", diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 6239996463b02bef4ef479f93abfd7388b24312a..374c65debe15dc4cb1f515faad16bbd6d6ebfc6c 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -409,6 +409,7 @@ void FirmwareManager::HandleBootUpdateFail(const FirmwareTask &task, versionComponent.upgradeAction = UpgradeAction::UPGRADE; versionComponent.displayVersion = component.targetBlDisplayVersionNumber; versionComponent.innerVersion = component.targetBlVersionNumber; + versionComponent.componentExtra = JsonBuilder().Append("{}").ToJson(); versionComponents.push_back(versionComponent); }