diff --git a/frameworks/native/backup_ext/BUILD.gn b/frameworks/native/backup_ext/BUILD.gn index 14208017dc0426bf1c1861e220d3afcae67ef337..85d6d2369add6f537dcc589edcde191f2e40c03a 100644 --- a/frameworks/native/backup_ext/BUILD.gn +++ b/frameworks/native/backup_ext/BUILD.gn @@ -52,7 +52,7 @@ ohos_shared_library("backup_extension_ability_native") { deps = [ "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", "${path_backup}/interfaces/innerkits/native:sandbox_helper_native", - "${path_backup}/services/backup_sa:backup_extension_stub_idl", + "${path_backup}/services/backup_sa:backup_sa_ipc_stub", "${path_backup}/utils:backup_utils", ] @@ -85,7 +85,6 @@ ohos_shared_library("backup_extension_ability_native") { "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", "-Os", - "-fvisibility=hidden", ] use_exceptions = true diff --git a/interfaces/inner_api/native/backup_kit_inner/BUILD.gn b/interfaces/inner_api/native/backup_kit_inner/BUILD.gn index 94bc2549cb3701464919f378cc39cca672188828..70593df50e2cbcb94c6766ac0958a22b18cceb64 100644 --- a/interfaces/inner_api/native/backup_kit_inner/BUILD.gn +++ b/interfaces/inner_api/native/backup_kit_inner/BUILD.gn @@ -78,9 +78,7 @@ ohos_shared_library("backup_kit_inner") { ] deps = [ - "${path_backup}/services/backup_sa:backup_extension_stub_idl", - "${path_backup}/services/backup_sa:backup_reverse_stub_idl", - "${path_backup}/services/backup_sa:backup_service_proxy_idl", + "${path_backup}/services/backup_sa:backup_sa_ipc", "${path_backup}/utils:backup_utils", ] diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index c0c812f5591094ed09b662b9f95aa6bd45f1e7ea..3a96c145cde353a7467aa2e139221e18a3697381 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -157,6 +157,7 @@ ohos_shared_library("backup") { deps = [ "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", + "${path_backup}/services/backup_sa:backup_sa_ipc", "${path_backup}/utils:backup_utils", ] diff --git a/services/backup_sa/BUILD.gn b/services/backup_sa/BUILD.gn index a8e928cbf4349c16844f8c7f903e3817ab8fecda..4f0cab5c413c9bc394c0ebd2e2d7a733ecf8199c 100644 --- a/services/backup_sa/BUILD.gn +++ b/services/backup_sa/BUILD.gn @@ -68,100 +68,27 @@ ohos_source_set("backup_sa_ipc") { "${target_gen_dir}/", ] - cflags_cc = [ - "-fdata-sections", - "-ffunction-sections", - "-fno-unwind-tables", - "-fno-asynchronous-unwind-tables", - "-Os", - "-fvisibility=hidden", - ] - part_name = "app_file_service" subsystem_name = "filemanagement" } -ohos_source_set("backup_extension_stub_idl") { +ohos_source_set("backup_sa_ipc_type") { sanitize = { cfi = true cfi_cross_dso = true debug = false } - sources = [ - "${target_gen_dir}/extension_stub.cpp" - ] - public_configs = [ ":public_idl_config" ] - deps = [ ":backup_idl" ] - external_deps = [ - "c_utils:utils", - "hilog:libhilog", - "hitrace:hitrace_meter", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - ] - include_dirs = [ - ".", - "${target_gen_dir}/", - ] - cflags_cc = [ - "-fdata-sections", - "-ffunction-sections", - "-fno-unwind-tables", - "-fno-asynchronous-unwind-tables", - "-Os", - ] - part_name = "app_file_service" - subsystem_name = "filemanagement" -} + output_values = get_target_outputs(":backup_idl") -ohos_source_set("backup_reverse_stub_idl") { - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } - sources = [ - "${target_gen_dir}/service_reverse_stub.cpp" - ] - public_configs = [ ":public_idl_config" ] - deps = [ ":backup_idl" ] - external_deps = [ - "c_utils:utils", - "hilog:libhilog", - "hitrace:hitrace_meter", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", - ] - include_dirs = [ - ".", - "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl", - "${target_gen_dir}/", - ] - cflags_cc = [ - "-fdata-sections", - "-ffunction-sections", - "-fno-unwind-tables", - "-fno-asynchronous-unwind-tables", - "-Os", - ] - part_name = "app_file_service" - subsystem_name = "filemanagement" -} + sources = [] + + sources += filter_include(output_values, [ "*_type.cpp" ]) -ohos_source_set("backup_service_proxy_idl") { - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } - sources = [ - "${target_gen_dir}/service_proxy.cpp" - ] public_configs = [ ":public_idl_config" ] + deps = [ ":backup_idl" ] + external_deps = [ "c_utils:utils", "hilog:libhilog", @@ -170,19 +97,14 @@ ohos_source_set("backup_service_proxy_idl") { "safwk:system_ability_fwk", "samgr:samgr_proxy", ] + include_dirs = [ ".", - "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl", "${target_gen_dir}/", ] - cflags_cc = [ - "-fdata-sections", - "-ffunction-sections", - "-fno-unwind-tables", - "-fno-asynchronous-unwind-tables", - "-Os", - ] + part_name = "app_file_service" + subsystem_name = "filemanagement" } diff --git a/tests/mock/module_ipc/include/svc_extension_proxy_mock.h b/tests/mock/module_ipc/include/svc_extension_proxy_mock.h index 22a484e0e66b397c9b0277efbfa77783a45f9211..ed98bfdd30296e55f16b267cfd97f4e8f29be98b 100644 --- a/tests/mock/module_ipc/include/svc_extension_proxy_mock.h +++ b/tests/mock/module_ipc/include/svc_extension_proxy_mock.h @@ -18,14 +18,12 @@ #include -#include -#include "iextension.h" +#include "extension_proxy.h" namespace OHOS::FileManagement::Backup { -class SvcExtensionProxyMock : public IRemoteProxy { +class SvcExtensionProxyMock : public ExtensionProxy { public: - SvcExtensionProxyMock() : IRemoteProxy(nullptr) {}; - virtual ~SvcExtensionProxyMock() = default; + SvcExtensionProxyMock() : ExtensionProxy(nullptr) {}; public: MOCK_METHOD(ErrCode, GetFileHandleWithUniqueFd, (const std::string &, int32_t &, int32_t &)); MOCK_METHOD(ErrCode, HandleClear, ()); diff --git a/tests/mock/module_ipc/service_reverse_proxy_mock.cpp b/tests/mock/module_ipc/service_reverse_proxy_mock.cpp index 7e03f557d4fdc174a171bda35081802b199bf879..800d74399ac3a8dc6aff9b429e1b01776014fcd1 100644 --- a/tests/mock/module_ipc/service_reverse_proxy_mock.cpp +++ b/tests/mock/module_ipc/service_reverse_proxy_mock.cpp @@ -175,28 +175,4 @@ ErrCode ServiceReverseProxy::IncrementalRestoreOnProcessInfo(const std::string & { return BError(BError::Codes::OK); } - -ErrCode ServiceReverseProxy::IncrementalSaBackupOnFileReady(const std::string &bundleName, const std::string &fileName, - int fd, int32_t errCode) -{ - return BError(BError::Codes::OK); -} - -ErrCode ServiceReverseProxy::IncrementalBackupOnFileReadyWithoutFd(const std::string &bundleName, - const std::string &fileName, int32_t errCode) -{ - return BError(BError::Codes::OK); -} - -ErrCode ServiceReverseProxy::BackupOnFileReadyWithoutFd(const std::string &bundleName, const std::string &fileName, - int32_t errCode) -{ - return BError(BError::Codes::OK); -} - -ErrCode ServiceReverseProxy::RestoreOnFileReadyWithoutFd(const std::string &bundleName, const std::string &fileName, - int32_t errCode) -{ - return BError(BError::Codes::OK); -} } // namespace OHOS::FileManagement::Backup \ No newline at end of file diff --git a/tests/unittests/backup_sa/module_ipc/BUILD.gn b/tests/unittests/backup_sa/module_ipc/BUILD.gn index 46f62e8b6b8b8c5021ca57e369cd6b8d3e85615e..3c8a43658c1d1cd7a7df72676949584e1cc23588 100644 --- a/tests/unittests/backup_sa/module_ipc/BUILD.gn +++ b/tests/unittests/backup_sa/module_ipc/BUILD.gn @@ -39,7 +39,7 @@ ohos_unittest("module_ipc_test") { deps = [ "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", - "${path_backup}/services/backup_sa:backup_sa_ipc", + "${path_backup}/services/backup_sa:backup_sa_ipc_stub", "${path_backup}/tests/utils:backup_test_utils", "${path_backup}/utils:backup_utils", ] diff --git a/utils/BUILD.gn b/utils/BUILD.gn index f154e214bcabf6fa453c6478c32b71ddca250e1c..90f31d3e6bfb566bf93605bb864dd832851e7f11 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -116,6 +116,7 @@ ohos_shared_library("backup_utils") { deps = [ ":backup_cxx_cppdeps", "${path_backup}/interfaces/innerkits/native:sandbox_helper_native", + "${path_backup}/services/backup_sa:backup_sa_ipc_type", ] cflags_cc = [ diff --git a/utils/include/b_radar/radar_app_statistic.h b/utils/include/b_radar/radar_app_statistic.h index ca81a26be54401d4349a0f6e5a28f845f3a3c2f4..9a84969ffdbf59c6295a21ee77f16d526dba4b61 100644 --- a/utils/include/b_radar/radar_app_statistic.h +++ b/utils/include/b_radar/radar_app_statistic.h @@ -42,6 +42,16 @@ enum FileType : uint8_t { OTHER, }; +const std::unordered_map FileTypeDef = { + {"txt", TXT}, {"log", TXT}, {"json", TXT}, {"xml", TXT}, {"db", TXT}, {"db-compare", TXT}, + {"jpg", PIC}, {"jpeg", PIC}, {"png", PIC}, {"bmp", PIC}, {"gif", PIC}, {"svg", PIC}, {"webp", PIC}, {"tif", PIC}, + {"raw", PIC}, + {"wav", AUDIO}, {"flac", AUDIO}, {"wma", AUDIO}, {"acc", AUDIO}, {"mp3", AUDIO}, {"ogg", AUDIO}, {"opus", AUDIO}, + {"mov", VEDIO}, {"wmv", VEDIO}, {"rm", VEDIO}, {"rmvb", VEDIO}, {"3gp", VEDIO}, {"m4v", VEDIO}, {"mkv", VEDIO}, + {"rar", COMPRESS}, {"zip", COMPRESS}, {"7z", COMPRESS}, {"gz", COMPRESS}, {"iso", COMPRESS}, {"tar", COMPRESS}, + {"exe", BIN}, {"doc", BIN}, {"docx", BIN}, {"xls", BIN}, {"xlsx", BIN}, {"ppt", BIN}, {"pdf", BIN} +}; + constexpr uint64_t ONE_MB = 1024 * 1024; constexpr uint64_t TWO_MB = 2 * ONE_MB; constexpr uint64_t TEN_MB = 10 * ONE_MB; diff --git a/utils/include/b_radar/radar_const.h b/utils/include/b_radar/radar_const.h index 6ebf347daa8234cfd6850d977576740966532023..f4c730c443c80d14fe71f5f30ce16d1bc01284ce 100644 --- a/utils/include/b_radar/radar_const.h +++ b/utils/include/b_radar/radar_const.h @@ -127,5 +127,61 @@ struct RadarError { std::string errMsg_ = ""; }; +constexpr int32_t DEFAULT_STAGE = 1; +constexpr int32_t STAGE_RES_IDLE = 0; +constexpr int32_t STAGE_RES_SUCCESS = 1; +constexpr int32_t STAGE_RES_FAIL = 2; +constexpr int32_t STAGE_RES_CANCEL = 3; + +constexpr char DOMAIN[] = "APP_FILE_SVC"; +const std::string DOMAIN_NAME = "APP_FILE_SVC"; +const std::string BACKUP_RESTORE_APP_STATISTIC = "BACKUP_RESTORE_APP_STATISTIC"; +const std::string BACKUP_RESTORE_STATISTIC = "BACKUP_RESTORE_STATISTIC"; + +const std::string ORG_PKG = "ORG_PKG"; +const std::string FUNC = "FUNC"; +const std::string BIZ_SCENE = "BIZ_SCENE"; +const std::string BIZ_STAGE = "BIZ_STAGE"; +const std::string STAGE_RES = "STAGE_RES"; +const std::string CONCURRENT_ID = "CONCURRENT_ID"; +const std::string ERROR_CODE = "ERROR_CODE"; +const std::string ERROR_MSG = "ERROR_MSG"; + +const std::string HOST_PKG = "HOST_PKG"; +const std::string APP_CALLER = "APP_CALLER"; +const std::string MODE = "MODE"; +const std::string FILE_SIZE_DIST = "FILE_SIZE_DIST"; +const std::string FILE_TYPE_DIST = "FILE_TYPE_DIST"; +const std::string SMALL_FILE_COUNT = "SMALL_FILE_COUNT"; +const std::string SMALL_FILE_SIZE = "SMALL_FILE_SIZE"; +const std::string BIG_FILE_COUNT = "BIG_FILE_COUNT"; +const std::string BIG_FILE_SIZE = "BIG_FILE_SIZE"; +const std::string TAR_FILE_COUNT = "TAR_FILE_COUNT"; +const std::string TAR_FILE_SIZE = "TAR_FILE_SIZE"; +const std::string TAR_BOUND_SIZE = "TAR_BOUND_SIZE"; +const std::string DIR_DEPTH = "DIR_DEPTH"; +const std::string MANAGE_JSON_SIZE = "MANAGE_JSON_SIZE"; +const std::string EXTENSION_CONNECT_SPEND = "EXTENSION_CONNECT_SPEND"; +const std::string GET_EXT_INFO_SPEND = "GET_EXT_INFO_SPEND"; + +const std::string ON_BACKUP_SPEND = "ON_BACKUP_SPEND"; +const std::string ON_BACKUPEX_SPEND = "ON_BACKUPEX_SPEND"; +const std::string DO_BACKUP_SPEND = "DO_BACKUP_SPEND"; +const std::string TAR_SPEND = "TAR_SPEND"; +const std::string HASH_SPEND = "HASH_SPEND"; +const std::string SCAN_FILE_SPEND = "SCAN_FILE_SPEND"; +const std::string SEND_RATE_ZERO_SPAN = "SEND_RATE_ZERO_SPAN"; + +const std::string ON_RESTORE_SPEND = "ON_RESTORE_SPEND"; +const std::string ON_RESTOREEX_SPEND = "ON_RESTOREEX_SPEND"; +const std::string DO_RESTORE_SPEND = "DO_RESTORE_SPEND"; +const std::string UNTAR_SPEND = "UNTAR_SPEND"; +const std::string BIG_FILE_SPEND = "BIG_FILE_SPEND"; + +const std::string GET_BUNDLE_INFO_SPEND = "GET_BUNDLE_INFO_SPEND"; +const std::string TOTAL_SPEND = "TOTAL_SPEND"; +const std::string SUCC_BUNDLE_CNT = "SUCC_BUNDLE_CNT"; +const std::string FAIL_BUNDLE_CNT = "FAIL_BUNDLE_CNT"; + } // namespace OHOS::FileManagement::Backup #endif // OHOS_FILEMGMT_BACKUP_RADAR_CONST_H diff --git a/utils/include/b_radar/radar_const_inner.h b/utils/include/b_radar/radar_const_inner.h deleted file mode 100644 index 6e19570c55576a38e57afe6c9471fbe1b18bbaad..0000000000000000000000000000000000000000 --- a/utils/include/b_radar/radar_const_inner.h +++ /dev/null @@ -1,80 +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_RADAR_CONST_INNER_H -#define OHOS_FILEMGMT_BACKUP_RADAR_CONST_INNER_H - -#include - -namespace OHOS::FileManagement::Backup { - -constexpr int32_t DEFAULT_STAGE = 1; -constexpr int32_t STAGE_RES_IDLE = 0; -constexpr int32_t STAGE_RES_SUCCESS = 1; -constexpr int32_t STAGE_RES_FAIL = 2; -constexpr int32_t STAGE_RES_CANCEL = 3; - -constexpr char DOMAIN[] = "APP_FILE_SVC"; -const std::string DOMAIN_NAME = "APP_FILE_SVC"; -const std::string BACKUP_RESTORE_APP_STATISTIC = "BACKUP_RESTORE_APP_STATISTIC"; -const std::string BACKUP_RESTORE_STATISTIC = "BACKUP_RESTORE_STATISTIC"; - -const std::string ORG_PKG = "ORG_PKG"; -const std::string FUNC = "FUNC"; -const std::string BIZ_SCENE = "BIZ_SCENE"; -const std::string BIZ_STAGE = "BIZ_STAGE"; -const std::string STAGE_RES = "STAGE_RES"; -const std::string CONCURRENT_ID = "CONCURRENT_ID"; -const std::string ERROR_CODE = "ERROR_CODE"; -const std::string ERROR_MSG = "ERROR_MSG"; - -const std::string HOST_PKG = "HOST_PKG"; -const std::string APP_CALLER = "APP_CALLER"; -const std::string MODE = "MODE"; -const std::string FILE_SIZE_DIST = "FILE_SIZE_DIST"; -const std::string FILE_TYPE_DIST = "FILE_TYPE_DIST"; -const std::string SMALL_FILE_COUNT = "SMALL_FILE_COUNT"; -const std::string SMALL_FILE_SIZE = "SMALL_FILE_SIZE"; -const std::string BIG_FILE_COUNT = "BIG_FILE_COUNT"; -const std::string BIG_FILE_SIZE = "BIG_FILE_SIZE"; -const std::string TAR_FILE_COUNT = "TAR_FILE_COUNT"; -const std::string TAR_FILE_SIZE = "TAR_FILE_SIZE"; -const std::string TAR_BOUND_SIZE = "TAR_BOUND_SIZE"; -const std::string DIR_DEPTH = "DIR_DEPTH"; -const std::string MANAGE_JSON_SIZE = "MANAGE_JSON_SIZE"; -const std::string EXTENSION_CONNECT_SPEND = "EXTENSION_CONNECT_SPEND"; -const std::string GET_EXT_INFO_SPEND = "GET_EXT_INFO_SPEND"; - -const std::string ON_BACKUP_SPEND = "ON_BACKUP_SPEND"; -const std::string ON_BACKUPEX_SPEND = "ON_BACKUPEX_SPEND"; -const std::string DO_BACKUP_SPEND = "DO_BACKUP_SPEND"; -const std::string TAR_SPEND = "TAR_SPEND"; -const std::string HASH_SPEND = "HASH_SPEND"; -const std::string SCAN_FILE_SPEND = "SCAN_FILE_SPEND"; -const std::string SEND_RATE_ZERO_SPAN = "SEND_RATE_ZERO_SPAN"; - -const std::string ON_RESTORE_SPEND = "ON_RESTORE_SPEND"; -const std::string ON_RESTOREEX_SPEND = "ON_RESTOREEX_SPEND"; -const std::string DO_RESTORE_SPEND = "DO_RESTORE_SPEND"; -const std::string UNTAR_SPEND = "UNTAR_SPEND"; -const std::string BIG_FILE_SPEND = "BIG_FILE_SPEND"; - -const std::string GET_BUNDLE_INFO_SPEND = "GET_BUNDLE_INFO_SPEND"; -const std::string TOTAL_SPEND = "TOTAL_SPEND"; -const std::string SUCC_BUNDLE_CNT = "SUCC_BUNDLE_CNT"; -const std::string FAIL_BUNDLE_CNT = "FAIL_BUNDLE_CNT"; - -} // namespace OHOS::FileManagement::Backup -#endif // OHOS_FILEMGMT_BACKUP_RADAR_CONST_INNER_H diff --git a/utils/src/b_radar/radar_app_statistic.cpp b/utils/src/b_radar/radar_app_statistic.cpp index 804b0682fb05a8e5014949fcca501e1773eb3400..9d37a82db460fa80e4b86d51a074ccaf1154e398 100644 --- a/utils/src/b_radar/radar_app_statistic.cpp +++ b/utils/src/b_radar/radar_app_statistic.cpp @@ -14,22 +14,11 @@ */ #include "b_radar/radar_app_statistic.h" -#include "b_radar/radar_const_inner.h" #include "filemgmt_libhilog.h" #include "hisysevent.h" namespace OHOS::FileManagement::Backup { -const std::unordered_map FileTypeDef = { - {"txt", TXT}, {"log", TXT}, {"json", TXT}, {"xml", TXT}, {"db", TXT}, {"db-compare", TXT}, - {"jpg", PIC}, {"jpeg", PIC}, {"png", PIC}, {"bmp", PIC}, {"gif", PIC}, {"svg", PIC}, {"webp", PIC}, {"tif", PIC}, - {"raw", PIC}, - {"wav", AUDIO}, {"flac", AUDIO}, {"wma", AUDIO}, {"acc", AUDIO}, {"mp3", AUDIO}, {"ogg", AUDIO}, {"opus", AUDIO}, - {"mov", VEDIO}, {"wmv", VEDIO}, {"rm", VEDIO}, {"rmvb", VEDIO}, {"3gp", VEDIO}, {"m4v", VEDIO}, {"mkv", VEDIO}, - {"rar", COMPRESS}, {"zip", COMPRESS}, {"7z", COMPRESS}, {"gz", COMPRESS}, {"iso", COMPRESS}, {"tar", COMPRESS}, - {"exe", BIN}, {"doc", BIN}, {"docx", BIN}, {"xls", BIN}, {"xlsx", BIN}, {"ppt", BIN}, {"pdf", BIN} -}; - std::string FileStatList::ToJsonString() { std::string result = "["; diff --git a/utils/src/b_radar/radar_total_statistic.cpp b/utils/src/b_radar/radar_total_statistic.cpp index 87035f4a55b59a8d7c5d027e843f4e9da815ed7f..ca143af9a9b4c856803d02048bfab0a032a3b837 100644 --- a/utils/src/b_radar/radar_total_statistic.cpp +++ b/utils/src/b_radar/radar_total_statistic.cpp @@ -14,7 +14,6 @@ */ #include "b_radar/radar_total_statistic.h" -#include "b_radar/radar_const_inner.h" #include "b_utils/b_time.h" #include "filemgmt_libhilog.h" #include "hisysevent.h"