From 2ea171698a7316fc8811eac5b201fee6ca31afd9 Mon Sep 17 00:00:00 2001 From: wuyunxun Date: Sat, 12 Apr 2025 19:59:28 +0800 Subject: [PATCH] =?UTF-8?q?BackupExtensionAbility=E6=8E=A5=E5=8F=A3IDL?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuyunxun Change-Id: Icb7d49ee1a51df83713594defb7b6e5f38e039cf --- frameworks/native/backup_ext/BUILD.gn | 2 + frameworks/native/backup_ext/ani/BUILD.gn | 62 +++---- ...hos.application.BackupExtensionAbility.ets | 12 +- .../ani/include/ext_backup_loader.h | 38 ----- .../backup_ext/ani/src/ext_backup_loader.cpp | 48 ------ .../backup_ext/{ani => }/include/ani_utils.h | 153 ++---------------- .../{ani => }/include/ext_backup_ani.h | 10 +- .../native/backup_ext/src/ext_backup.cpp | 5 +- .../{ani => }/src/ext_backup_ani.cpp | 34 +++- test/fuzztest/backupext_fuzzer/BUILD.gn | 2 + tests/unittests/backup_ext/BUILD.gn | 6 + 11 files changed, 83 insertions(+), 289 deletions(-) delete mode 100644 frameworks/native/backup_ext/ani/include/ext_backup_loader.h delete mode 100644 frameworks/native/backup_ext/ani/src/ext_backup_loader.cpp rename frameworks/native/backup_ext/{ani => }/include/ani_utils.h (59%) rename frameworks/native/backup_ext/{ani => }/include/ext_backup_ani.h (90%) rename frameworks/native/backup_ext/{ani => }/src/ext_backup_ani.cpp (78%) diff --git a/frameworks/native/backup_ext/BUILD.gn b/frameworks/native/backup_ext/BUILD.gn index ec60d87cd..1a0f4628b 100644 --- a/frameworks/native/backup_ext/BUILD.gn +++ b/frameworks/native/backup_ext/BUILD.gn @@ -28,6 +28,7 @@ ohos_shared_library("backup_extension_ability_native") { sources = [ "src/ext_backup.cpp", + "src/ext_backup_ani.cpp", "src/ext_backup_context.cpp", "src/ext_backup_context_js.cpp", "src/ext_backup_js.cpp", @@ -76,6 +77,7 @@ ohos_shared_library("backup_extension_ability_native") { "ipc:ipc_core", "ipc:ipc_napi", "napi:ace_napi", + "runtime_core:ani", "samgr:samgr_proxy", ] diff --git a/frameworks/native/backup_ext/ani/BUILD.gn b/frameworks/native/backup_ext/ani/BUILD.gn index 098ebf899..6d325e06d 100644 --- a/frameworks/native/backup_ext/ani/BUILD.gn +++ b/frameworks/native/backup_ext/ani/BUILD.gn @@ -13,50 +13,28 @@ import("//build/config/components/ets_frontend/ets2abc_config.gni") import("//build/ohos.gni") -import("//foundation/filemanagement/app_file_service/backup.gni") -group("backup_ext_ani_package") { - deps = [ ":backup_ext_ani" ] -} - -ohos_shared_library("backup_ext_ani") { - sanitize = { - integer_overflow = true - ubsan = true - boundary_sanitize = true - cfi = true - cfi_cross_dso = true - debug = false +if (support_jsapi) { + group("backup_ext_ani_package") { + deps = [ + ":backup_ext_abc_etc", + ] } - sources = [ "src/ext_backup_ani.cpp" ] - - include_dirs = [ - "include", - "../include", - ] - - deps = [ "${path_backup}/utils:backup_utils" ] - - external_deps = [ - "ability_base:want", - "ability_runtime:ability_context_native", - "ability_runtime:abilitykit_native", - "ability_runtime:app_context", - "ability_runtime:appkit_native", - "ability_runtime:extensionkit_native", - "ability_runtime:runtime", - "access_token:libaccesstoken_sdk", - "bundle_framework:appexecfwk_core", - "c_utils:utils", - "hilog:libhilog", - "hitrace:hitrace_meter", - "ipc:ipc_core", - "runtime_core:ani", - "samgr:samgr_proxy", - ] + generate_static_abc("backup_ext_abc") { + base_url = "./ets" + files = [ "./ets/@ohos.application.BackupExtensionAbility.ets" ] + dst_file = "$target_out_dir/backup_ext.abc" + out_puts = [ "$target_out_dir/backup_ext.abc" ] + is_boot_abc = "True" + device_dst_file = "/system/framework/backup_ext.abc" + } - subsystem_name = "filemanagement" - part_name = "app_file_service" - output_extension = "so" + ohos_prebuilt_etc("backup_ext_abc_etc") { + source = "$target_out_dir/backup_ext.abc" + module_install_dir = "framework" + subsystem_name = "filemanagement" + part_name = "app_file_service" + deps = [ ":backup_ext_abc" ] + } } diff --git a/frameworks/native/backup_ext/ani/ets/@ohos.application.BackupExtensionAbility.ets b/frameworks/native/backup_ext/ani/ets/@ohos.application.BackupExtensionAbility.ets index aeafebc73..b5aedba5e 100644 --- a/frameworks/native/backup_ext/ani/ets/@ohos.application.BackupExtensionAbility.ets +++ b/frameworks/native/backup_ext/ani/ets/@ohos.application.BackupExtensionAbility.ets @@ -15,16 +15,16 @@ export interface BundleVersion { - public code: number; - public name: string; + code: number; + name: string; } -class BundleVersionInner extends BundleVersion { +export class BundleVersionInner implements BundleVersion { public code: number; public name: string; } -export default class BackupExtensionAbility { - onBackup(): void; - onRestore(bundleVersion: BundleVersion): void; +export default abstract class BackupExtensionAbility { + abstract onBackup(): void; + abstract onRestore(bundleVersion: BundleVersion): void; } \ No newline at end of file diff --git a/frameworks/native/backup_ext/ani/include/ext_backup_loader.h b/frameworks/native/backup_ext/ani/include/ext_backup_loader.h deleted file mode 100644 index cb1951b6b..000000000 --- a/frameworks/native/backup_ext/ani/include/ext_backup_loader.h +++ /dev/null @@ -1,38 +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. - */ - -#ifndef OHOS_FILEMGMT_BACKUP_EXT_BACKUP_LOADER_H -#define OHOS_FILEMGMT_BACKUP_EXT_BACKUP_LOADER_H - -#include "extension_module_loader.h" - -namespace OHOS::FileManagement::Backup { -class ExtBackupLoader : public AbilityRuntime::ExtensionModuleLoader, public Singleton { - DECLARE_SINGLETON(ExtBackupLoader); - -public: - /** - * @brief Create Extension. - * - * @param runtime The runtime. - * @return The Extension instance. - */ - AbilityRuntime::Extension *Create(const std::unique_ptr &runtime) const override; - - virtual std::map GetParams() override; -}; -} // namespace OHOS::FileManagement::Backup - -#endif // OHOS_FILEMGMT_BACKUP_EXT_BACKUP_LOADER_H \ No newline at end of file diff --git a/frameworks/native/backup_ext/ani/src/ext_backup_loader.cpp b/frameworks/native/backup_ext/ani/src/ext_backup_loader.cpp deleted file mode 100644 index 82b465d25..000000000 --- a/frameworks/native/backup_ext/ani/src/ext_backup_loader.cpp +++ /dev/null @@ -1,48 +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. - */ - -#include "ext_backup_loader.h" - -#include "ext_backup_ani.h" -#include "filemgmt_libhilog.h" - -namespace OHOS::FileManagement::Backup { -using namespace std; - -ExtBackupLoader::ExtBackupLoader() = default; -ExtBackupLoader::~ExtBackupLoader() = default; - -AbilityRuntime::Extension *ExtBackupLoader::Create(const unique_ptr &runtime) const -{ - HILOGI("Create as an BackupExtensionAbility(Loader)"); - return ExtBackupAni::Create(runtime); -} - -map ExtBackupLoader::GetParams() -{ - HILOGI("Register as an extension ability"); - return { - // Type 即为 Extension 类型,定义在 ExtensionAbilityType 这一枚举类中。具体位置见 extension_ability_info.h - {"type", "9"}, - {"name", "BackupExtensionAbility"}, - }; -} - -extern "C" __attribute__((visibility("default"))) void *OHOS_EXTENSION_GetExtensionModule() -{ - HILOGI("Load as a library"); - return &ExtBackupLoader::GetInstance(); -} -} // namespace OHOS::FileManagement::Backup \ No newline at end of file diff --git a/frameworks/native/backup_ext/ani/include/ani_utils.h b/frameworks/native/backup_ext/include/ani_utils.h similarity index 59% rename from frameworks/native/backup_ext/ani/include/ani_utils.h rename to frameworks/native/backup_ext/include/ani_utils.h index 6ce270f0c..03cbc44f1 100644 --- a/frameworks/native/backup_ext/ani/include/ani_utils.h +++ b/frameworks/native/backup_ext/include/ani_utils.h @@ -190,31 +190,31 @@ private: }; template <> -bool UnionAccessor::IsInstanceOfType() +inline bool UnionAccessor::IsInstanceOfType() { return IsInstanceOf("Lstd/core/Boolean;"); } template <> -bool UnionAccessor::IsInstanceOfType() +inline bool UnionAccessor::IsInstanceOfType() { return IsInstanceOf("Lstd/core/Int;"); } template <> -bool UnionAccessor::IsInstanceOfType() +inline bool UnionAccessor::IsInstanceOfType() { return IsInstanceOf("Lstd/core/Double;"); } template <> -bool UnionAccessor::IsInstanceOfType() +inline bool UnionAccessor::IsInstanceOfType() { return IsInstanceOf("Lstd/core/String;"); } template <> -bool UnionAccessor::TryConvert(bool &value) +inline bool UnionAccessor::TryConvert(bool &value) { if (!IsInstanceOfType()) { return false; @@ -230,7 +230,7 @@ bool UnionAccessor::TryConvert(bool &value) } template <> -bool UnionAccessor::TryConvert(int &value) +inline bool UnionAccessor::TryConvert(int &value) { if (!IsInstanceOfType()) { return false; @@ -246,7 +246,7 @@ bool UnionAccessor::TryConvert(int &value) } template <> -bool UnionAccessor::TryConvert(double &value) +inline bool UnionAccessor::TryConvert(double &value) { if (!IsInstanceOfType()) { return false; @@ -262,7 +262,7 @@ bool UnionAccessor::TryConvert(double &value) } template <> -bool UnionAccessor::TryConvert(std::string &value) +inline bool UnionAccessor::TryConvert(std::string &value) { if (!IsInstanceOfType()) { return false; @@ -272,120 +272,6 @@ bool UnionAccessor::TryConvert(std::string &value) return true; } -template <> -bool UnionAccessor::TryConvertArray(std::vector &value) -{ - ani_double length; - if (ANI_OK != env_->Object_GetPropertyByName_Double(obj_, "length", &length)) { - std::cerr << "Object_GetPropertyByName_Double length failed" << std::endl; - return false; - } - for (int i = 0; i < int(length); i++) { - ani_ref ref; - if (ANI_OK != env_->Object_CallMethodByName_Ref(obj_, "$_get", "I:Lstd/core/Object;", &ref, (ani_int)i)) { - std::cerr << "Object_GetPropertyByName_Ref failed" << std::endl; - return false; - } - ani_boolean val; - if (ANI_OK != env_->Object_CallMethodByName_Boolean(static_cast(ref), "unboxed", nullptr, &val)) { - std::cerr << "Object_CallMethodByName_Double unbox failed" << std::endl; - return false; - } - value.push_back(static_cast(val)); - } - return true; -} - -template <> -bool UnionAccessor::TryConvertArray(std::vector &value) -{ - ani_double length; - if (ANI_OK != env_->Object_GetPropertyByName_Double(obj_, "length", &length)) { - std::cerr << "Object_GetPropertyByName_Double length failed" << std::endl; - return false; - } - for (int i = 0; i < int(length); i++) { - ani_ref ref; - if (ANI_OK != env_->Object_CallMethodByName_Ref(obj_, "$_get", "I:Lstd/core/Object;", &ref, (ani_int)i)) { - std::cerr << "Object_GetPropertyByName_Ref failed" << std::endl; - return false; - } - ani_int intValue; - if (ANI_OK != env_->Object_CallMethodByName_Int(static_cast(ref), "unboxed", nullptr, &intValue)) { - std::cerr << "Object_CallMethodByName_Double unbox failed" << std::endl; - return false; - } - value.push_back(static_cast(intValue)); - } - return true; -} - -template <> -bool UnionAccessor::TryConvertArray(std::vector &value) -{ - ani_double length; - if (ANI_OK != env_->Object_GetPropertyByName_Double(obj_, "length", &length)) { - std::cerr << "Object_GetPropertyByName_Double length failed" << std::endl; - return false; - } - for (int i = 0; i < int(length); i++) { - ani_ref ref; - if (ANI_OK != env_->Object_CallMethodByName_Ref(obj_, "$_get", "I:Lstd/core/Object;", &ref, (ani_int)i)) { - std::cerr << "Object_GetPropertyByName_Ref failed" << std::endl; - return false; - } - ani_double val; - if (ANI_OK != env_->Object_CallMethodByName_Double(static_cast(ref), "unboxed", nullptr, &val)) { - std::cerr << "Object_CallMethodByName_Double unbox failed" << std::endl; - return false; - } - value.push_back(static_cast(val)); - } - return true; -} - -template <> -bool UnionAccessor::TryConvertArray(std::vector &value) -{ - std::cout << "TryConvertArray std::vector" << std::endl; - ani_ref buffer; - if (ANI_OK != env_->Object_GetFieldByName_Ref(obj_, "buffer", &buffer)) { - std::cout << "Object_GetFieldByName_Ref failed" << std::endl; - return false; - } - void *data; - size_t length; - if (ANI_OK != env_->ArrayBuffer_GetInfo(static_cast(buffer), &data, &length)) { - std::cerr << "ArrayBuffer_GetInfo failed" << std::endl; - return false; - } - std::cout << "Length of buffer is " << length << std::endl; - for (size_t i = 0; i < length; i++) { - value.push_back(static_cast(data)[i]); - } - return true; -} - -template <> -bool UnionAccessor::TryConvertArray(std::vector &value) -{ - ani_double length; - if (ANI_OK != env_->Object_GetPropertyByName_Double(obj_, "length", &length)) { - std::cerr << "Object_GetPropertyByName_Double length failed" << std::endl; - return false; - } - - for (int i = 0; i < int(length); i++) { - ani_ref ref; - if (ANI_OK != env_->Object_CallMethodByName_Ref(obj_, "$_get", "I:Lstd/core/Object;", &ref, (ani_int)i)) { - std::cerr << "Object_GetPropertyByName_Double length failed" << std::endl; - return false; - } - value.push_back(AniStringUtils::ToStd(env_, static_cast(ref))); - } - return true; -} - class OptionalAccessor { public: OptionalAccessor(ani_env *env, ani_object &obj) : env_(env), obj_(obj) {} @@ -406,7 +292,7 @@ private: }; template <> -std::optional OptionalAccessor::Convert() +inline std::optional OptionalAccessor::Convert() { if (IsUndefined()) { return std::nullopt; @@ -421,25 +307,4 @@ std::optional OptionalAccessor::Convert() return value; } -template <> -std::optional OptionalAccessor::Convert() -{ - if (IsUndefined()) { - return std::nullopt; - } - - ani_size strSize; - env_->String_GetUTF8Size(static_cast(obj_), &strSize); - - std::vector buffer(strSize + 1); - char *utf8_buffer = buffer.data(); - - ani_size bytes_written = 0; - env_->String_GetUTF8(static_cast(obj_), utf8_buffer, strSize + 1, &bytes_written); - - utf8_buffer[bytes_written] = '\0'; - std::string content = std::string(utf8_buffer); - return content; -} - #endif diff --git a/frameworks/native/backup_ext/ani/include/ext_backup_ani.h b/frameworks/native/backup_ext/include/ext_backup_ani.h similarity index 90% rename from frameworks/native/backup_ext/ani/include/ext_backup_ani.h rename to frameworks/native/backup_ext/include/ext_backup_ani.h index 4a19383c4..7e2aa9237 100644 --- a/frameworks/native/backup_ext/ani/include/ext_backup_ani.h +++ b/frameworks/native/backup_ext/include/ext_backup_ani.h @@ -16,15 +16,14 @@ #ifndef EXT_BACKUP_ANI_H #define EXT_BACKUP_ANI_H -#include "ani_utils.h" #include "ext_backup_context.h" -#include "extension_base.h" +#include "ext_backup.h" #include "runtime.h" #include "sts_runtime.h" namespace OHOS::FileManagement::Backup { -class ExtBackupAni : public AbilityRuntime::ExtensionBase { +class ExtBackupAni : public ExtBackup { public: void Init(const std::shared_ptr &record, const std::shared_ptr &application, @@ -35,10 +34,10 @@ public: static ExtBackupAni *Create(const std::unique_ptr &runtime); ErrCode OnBackup(std::function callback, - std::function callbackEx); + std::function callbackEx) override; ErrCode OnRestore(std::function callback, - std::function callbackEx); + std::function callbackEx) override; public: explicit ExtBackupAni(AbilityRuntime::Runtime &runtime); @@ -50,7 +49,6 @@ private: private: AbilityRuntime::STSRuntime &stsRuntime_; - ani_env *env_; std::unique_ptr etsObj_; }; diff --git a/frameworks/native/backup_ext/src/ext_backup.cpp b/frameworks/native/backup_ext/src/ext_backup.cpp index e75dcf5f8..0ade1dff8 100644 --- a/frameworks/native/backup_ext/src/ext_backup.cpp +++ b/frameworks/native/backup_ext/src/ext_backup.cpp @@ -31,6 +31,7 @@ #include "b_json/b_json_cached_entity.h" #include "b_json/b_json_entity_extension_config.h" #include "b_resources/b_constants.h" +#include "ext_backup_ani.h" #include "ext_backup_js.h" #include "ext_extension.h" #include "filemgmt_libhilog.h" @@ -75,7 +76,9 @@ ExtBackup *ExtBackup::Create(const unique_ptr &runtime) case AbilityRuntime::Runtime::Language::JS: HILOGD("Create as BackupExtensionAbility(JS)"); return ExtBackupJs::Create(runtime); - + case AbilityRuntime::Runtime::Language::STS: + HILOGD("Create as BackupExtensionAbility(STS)"); + return ExtBackupAni::Create(runtime); default: HILOGD("Create as BackupExtensionAbility(base)"); return new ExtBackup(); diff --git a/frameworks/native/backup_ext/ani/src/ext_backup_ani.cpp b/frameworks/native/backup_ext/src/ext_backup_ani.cpp similarity index 78% rename from frameworks/native/backup_ext/ani/src/ext_backup_ani.cpp rename to frameworks/native/backup_ext/src/ext_backup_ani.cpp index d5ac5d1ab..859744265 100644 --- a/frameworks/native/backup_ext/ani/src/ext_backup_ani.cpp +++ b/frameworks/native/backup_ext/src/ext_backup_ani.cpp @@ -14,6 +14,8 @@ */ #include "ext_backup_ani.h" + +#include "ani_utils.h" #include "b_error/b_error.h" #include "b_error/b_excep_utils.h" #include "filemgmt_libhilog.h" @@ -25,7 +27,6 @@ ExtBackupAni::ExtBackupAni(AbilityRuntime::Runtime &runtime) : stsRuntime_(static_cast(runtime)) { HILOGI("Create as an BackupExtensionAbility"); - env_ = stsRuntime_.GetAniEnv(); } ExtBackupAni::~ExtBackupAni() @@ -74,24 +75,49 @@ void ExtBackupAni::Init(const std::shared_ptr &r ErrCode ExtBackupAni::CallEtsOnBackup() { - if (ANI_OK != env_->Object_CallMethodByName_Void(etsObj_->aniObj, "onBackup", nullptr)) { + ani_vm *vm = nullptr; + if (ANI_OK != stsRuntime_.GetAniEnv()->GetVM(&vm)) { + return EINVAL; + } + ani_env *env = nullptr; + ani_options aniArgs {0, nullptr}; + if (ANI_OK != vm->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &env)) { + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + return EINVAL; + } + } + if (ANI_OK != env->Object_CallMethodByName_Void(etsObj_->aniObj, "onBackup", nullptr)) { HILOGE("Failed to call the method: onBackup"); return EINVAL; } + vm->DetachCurrentThread(); return ERR_OK; } ErrCode ExtBackupAni::CallEtsOnRestore() { - ani_object bundleVersionObj = AniObjectUtils::Create(env_, "LBundleVersionInner;"); + ani_vm *vm = nullptr; + if (ANI_OK != stsRuntime_.GetAniEnv()->GetVM(&vm)) { + return EINVAL; + } + ani_env *env = nullptr; + ani_options aniArgs {0, nullptr}; + if (ANI_OK != vm->AttachCurrentThread(&aniArgs, ANI_VERSION_1, &env)) { + if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) { + return EINVAL; + } + } + const std::string className = "L@ohos/application/BackupExtensionAbility/BundleVersionInner;"; + ani_object bundleVersionObj = AniObjectUtils::Create(env, className.c_str()); if (nullptr == bundleVersionObj) { HILOGE("Failed to Create the BundleVersionInner"); return EINVAL; } - if (ANI_OK != env_->Object_CallMethodByName_Void(etsObj_->aniObj, "onRestore", nullptr, bundleVersionObj)) { + if (ANI_OK != env->Object_CallMethodByName_Void(etsObj_->aniObj, "onRestore", nullptr, bundleVersionObj)) { HILOGE("Failed to call the method: onRestore"); return EINVAL; } + vm->DetachCurrentThread(); return ERR_OK; } diff --git a/test/fuzztest/backupext_fuzzer/BUILD.gn b/test/fuzztest/backupext_fuzzer/BUILD.gn index 81a738cca..4b68f3461 100644 --- a/test/fuzztest/backupext_fuzzer/BUILD.gn +++ b/test/fuzztest/backupext_fuzzer/BUILD.gn @@ -36,6 +36,7 @@ ohos_fuzztest("BackupExtFuzzTest") { ] sources = [ "${path_backup}/frameworks/native/backup_ext/src/ext_backup.cpp", + "${path_backup}/frameworks/native/backup_ext/src/ext_backup_ani.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context_js.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_js.cpp", @@ -70,6 +71,7 @@ ohos_fuzztest("BackupExtFuzzTest") { "ipc:ipc_napi", "jsoncpp:jsoncpp", "napi:ace_napi", + "runtime_core:ani", ] defines = [ diff --git a/tests/unittests/backup_ext/BUILD.gn b/tests/unittests/backup_ext/BUILD.gn index aa8aa1317..5fd0ef93d 100644 --- a/tests/unittests/backup_ext/BUILD.gn +++ b/tests/unittests/backup_ext/BUILD.gn @@ -134,6 +134,7 @@ ohos_unittest("tar_file_test") { sources = [ "${path_backup}/frameworks/native/backup_ext/src/ext_backup.cpp", + "${path_backup}/frameworks/native/backup_ext/src/ext_backup_ani.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context_js.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_js.cpp", @@ -187,6 +188,7 @@ ohos_unittest("tar_file_test") { "ipc:ipc_core", "ipc:ipc_napi", "napi:ace_napi", + "runtime_core:ani", "samgr:samgr_proxy", ] @@ -209,6 +211,7 @@ ohos_unittest("untar_file_sup_test") { sources = [ "${path_backup}/frameworks/native/backup_ext/src/ext_backup.cpp", + "${path_backup}/frameworks/native/backup_ext/src/ext_backup_ani.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context_js.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_js.cpp", @@ -264,6 +267,7 @@ ohos_unittest("untar_file_sup_test") { "ipc:ipc_core", "ipc:ipc_napi", "napi:ace_napi", + "runtime_core:ani", "samgr:samgr_proxy", ] @@ -285,6 +289,7 @@ ohos_unittest("untar_file_test") { sources = [ "${path_backup}/frameworks/native/backup_ext/src/ext_backup.cpp", + "${path_backup}/frameworks/native/backup_ext/src/ext_backup_ani.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_context_js.cpp", "${path_backup}/frameworks/native/backup_ext/src/ext_backup_js.cpp", @@ -338,6 +343,7 @@ ohos_unittest("untar_file_test") { "ipc:ipc_core", "ipc:ipc_napi", "napi:ace_napi", + "runtime_core:ani", "samgr:samgr_proxy", ] -- Gitee