From 8b0996ff05def9146ee710eef2526e6f21ddb756 Mon Sep 17 00:00:00 2001 From: "Zhangyao(Maggie)" Date: Wed, 22 Jan 2025 09:56:07 +0800 Subject: [PATCH] strengthen Signed-off-by: Zhangyao(Maggie) --- services/backup_sa/src/module_external/sms_adapter.cpp | 7 +++++-- services/backup_sa/src/module_ipc/service.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/services/backup_sa/src/module_external/sms_adapter.cpp b/services/backup_sa/src/module_external/sms_adapter.cpp index d37937369..81ceb224f 100644 --- a/services/backup_sa/src/module_external/sms_adapter.cpp +++ b/services/backup_sa/src/module_external/sms_adapter.cpp @@ -31,6 +31,7 @@ const string MEDIA_LIBRARY_HAP = "com.ohos.medialibrary.medialibrarydata"; const string EXTERNAL_FILE_HAP = "com.ohos.UserFile.ExternalFileManager"; const string MEDIA_TYPE = "media"; const string FILE_TYPE = "file"; +const int64_t ERR_SIZE = -1; } // namespace static sptr GetStorageManager() @@ -64,12 +65,14 @@ int64_t StorageMgrAdapter::GetUserStorageStats(const std::string &bundleName, in auto storageMgr = GetStorageManager(); if (bundleName == MEDIA_LIBRARY_HAP) { if (storageMgr->GetUserStorageStatsByType(userId, bundleStats, MEDIA_TYPE)) { - throw BError(BError::Codes::SA_BROKEN_IPC, "Failed to get user media storage stats"); + HILOGE("Failed to get user media storage stats"); + return ERR_SIZE; } return bundleStats.image_ + bundleStats.video_; } else if (bundleName == EXTERNAL_FILE_HAP) { if (storageMgr->GetUserStorageStatsByType(userId, bundleStats, FILE_TYPE)) { - throw BError(BError::Codes::SA_BROKEN_IPC, "Failed to get user file storage stats"); + HILOGE("Failed to get user file storage stats"); + return ERR_SIZE; } return bundleStats.file_; } diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 91fd3273b..a92081330 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -1221,7 +1221,7 @@ void Service::ExtConnectFailed(const string &bundleName, ErrCode ret) ReportOnExtConnectFailed(scenario, bundleName, ret); SendEndAppGalleryNotify(bundleName); ClearSessionAndSchedInfo(bundleName); - NoticeClientFinish(bundleName, BError(BError::Codes::EXT_ABILITY_DIED)); + OnAllBundlesFinished(BError(BError::Codes::OK)); return; } catch (const BError &e) { HILOGE("ExtConnectFailed exception, bundleName:%{public}s", bundleName.c_str()); -- Gitee