From c5feed4ac88b3baa2ed49c3e24b00b79cfc49592 Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 18:32:47 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chensihan --- .../src/b_incremental_restore_session.cpp | 5 ++ .../b_incremental_session_restore_async.cpp | 5 ++ .../src/b_session_restore.cpp | 5 ++ .../src/b_session_restore_async.cpp | 5 ++ .../app_gallery_dispose_proxy.cpp | 37 +++++++-- services/backup_sa/src/module_ipc/service.cpp | 79 +++++++++++++++++++ 6 files changed, 131 insertions(+), 5 deletions(-) diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp index 1b5b24c6a..f270104a5 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp @@ -16,6 +16,7 @@ #include "b_incremental_restore_session.h" #include "b_error/b_error.h" +#include "b_radar/b_radar.h" #include "filemgmt_libhilog.h" #include "service_proxy.h" #include "service_reverse.h" @@ -54,6 +55,10 @@ unique_ptr BIncrementalRestoreSession::Init(Callback int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacks))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "BIncrementalRestoreSession::Init", + AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); return nullptr; } diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp index 67ed9f49b..be89cc611 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp @@ -16,6 +16,7 @@ #include "b_incremental_session_restore_async.h" #include "b_error/b_error.h" +#include "b_radar/b_radar.h" #include "b_resources/b_constants.h" #include "filemgmt_libhilog.h" #include "service_proxy.h" @@ -62,6 +63,10 @@ shared_ptr BIncrementalSessionRestoreAsync::Ini int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacksTmp))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "BIncrementalSessionRestoreAsync::Init", + AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); return nullptr; } diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp index c284aa26f..815072997 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp @@ -16,6 +16,7 @@ #include "b_session_restore.h" #include "b_error/b_error.h" +#include "b_radar/b_radar.h" #include "filemgmt_libhilog.h" #include "service_proxy.h" #include "service_reverse.h" @@ -54,6 +55,10 @@ unique_ptr BSessionRestore::Init(Callbacks callbacks) int32_t res = proxy->InitRestoreSession(new ServiceReverse(callbacks)); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "BSessionRestore::Init", + AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); return nullptr; } diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp index 99ffa77eb..5a96c9f74 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp @@ -16,6 +16,7 @@ #include "b_session_restore_async.h" #include "b_error/b_error.h" +#include "b_radar/b_radar.h" #include "b_resources/b_constants.h" #include "b_session_restore.h" #include "filemgmt_libhilog.h" @@ -63,6 +64,10 @@ shared_ptr BSessionRestoreAsync::Init(Callbacks callbacks) int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacksTmp))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "BSessionRestoreAsync::Init", + AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); return nullptr; } diff --git a/services/backup_sa/src/module_app_gallery/app_gallery_dispose_proxy.cpp b/services/backup_sa/src/module_app_gallery/app_gallery_dispose_proxy.cpp index 25de05591..b338bb47a 100644 --- a/services/backup_sa/src/module_app_gallery/app_gallery_dispose_proxy.cpp +++ b/services/backup_sa/src/module_app_gallery/app_gallery_dispose_proxy.cpp @@ -13,16 +13,16 @@ * limitations under the License. */ -#include "module_app_gallery/app_gallery_dispose_proxy.h" - #include +#include "b_radar/b_radar.h" +#include "b_sa/b_sa_utils.h" +#include "filemgmt_libhilog.h" #include "message_parcel.h" -#include "want.h" +#include "module_app_gallery/app_gallery_dispose_proxy.h" #include "module_app_gallery/app_gallery_service_connection.h" -#include "filemgmt_libhilog.h" -#include "b_sa/b_sa_utils.h" +#include "want.h" namespace OHOS::FileManagement::Backup { using namespace std; @@ -94,6 +94,32 @@ DisposeErr AppGalleryDisposeProxy::EndRestore(const std::string &bundleName) return DoDispose(bundleName, DisposeOperation::END_RESTORE); } +void RecordDoDisposeRes(const std::string &bundleName, + AppGalleryDisposeProxy::DisposeOperation disposeOperation, int32_t err) +{ + AppRadar::Info info (bundleName, "", ""); + switch (disposeOperation) { + case AppGalleryDisposeProxy::DisposeOperation::START_BACKUP: + AppRadar::GetInstance().RecordBackupFuncRes(info, "StartBackup", AppRadar::GetInstance().GetUserId(), + BizStageBackup::BIZ_STAGE_APPLICATION, err); + break; + case AppGalleryDisposeProxy::DisposeOperation::END_BACKUP: + AppRadar::GetInstance().RecordBackupFuncRes(info, "EndBackup", AppRadar::GetInstance().GetUserId(), + BizStageBackup::BIZ_STAGE_STATUS_CLEAR, err); + break; + case AppGalleryDisposeProxy::DisposeOperation::START_RESTORE: + AppRadar::GetInstance().RecordRestoreFuncRes(info, "StartRestore", AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_APPLICATION, err); + break; + case AppGalleryDisposeProxy::DisposeOperation::END_RESTORE: + AppRadar::GetInstance().RecordRestoreFuncRes(info, "EndRestore", AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_STATUS_CLEAR, err); + break; + default: + break; + } +} + DisposeErr AppGalleryDisposeProxy::DoDispose(const std::string &bundleName, DisposeOperation disposeOperation) { HILOGI("DoDispose, app %{public}s, operation %{public}d", bundleName.c_str(), disposeOperation); @@ -123,6 +149,7 @@ DisposeErr AppGalleryDisposeProxy::DoDispose(const std::string &bundleName, Disp int32_t ret = appRemoteObj_->SendRequest(static_cast(disposeOperation), data, reply, option); if (ret != ERR_NONE) { HILOGI("SendRequest error, code=%{public}d, bundleName=%{public}s", ret, bundleName.c_str()); + RecordDoDisposeRes(bundleName, disposeOperation, ret); return DisposeErr::REQUEST_FAIL; } diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 05358b8db..490659232 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -47,6 +47,7 @@ #include "b_jsonutil/b_jsonutil.h" #include "b_ohos/startup/backup_para.h" #include "b_process/b_multiuser.h" +#include "b_radar/b_radar.h" #include "b_resources/b_constants.h" #include "b_sa/b_sa_utils.h" #include "bundle_mgr_client.h" @@ -206,6 +207,15 @@ void Service::StopAll(const wptr &obj, bool force) session_->Deactive(obj, force); } +static inline void PermissionCheckFailRadar(const std::string &info, const std::string &func) +{ + std::string funcPos = "Service::"; + AppRadar::Info resInfo("", "", info); + AppRadar::GetInstance().RecordDefaultFuncRes(resInfo, funcPos.append(func), + GetUserIdDefault(), BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, + static_cast(BError::Codes::SA_REFUSED_ACT)); +} + string Service::VerifyCallerAndGetCallerName() { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); @@ -214,6 +224,7 @@ string Service::VerifyCallerAndGetCallerName() if (tokenType == Security::AccessToken::ATokenTypeEnum::TOKEN_HAP) { Security::AccessToken::HapTokenInfo hapTokenInfo; if (Security::AccessToken::AccessTokenKit::GetHapTokenInfo(tokenCaller, hapTokenInfo) != 0) { + PermissionCheckFailRadar("{\"reason\":\"Get hap token info failed\"}", "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, "Get hap token info failed"); } std::string bundleNameIndexInfo = BJsonUtil::BuildBundleNameIndexInfo(hapTokenInfo.bundleName, @@ -223,6 +234,9 @@ string Service::VerifyCallerAndGetCallerName() } else { string str = to_string(tokenCaller); HILOGE("tokenID = %{private}s", GetAnonyString(str).c_str()); + PermissionCheckFailRadar( + string("{\"reason\":\"Invalid token type ").append(to_string(tokenType)).append(string("\"}")), + "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, string("Invalid token type ").append(to_string(tokenType))); } } @@ -236,6 +250,8 @@ void Service::VerifyCaller() case Security::AccessToken::ATokenTypeEnum::TOKEN_NATIVE: { /* Update Service */ if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(tokenCaller, BACKUP_PERMISSION) != Security::AccessToken::PermissionState::PERMISSION_GRANTED) { + std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); } @@ -244,11 +260,15 @@ void Service::VerifyCaller() case Security::AccessToken::ATokenTypeEnum::TOKEN_HAP: { if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(tokenCaller, BACKUP_PERMISSION) != Security::AccessToken::PermissionState::PERMISSION_GRANTED) { + std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); } uint64_t fullTokenId = OHOS::IPCSkeleton::GetCallingFullTokenID(); if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(fullTokenId)) { + std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); } @@ -256,10 +276,14 @@ void Service::VerifyCaller() } case Security::AccessToken::ATokenTypeEnum::TOKEN_SHELL: if (IPCSkeleton::GetCallingUid() != BConstants::SYSTEM_UID) { + std::string info = "{\"reason\":\"invalid calling uid\"}"; + PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, "Calling uid is invalid"); } break; default: + std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Invalid token type ").append(to_string(tokenType))); break; } @@ -461,6 +485,9 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, const vectorDecreaseSessionCnt(__PRETTY_FUNCTION__); return e.GetCode(); @@ -530,6 +557,9 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, return BError(BError::Codes::OK); } catch (const BError &e) { HILOGE("Catch exception"); + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "AppendBundlesRestoreSession", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_APPEND_BUNDLES, e.GetCode()); HandleExceptionOnAppendBundles(session_, bundleNames, {}); session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); return e.GetCode(); @@ -1011,11 +1041,19 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) auto backUpConnection = session_->GetExtConnection(bundleName); if (backUpConnection == nullptr) { HILOGE("GetFileHandle error, backUpConnection is empty"); + AppRadar::Info info (bundleName, "", "{\"reason\":\"backUpConnection is empty\"}"); + int32_t err = static_cast(BError::Codes::SA_INVAL_ARG); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "GetFileHandle", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); return BError(BError::Codes::SA_INVAL_ARG); } auto proxy = backUpConnection->GetBackupExtProxy(); if (!proxy) { HILOGE("GetFileHandle error, Extension backup Proxy is empty"); + AppRadar::Info info (bundleName, "", "{\"reason\":\"Extension Backup Proxy is empty\"}"); + int32_t err = static_cast(BError::Codes::SA_INVAL_ARG); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "GetFileHandle", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); return BError(BError::Codes::SA_INVAL_ARG); } int32_t errCode = 0; @@ -1039,6 +1077,15 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) void Service::OnBackupExtensionDied(const string &&bundleName) { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); + int32_t errCode = static_cast(BError::Codes::EXT_ABILITY_DIED); + AppRadar::Info info (bundleName, "", ""); + if (session_->GetScenario() == IServiceReverse::Scenario::BACKUP) { + AppRadar::GetInstance().RecordBackupFuncRes(info, "OnBackupExtensionDied", GetUserIdDefault(), + BizStageBackup::BIZ_STAGE_EXTENSION_STATUS, errCode); + } else if (session_->GetScenario() == IServiceReverse::Scenario::RESTORE) { + AppRadar::GetInstance().RecordRestoreFuncRes(info, "OnBackupExtensionDied", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_EXTENSION_STATUS, errCode); + } try { string callName = move(bundleName); HILOGE("Backup <%{public}s> Extension Process Died", callName.c_str()); @@ -1150,6 +1197,14 @@ void Service::ExtConnectFailed(const string &bundleName, ErrCode ret) try { HILOGE("begin %{public}s", bundleName.data()); IServiceReverse::Scenario scenario = session_->GetScenario(); + AppRadar::Info info (bundleName, "", ""); + if (scenario == IServiceReverse::Scenario::BACKUP) { + AppRadar::GetInstance().RecordBackupFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), + BizStageBackup::BIZ_STAGE_APPLICATION, ret); + } else if (scenario == IServiceReverse::Scenario::RESTORE) { + AppRadar::GetInstance().RecordRestoreFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_CONNECT_BACKUP_EXTENSION, ret); + } if (scenario == IServiceReverse::Scenario::BACKUP && session_->GetIsIncrementalBackup()) { session_->GetServiceReverseProxy()->IncrementalBackupOnBundleStarted(ret, bundleName); } else if (scenario == IServiceReverse::Scenario::RESTORE && @@ -1454,6 +1509,17 @@ void Service::DeleteDisConfigFile() void Service::SessionDeactive() { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); + IServiceReverse::Scenario scenario = session_->GetScenario(); + AppRadar::Info info ("", "", ""); + if (scenario == IServiceReverse::Scenario::BACKUP) { + AppRadar::GetInstance().RecordBackupFuncRes(info, "SessionDeactive", AppRadar::GetInstance().GetUserId(), + BizStageBackup::BIZ_STAGE_CLIENT_STATUS, + static_cast(BError::Codes::SA_BROKEN_IPC)); + } else if (scenario == IServiceReverse::Scenario::RESTORE) { + AppRadar::GetInstance().RecordRestoreFuncRes(info, "SessionDeactive", AppRadar::GetInstance().GetUserId(), + BizStageRestore::BIZ_STAGE_CLIENT_STATUS, + static_cast(BError::Codes::SA_BROKEN_IPC)); + } try { HILOGI("Begin"); //清理处置状态 @@ -1581,6 +1647,9 @@ ErrCode Service::GetBackupInfoCmdHandle(BundleName &bundleName, std::string &res backupConnection->DisconnectBackupExtAbility(); if (ret != ERR_OK) { HILOGE("Call Ext GetBackupInfo faild."); + AppRadar::Info info(bundleName, "", ""); + Backup::AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::GetBackupInfoCmdHandle", + GetUserIdDefault(), BizStageBackup::BIZ_STAGE_GET_BACKUP_INFO, ret); return BError(BError::Codes::SA_INVAL_ARG); } @@ -1924,6 +1993,16 @@ std::function Service::TimeOutCallback(wptr ptr, std::string bu HILOGE("SessionPtr is nullptr."); return; } + IServiceReverse::Scenario scenario = sessionPtr->GetScenario(); + int32_t errCode = static_cast(BError::Codes::EXT_ABILITY_TIMEOUT); + AppRadar::Info info (bundleName, "", ""); + if (scenario == IServiceReverse::Scenario::BACKUP) { + AppRadar::GetInstance().RecordBackupFuncRes(info, "TimeOutCallback", GetUserIdDefault(), + BizStageBackup::BIZ_STAGE_ON_BACKUP, errCode); + } else if (scenario == IServiceReverse::Scenario::RESTORE) { + AppRadar::GetInstance().RecordRestoreFuncRes(info, "TimeOutCallback", GetUserIdDefault(), + BizStageRestore::BIZ_STAGE_EXEC_ON_RESTORE, errCode); + } try { if (SAUtils::IsSABundleName(bundleName)) { auto sessionConnection = sessionPtr->GetSAExtConnection(bundleName); -- Gitee From dfd28e29d97e09b429cdfc95bbdb55d134fa8d3d Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 18:41:35 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E7=82=B9=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/module_ipc/svc_session_manager.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/services/backup_sa/src/module_ipc/svc_session_manager.cpp b/services/backup_sa/src/module_ipc/svc_session_manager.cpp index dfdd81a85..92627bdc6 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -26,6 +26,7 @@ #include "b_file_info.h" #include "b_json/b_json_entity_caps.h" #include "b_json/b_json_entity_ext_manage.h" +#include "b_radar/b_radar.h" #include "b_resources/b_constants.h" #include "b_sa/b_sa_utils.h" #include "b_utils/b_time.h" @@ -42,9 +43,17 @@ void SvcSessionManager::VerifyCallerAndScenario(uint32_t clientToken, IServiceRe shared_lock lock(lock_); if (impl_.scenario != scenario) { HILOGE("Inconsistent scenario, impl scenario:%{public}d", impl_.scenario); + AppRadar::Info info("", "", "{\"reason\":\"Inconsistent scenario\"}"); + AppRadar::GetInstance().RecordDefaultFuncRes(info, "SvcSessionManager::VerifyCallerAndScenario", impl_.userId, + BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, + BError(BError::Codes::SDK_MIXED_SCENARIO).GetCode()); throw BError(BError::Codes::SDK_MIXED_SCENARIO); } if (impl_.clientToken != clientToken) { + AppRadar::Info info2("", "", "{\"reason\":\"Caller mismatched\"}"); + AppRadar::GetInstance().RecordDefaultFuncRes(info2, "SvcSessionManager::VerifyCallerAndScenario", impl_.userId, + BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, + BError(BError::Codes::SDK_MIXED_SCENARIO).GetCode()); throw BError(BError::Codes::SA_REFUSED_ACT, "Caller mismatched"); } HILOGD("Succeed to verify the caller"); @@ -358,6 +367,11 @@ void SvcSessionManager::InitClient(Impl &newImpl) HILOGW("It's curious that the backup sa dies before the backup client"); return; } + AppRadar::Info info ("", "", ""); + AppRadar::GetInstance().RecordDefaultFuncRes(info, "SvcSessionManager::InitClient", + AppRadar::GetInstance().GetUserId(), + BizStageBackup::BIZ_STAGE_CLIENT_STATUS, + BError(BError::Codes::SA_BROKEN_IPC).GetCode()); (void)revPtrStrong->SessionDeactive(); }; deathRecipient_ = sptr(new SvcDeathRecipient(callback)); -- Gitee From 1cb82e76d9a7e283eead1abbef6c89b3d77c65ea Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 18:46:05 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E7=82=B9=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_ipc/service.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 490659232..02c5aacdd 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -1077,13 +1077,13 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) void Service::OnBackupExtensionDied(const string &&bundleName) { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); - int32_t errCode = static_cast(BError::Codes::EXT_ABILITY_DIED); + int32_t errCode = BError(BError::Codes::EXT_ABILITY_DIED).GetCode(); AppRadar::Info info (bundleName, "", ""); if (session_->GetScenario() == IServiceReverse::Scenario::BACKUP) { - AppRadar::GetInstance().RecordBackupFuncRes(info, "OnBackupExtensionDied", GetUserIdDefault(), + AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::OnBackupExtensionDied", GetUserIdDefault(), BizStageBackup::BIZ_STAGE_EXTENSION_STATUS, errCode); } else if (session_->GetScenario() == IServiceReverse::Scenario::RESTORE) { - AppRadar::GetInstance().RecordRestoreFuncRes(info, "OnBackupExtensionDied", GetUserIdDefault(), + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::OnBackupExtensionDied", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_EXTENSION_STATUS, errCode); } try { @@ -1200,7 +1200,7 @@ void Service::ExtConnectFailed(const string &bundleName, ErrCode ret) AppRadar::Info info (bundleName, "", ""); if (scenario == IServiceReverse::Scenario::BACKUP) { AppRadar::GetInstance().RecordBackupFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), - BizStageBackup::BIZ_STAGE_APPLICATION, ret); + BizStageBackup::BIZ_STAGE_BACKUP_EXTENSION, ret); } else if (scenario == IServiceReverse::Scenario::RESTORE) { AppRadar::GetInstance().RecordRestoreFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_CONNECT_BACKUP_EXTENSION, ret); @@ -1994,13 +1994,13 @@ std::function Service::TimeOutCallback(wptr ptr, std::string bu return; } IServiceReverse::Scenario scenario = sessionPtr->GetScenario(); - int32_t errCode = static_cast(BError::Codes::EXT_ABILITY_TIMEOUT); + int32_t errCode = BError(BError::Codes::EXT_ABILITY_TIMEOUT).GetCode(); AppRadar::Info info (bundleName, "", ""); if (scenario == IServiceReverse::Scenario::BACKUP) { - AppRadar::GetInstance().RecordBackupFuncRes(info, "TimeOutCallback", GetUserIdDefault(), + AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), BizStageBackup::BIZ_STAGE_ON_BACKUP, errCode); } else if (scenario == IServiceReverse::Scenario::RESTORE) { - AppRadar::GetInstance().RecordRestoreFuncRes(info, "TimeOutCallback", GetUserIdDefault(), + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_EXEC_ON_RESTORE, errCode); } try { -- Gitee From 4c6035c693b6e5b6ae7fef75d46e8f502c2ccb80 Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 18:54:22 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E7=82=B9=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_ipc/service.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 02c5aacdd..05ed9ba60 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -213,7 +213,7 @@ static inline void PermissionCheckFailRadar(const std::string &info, const std:: AppRadar::Info resInfo("", "", info); AppRadar::GetInstance().RecordDefaultFuncRes(resInfo, funcPos.append(func), GetUserIdDefault(), BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, - static_cast(BError::Codes::SA_REFUSED_ACT)); + BError(BError::Codes::SA_REFUSED_ACT).GetCode()); } string Service::VerifyCallerAndGetCallerName() @@ -1041,18 +1041,20 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) auto backUpConnection = session_->GetExtConnection(bundleName); if (backUpConnection == nullptr) { HILOGE("GetFileHandle error, backUpConnection is empty"); - AppRadar::Info info (bundleName, "", "{\"reason\":\"backUpConnection is empty\"}"); - int32_t err = static_cast(BError::Codes::SA_INVAL_ARG); - AppRadar::GetInstance().RecordRestoreFuncRes(info, "GetFileHandle", GetUserIdDefault(), + std::string resInfo = "{\"result_info\": {\"reason\": \"backUpConnection is empty\"}" ; + AppRadar::Info info (bundleName, "", resInfo); + int32_t err = BError(BError::Codes::SA_INVAL_ARG).GetCode(); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::GetFileHandle", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); return BError(BError::Codes::SA_INVAL_ARG); } auto proxy = backUpConnection->GetBackupExtProxy(); if (!proxy) { HILOGE("GetFileHandle error, Extension backup Proxy is empty"); - AppRadar::Info info (bundleName, "", "{\"reason\":\"Extension Backup Proxy is empty\"}"); - int32_t err = static_cast(BError::Codes::SA_INVAL_ARG); - AppRadar::GetInstance().RecordRestoreFuncRes(info, "GetFileHandle", GetUserIdDefault(), + std::string resInfo = "{\"result_info\": {\"reason\": \"Extension backup Proxy is empty\"}" ; + AppRadar::Info info (bundleName, "", resInfo); + int32_t err = BError(BError::Codes::SA_INVAL_ARG).GetCode(); + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::GetFileHandle", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); return BError(BError::Codes::SA_INVAL_ARG); } @@ -1199,10 +1201,10 @@ void Service::ExtConnectFailed(const string &bundleName, ErrCode ret) IServiceReverse::Scenario scenario = session_->GetScenario(); AppRadar::Info info (bundleName, "", ""); if (scenario == IServiceReverse::Scenario::BACKUP) { - AppRadar::GetInstance().RecordBackupFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), + AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::ExtConnectFailed", GetUserIdDefault(), BizStageBackup::BIZ_STAGE_BACKUP_EXTENSION, ret); } else if (scenario == IServiceReverse::Scenario::RESTORE) { - AppRadar::GetInstance().RecordRestoreFuncRes(info, "ExtConnectFailed", GetUserIdDefault(), + AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::ExtConnectFailed", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_CONNECT_BACKUP_EXTENSION, ret); } if (scenario == IServiceReverse::Scenario::BACKUP && session_->GetIsIncrementalBackup()) { -- Gitee From 85a78d1552dc61189492133fad371538fdae2e9d Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 20:05:00 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_ipc/service.cpp | 20 +++++++++---------- .../src/module_ipc/svc_session_manager.cpp | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 05ed9ba60..a57c88037 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -224,7 +224,7 @@ string Service::VerifyCallerAndGetCallerName() if (tokenType == Security::AccessToken::ATokenTypeEnum::TOKEN_HAP) { Security::AccessToken::HapTokenInfo hapTokenInfo; if (Security::AccessToken::AccessTokenKit::GetHapTokenInfo(tokenCaller, hapTokenInfo) != 0) { - PermissionCheckFailRadar("{\"reason\":\"Get hap token info failed\"}", "VerifyCallerAndGetCallerName"); + PermissionCheckFailRadar("Get hap token info failed", "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, "Get hap token info failed"); } std::string bundleNameIndexInfo = BJsonUtil::BuildBundleNameIndexInfo(hapTokenInfo.bundleName, @@ -235,7 +235,7 @@ string Service::VerifyCallerAndGetCallerName() string str = to_string(tokenCaller); HILOGE("tokenID = %{private}s", GetAnonyString(str).c_str()); PermissionCheckFailRadar( - string("{\"reason\":\"Invalid token type ").append(to_string(tokenType)).append(string("\"}")), + string("Invalid token type").append(to_string(tokenType)).append(string("\"}")), "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, string("Invalid token type ").append(to_string(tokenType))); } @@ -250,7 +250,7 @@ void Service::VerifyCaller() case Security::AccessToken::ATokenTypeEnum::TOKEN_NATIVE: { /* Update Service */ if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(tokenCaller, BACKUP_PERMISSION) != Security::AccessToken::PermissionState::PERMISSION_GRANTED) { - std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + std::string info = "Permission denied, token type is " + to_string(tokenType); PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); @@ -260,14 +260,14 @@ void Service::VerifyCaller() case Security::AccessToken::ATokenTypeEnum::TOKEN_HAP: { if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(tokenCaller, BACKUP_PERMISSION) != Security::AccessToken::PermissionState::PERMISSION_GRANTED) { - std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + std::string info = "Permission denied, token type is " + to_string(tokenType); PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); } uint64_t fullTokenId = OHOS::IPCSkeleton::GetCallingFullTokenID(); if (!Security::AccessToken::TokenIdKit::IsSystemAppByFullTokenID(fullTokenId)) { - std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + std::string info = "Permission denied, token type is " + to_string(tokenType); PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Permission denied, token type is ").append(to_string(tokenType))); @@ -276,13 +276,13 @@ void Service::VerifyCaller() } case Security::AccessToken::ATokenTypeEnum::TOKEN_SHELL: if (IPCSkeleton::GetCallingUid() != BConstants::SYSTEM_UID) { - std::string info = "{\"reason\":\"invalid calling uid\"}"; + std::string info = "invalid calling uid"; PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, "Calling uid is invalid"); } break; default: - std::string info = "{\"reason\":\"Permission denied, token type is " + to_string(tokenType) + "\"}"; + std::string info = "Permission denied, token type is " + to_string(tokenType); PermissionCheckFailRadar(info, "VerifyCaller"); throw BError(BError::Codes::SA_REFUSED_ACT, string("Invalid token type ").append(to_string(tokenType))); break; @@ -1041,8 +1041,7 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) auto backUpConnection = session_->GetExtConnection(bundleName); if (backUpConnection == nullptr) { HILOGE("GetFileHandle error, backUpConnection is empty"); - std::string resInfo = "{\"result_info\": {\"reason\": \"backUpConnection is empty\"}" ; - AppRadar::Info info (bundleName, "", resInfo); + AppRadar::Info info (bundleName, "", "backUpConnection is empty"); int32_t err = BError(BError::Codes::SA_INVAL_ARG).GetCode(); AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::GetFileHandle", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); @@ -1051,8 +1050,7 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) auto proxy = backUpConnection->GetBackupExtProxy(); if (!proxy) { HILOGE("GetFileHandle error, Extension backup Proxy is empty"); - std::string resInfo = "{\"result_info\": {\"reason\": \"Extension backup Proxy is empty\"}" ; - AppRadar::Info info (bundleName, "", resInfo); + AppRadar::Info info (bundleName, "", "Extension backup Proxy is empty"); int32_t err = BError(BError::Codes::SA_INVAL_ARG).GetCode(); AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::GetFileHandle", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_GET_FILE_HANDLE, err); diff --git a/services/backup_sa/src/module_ipc/svc_session_manager.cpp b/services/backup_sa/src/module_ipc/svc_session_manager.cpp index 92627bdc6..e6018c4e7 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -43,14 +43,14 @@ void SvcSessionManager::VerifyCallerAndScenario(uint32_t clientToken, IServiceRe shared_lock lock(lock_); if (impl_.scenario != scenario) { HILOGE("Inconsistent scenario, impl scenario:%{public}d", impl_.scenario); - AppRadar::Info info("", "", "{\"reason\":\"Inconsistent scenario\"}"); + AppRadar::Info info("", "", "Inconsistent scenario"); AppRadar::GetInstance().RecordDefaultFuncRes(info, "SvcSessionManager::VerifyCallerAndScenario", impl_.userId, BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, BError(BError::Codes::SDK_MIXED_SCENARIO).GetCode()); throw BError(BError::Codes::SDK_MIXED_SCENARIO); } if (impl_.clientToken != clientToken) { - AppRadar::Info info2("", "", "{\"reason\":\"Caller mismatched\"}"); + AppRadar::Info info2("", "", "Caller mismatched"); AppRadar::GetInstance().RecordDefaultFuncRes(info2, "SvcSessionManager::VerifyCallerAndScenario", impl_.userId, BizStageBackup::BIZ_STAGE_PERMISSION_CHECK, BError(BError::Codes::SDK_MIXED_SCENARIO).GetCode()); -- Gitee From a0bd71b79f444879f83424f43936a48219912dd1 Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 20:20:25 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chensihan --- .../src/b_incremental_restore_session.cpp | 2 +- .../b_incremental_session_restore_async.cpp | 2 +- .../src/b_session_restore.cpp | 2 +- .../src/b_session_restore_async.cpp | 2 +- services/backup_sa/src/module_ipc/service.cpp | 20 ++----------------- .../src/module_ipc/svc_session_manager.cpp | 2 +- 6 files changed, 7 insertions(+), 23 deletions(-) diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp index f270104a5..ac3996d48 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp @@ -55,7 +55,7 @@ unique_ptr BIncrementalRestoreSession::Init(Callback int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacks))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); - AppRadar::Info info ("", "", ""); + AppRadar::Info info ("", "", "create restore session failed"); AppRadar::GetInstance().RecordRestoreFuncRes(info, "BIncrementalRestoreSession::Init", AppRadar::GetInstance().GetUserId(), BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp index be89cc611..23866769d 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp @@ -63,7 +63,7 @@ shared_ptr BIncrementalSessionRestoreAsync::Ini int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacksTmp))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); - AppRadar::Info info ("", "", ""); + AppRadar::Info info ("", "", "create restore session failed"); AppRadar::GetInstance().RecordRestoreFuncRes(info, "BIncrementalSessionRestoreAsync::Init", AppRadar::GetInstance().GetUserId(), BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp index 815072997..62fca493f 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp @@ -55,7 +55,7 @@ unique_ptr BSessionRestore::Init(Callbacks callbacks) int32_t res = proxy->InitRestoreSession(new ServiceReverse(callbacks)); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); - AppRadar::Info info ("", "", ""); + AppRadar::Info info ("", "", "create restore session failed"); AppRadar::GetInstance().RecordRestoreFuncRes(info, "BSessionRestore::Init", AppRadar::GetInstance().GetUserId(), BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp index 5a96c9f74..f3b7c7a1f 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp @@ -64,7 +64,7 @@ shared_ptr BSessionRestoreAsync::Init(Callbacks callbacks) int32_t res = proxy->InitRestoreSession(sptr(new ServiceReverse(callbacksTmp))); if (res != 0) { HILOGE("Failed to Restore because of %{public}d", res); - AppRadar::Info info ("", "", ""); + AppRadar::Info info ("", "", "create restore session failed"); AppRadar::GetInstance().RecordRestoreFuncRes(info, "BSessionRestoreAsync::Init", AppRadar::GetInstance().GetUserId(), BizStageRestore::BIZ_STAGE_CREATE_SESSION_RESTORE, res); diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index a57c88037..aac8d4275 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -485,9 +485,6 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, const vectorDecreaseSessionCnt(__PRETTY_FUNCTION__); return e.GetCode(); @@ -557,9 +554,6 @@ ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd, return BError(BError::Codes::OK); } catch (const BError &e) { HILOGE("Catch exception"); - AppRadar::Info info ("", "", ""); - AppRadar::GetInstance().RecordRestoreFuncRes(info, "AppendBundlesRestoreSession", GetUserIdDefault(), - BizStageRestore::BIZ_STAGE_APPEND_BUNDLES, e.GetCode()); HandleExceptionOnAppendBundles(session_, bundleNames, {}); session_->DecreaseSessionCnt(__PRETTY_FUNCTION__); return e.GetCode(); @@ -1509,17 +1503,6 @@ void Service::DeleteDisConfigFile() void Service::SessionDeactive() { HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); - IServiceReverse::Scenario scenario = session_->GetScenario(); - AppRadar::Info info ("", "", ""); - if (scenario == IServiceReverse::Scenario::BACKUP) { - AppRadar::GetInstance().RecordBackupFuncRes(info, "SessionDeactive", AppRadar::GetInstance().GetUserId(), - BizStageBackup::BIZ_STAGE_CLIENT_STATUS, - static_cast(BError::Codes::SA_BROKEN_IPC)); - } else if (scenario == IServiceReverse::Scenario::RESTORE) { - AppRadar::GetInstance().RecordRestoreFuncRes(info, "SessionDeactive", AppRadar::GetInstance().GetUserId(), - BizStageRestore::BIZ_STAGE_CLIENT_STATUS, - static_cast(BError::Codes::SA_BROKEN_IPC)); - } try { HILOGI("Begin"); //清理处置状态 @@ -1995,11 +1978,12 @@ std::function Service::TimeOutCallback(wptr ptr, std::string bu } IServiceReverse::Scenario scenario = sessionPtr->GetScenario(); int32_t errCode = BError(BError::Codes::EXT_ABILITY_TIMEOUT).GetCode(); - AppRadar::Info info (bundleName, "", ""); if (scenario == IServiceReverse::Scenario::BACKUP) { + AppRadar::Info info (bundleName, "", "on backup timeout"); AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), BizStageBackup::BIZ_STAGE_ON_BACKUP, errCode); } else if (scenario == IServiceReverse::Scenario::RESTORE) { + AppRadar::Info info (bundleName, "", "on restore timeout"); AppRadar::GetInstance().RecordRestoreFuncRes(info, "Service::TimeOutCallback", GetUserIdDefault(), BizStageRestore::BIZ_STAGE_EXEC_ON_RESTORE, errCode); } diff --git a/services/backup_sa/src/module_ipc/svc_session_manager.cpp b/services/backup_sa/src/module_ipc/svc_session_manager.cpp index e6018c4e7..467baedb1 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -367,7 +367,7 @@ void SvcSessionManager::InitClient(Impl &newImpl) HILOGW("It's curious that the backup sa dies before the backup client"); return; } - AppRadar::Info info ("", "", ""); + AppRadar::Info info ("", "", "client died"); AppRadar::GetInstance().RecordDefaultFuncRes(info, "SvcSessionManager::InitClient", AppRadar::GetInstance().GetUserId(), BizStageBackup::BIZ_STAGE_CLIENT_STATUS, -- Gitee From ac4fb2cecde816ecd73da7f0b5f92cd63e1cad1e Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 20:38:56 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_ipc/service.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index aac8d4275..8340c7b4c 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -234,9 +234,8 @@ string Service::VerifyCallerAndGetCallerName() } else { string str = to_string(tokenCaller); HILOGE("tokenID = %{private}s", GetAnonyString(str).c_str()); - PermissionCheckFailRadar( - string("Invalid token type").append(to_string(tokenType)).append(string("\"}")), - "VerifyCallerAndGetCallerName"); + PermissionCheckFailRadar(string("Invalid token type").append(to_string(tokenType)).append(string("\"}")), + "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, string("Invalid token type ").append(to_string(tokenType))); } } @@ -1630,9 +1629,9 @@ ErrCode Service::GetBackupInfoCmdHandle(BundleName &bundleName, std::string &res backupConnection->DisconnectBackupExtAbility(); if (ret != ERR_OK) { HILOGE("Call Ext GetBackupInfo faild."); - AppRadar::Info info(bundleName, "", ""); - Backup::AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::GetBackupInfoCmdHandle", - GetUserIdDefault(), BizStageBackup::BIZ_STAGE_GET_BACKUP_INFO, ret); + AppRadar::Info info(bundleName, "", "Call Ext GetBackupInfo faild"); + Backup::AppRadar::GetInstance().RecordBackupFuncRes(info, "Service::GetBackupInfoCmdHandle", GetUserIdDefault(), + BizStageBackup::BIZ_STAGE_GET_BACKUP_INFO, ret); return BError(BError::Codes::SA_INVAL_ARG); } -- Gitee From 3c253686c113a48772b327d8c7165981b4a1d95f Mon Sep 17 00:00:00 2001 From: chensihan Date: Tue, 27 Aug 2024 20:48:19 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F=20Sign?= =?UTF-8?q?ed-off-by:=20chensihan=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/backup_sa/src/module_ipc/service.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 8340c7b4c..ea2354595 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -234,8 +234,8 @@ string Service::VerifyCallerAndGetCallerName() } else { string str = to_string(tokenCaller); HILOGE("tokenID = %{private}s", GetAnonyString(str).c_str()); - PermissionCheckFailRadar(string("Invalid token type").append(to_string(tokenType)).append(string("\"}")), - "VerifyCallerAndGetCallerName"); + std::string info = string("Invalid token type").append(to_string(tokenType)).append(string("\"}")); + PermissionCheckFailRadar(info, "VerifyCallerAndGetCallerName"); throw BError(BError::Codes::SA_INVAL_ARG, string("Invalid token type ").append(to_string(tokenType))); } } -- Gitee