From 0cf3355fcd3aa6bc7eb831080553439050b29fe9 Mon Sep 17 00:00:00 2001 From: Cai Xincheng Date: Sat, 31 Aug 2024 15:17:17 +0800 Subject: [PATCH] xc comment change 7 Signed-off-by: Cai Xincheng Change-Id: I564ad496cec2fc104985ad9912a418d726fc7f09 --- services/core_service/src/common_event/listener.rs | 4 ++++ services/os_dependency/src/os_account_wrapper.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/core_service/src/common_event/listener.rs b/services/core_service/src/common_event/listener.rs index 5e685e1..4f5371f 100644 --- a/services/core_service/src/common_event/listener.rs +++ b/services/core_service/src/common_event/listener.rs @@ -42,6 +42,7 @@ use crate::sys_event::upload_fault_system_event; /// success code. const SUCCESS: i32 = 0; const USER_ID_VEC_BUFFER: u32 = 5; +const MINIMUM_MAIN_USER_ID: i32 = 100; fn remove_db(file_path: &str, calling_info: &CallingInfo, is_ce: bool) -> Result<()> { let db_name = construct_splited_db_name(calling_info.owner_type_enum(), calling_info.owner_info(), is_ce)?; @@ -268,6 +269,9 @@ fn backup_de_db_if_accessible(entry: &DirEntry, user_id: i32) -> Result<()> { } fn backup_ce_db(user_id: i32) -> Result<()> { + if user_id < MINIMUM_MAIN_USER_ID { + return Ok(()); + } let ce_path = format!("{}/{}/asset_service", CE_ROOT_PATH, user_id); for db_path in fs::read_dir(ce_path)? { let db_path = db_path?; diff --git a/services/os_dependency/src/os_account_wrapper.cpp b/services/os_dependency/src/os_account_wrapper.cpp index af97412..6d81686 100644 --- a/services/os_dependency/src/os_account_wrapper.cpp +++ b/services/os_dependency/src/os_account_wrapper.cpp @@ -66,7 +66,6 @@ int32_t GetUserIds(int32_t *userIdsPtr, uint32_t *userIdsSize) for (uint32_t i = 0; i < *userIdsSize; i++) { userIdsPtr[i] = userIdsVec[i]; } - *userIdsSize = static_cast(userIdsVec.size()); return ASSET_SUCCESS; @@ -84,7 +83,10 @@ int32_t GetUsersSize(uint32_t *userIdsSize) LOGE("[FATAL]accountInfos is empty"); return ASSET_ACCOUNT_ERROR; } - *userIdsSize = static_cast(accountInfos.size()); + std::vector userIdsVec = { 0 }; + std::transform(accountInfos.begin(), accountInfos.end(), std::back_inserter(userIdsVec), + [](auto &iter) { return iter.GetLocalId(); }); + *userIdsSize = static_cast(userIdsVec.size()); return ASSET_SUCCESS; } \ No newline at end of file