From ba628c4593fcd93435551482157069f56fa909bb Mon Sep 17 00:00:00 2001 From: huaqingsimeng Date: Fri, 24 Nov 2023 14:54:52 +0800 Subject: [PATCH] =?UTF-8?q?hilog=E6=97=A5=E5=BF=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- .../native/backup_ext/src/ext_extension.cpp | 7 ++- .../backup_ext/src/ext_extension_stub.cpp | 5 -- .../src/module_external/bms_adapter.cpp | 3 -- services/backup_sa/src/module_ipc/service.cpp | 46 +++++++++---------- .../src/module_ipc/svc_session_manager.cpp | 10 +--- .../src/module_sched/sched_scheduler.cpp | 2 +- utils/include/b_json/b_json_cached_entity.h | 2 +- utils/include/b_json/b_json_entity_caps.h | 1 - utils/src/b_filesystem/b_dir.cpp | 4 +- utils/src/b_json/b_json_entity_ext_manage.cpp | 4 +- 10 files changed, 32 insertions(+), 52 deletions(-) diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index e5d16903c..27e77e868 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -55,7 +55,6 @@ using namespace std; void BackupExtExtension::VerifyCaller() { - HILOGI("begin"); uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID(); int tokenType = Security::AccessToken::AccessTokenKit::GetTokenType(tokenCaller); if (tokenType != Security::AccessToken::ATokenTypeEnum::TOKEN_NATIVE) { @@ -72,7 +71,7 @@ UniqueFd BackupExtExtension::GetFileHandle(const string &fileName) { try { if (extension_->GetExtensionAction() != BConstants::ExtensionAction::RESTORE) { - HILOGI("Failed to get file handle, because action is %{public}d invalid", extension_->GetExtensionAction()); + HILOGE("Failed to get file handle, because action is %{public}d invalid", extension_->GetExtensionAction()); throw BError(BError::Codes::EXT_INVAL_ARG, "Action is invalid"); } @@ -531,7 +530,7 @@ void BackupExtExtension::AsyncTaskRestoreForUpgrade() "extension handle have been already released"); auto callBackup = [obj]() { - HILOGI("begin call restore"); + HILOGI("extension onRestore end"); auto extensionPtr = obj.promote(); BExcepUltils::BAssert(extensionPtr, BError::Codes::EXT_BROKEN_FRAMEWORK, "Ext extension handle have been already released"); @@ -604,7 +603,7 @@ void BackupExtExtension::AsyncTaskOnBackup() "extension handle have been already released"); auto callBackup = [obj]() { - HILOGI("begin call backup"); + HILOGI("extension onbackup end"); auto extensionPtr = obj.promote(); BExcepUltils::BAssert(extensionPtr, BError::Codes::EXT_BROKEN_FRAMEWORK, "Ext extension handle have been already released"); diff --git a/frameworks/native/backup_ext/src/ext_extension_stub.cpp b/frameworks/native/backup_ext/src/ext_extension_stub.cpp index c98380a37..c589d7425 100644 --- a/frameworks/native/backup_ext/src/ext_extension_stub.cpp +++ b/frameworks/native/backup_ext/src/ext_extension_stub.cpp @@ -63,7 +63,6 @@ int32_t ExtExtensionStub::OnRemoteRequest(uint32_t code, ErrCode ExtExtensionStub::CmdGetFileHandle(MessageParcel &data, MessageParcel &reply) { - HILOGI("Begin"); string fileName; if (!data.ReadString(fileName)) { return BError(BError::Codes::EXT_INVAL_ARG, "Failed to receive fileName").GetCode(); @@ -78,7 +77,6 @@ ErrCode ExtExtensionStub::CmdGetFileHandle(MessageParcel &data, MessageParcel &r ErrCode ExtExtensionStub::CmdHandleClear(MessageParcel &data, MessageParcel &reply) { - HILOGI("Begin"); ErrCode res = HandleClear(); if (!reply.WriteInt32(res)) { stringstream ss; @@ -90,7 +88,6 @@ ErrCode ExtExtensionStub::CmdHandleClear(MessageParcel &data, MessageParcel &rep ErrCode ExtExtensionStub::CmdHandleBackup(MessageParcel &data, MessageParcel &reply) { - HILOGI("Begin"); ErrCode res = HandleBackup(); if (!reply.WriteInt32(res)) { stringstream ss; @@ -102,7 +99,6 @@ ErrCode ExtExtensionStub::CmdHandleBackup(MessageParcel &data, MessageParcel &re ErrCode ExtExtensionStub::CmdPublishFile(MessageParcel &data, MessageParcel &reply) { - HILOGI("Begin"); string fileName; if (!data.ReadString(fileName)) { return BError(BError::Codes::EXT_INVAL_ARG, "Failed to receive fileName"); @@ -119,7 +115,6 @@ ErrCode ExtExtensionStub::CmdPublishFile(MessageParcel &data, MessageParcel &rep ErrCode ExtExtensionStub::CmdHandleRestore(MessageParcel &data, MessageParcel &reply) { - HILOGI("Begin"); ErrCode res = HandleRestore(); if (!reply.WriteInt32(res)) { stringstream ss; diff --git a/services/backup_sa/src/module_external/bms_adapter.cpp b/services/backup_sa/src/module_external/bms_adapter.cpp index 2e2a25e94..d3ad3df1d 100644 --- a/services/backup_sa/src/module_external/bms_adapter.cpp +++ b/services/backup_sa/src/module_external/bms_adapter.cpp @@ -76,13 +76,11 @@ static tuple GetAllowAndExtName(const vector BundleMgrAdapter::GetBundleInfos(int32_t use for (auto const &installedBundle : installedBundles) { if (installedBundle.applicationInfo.codePath == HMOS_HAP_CODE_PATH || installedBundle.applicationInfo.codePath == LINUX_HAP_CODE_PATH) { - HILOGI("Unsupported applications, name : %{public}s", installedBundle.name.data()); continue; } auto [allToBackup, extName, restoreDeps] = GetAllowAndExtName(installedBundle.extensionInfos); diff --git a/services/backup_sa/src/module_ipc/service.cpp b/services/backup_sa/src/module_ipc/service.cpp index 937146137..137dae58f 100644 --- a/services/backup_sa/src/module_ipc/service.cpp +++ b/services/backup_sa/src/module_ipc/service.cpp @@ -123,10 +123,10 @@ UniqueFd Service::GetLocalCapabilities() HILOGE("GetLocalCapabilities failed, errCode = %{public}d", e.GetCode()); return UniqueFd(-e.GetCode()); } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return UniqueFd(-EPERM); } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return UniqueFd(-EPERM); } } @@ -372,10 +372,10 @@ ErrCode Service::PublishFile(const BFileInfo &fileInfo) } catch (const BError &e) { return e.GetCode(); } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return EPERM; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return EPERM; } } @@ -415,10 +415,10 @@ ErrCode Service::AppFileReady(const string &fileName, UniqueFd fd) } catch (const BError &e) { return e.GetCode(); // 任意异常产生,终止监听该任务 } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return EPERM; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return EPERM; } } @@ -450,10 +450,10 @@ ErrCode Service::AppDone(ErrCode errCode) } catch (const BError &e) { return e.GetCode(); // 任意异常产生,终止监听该任务 } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return EPERM; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return EPERM; } } @@ -492,10 +492,10 @@ ErrCode Service::LaunchBackupExtension(const BundleName &bundleName) } catch (const BError &e) { return e.GetCode(); } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return EPERM; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return EPERM; } } @@ -536,10 +536,10 @@ ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName) } catch (const BError &e) { return e.GetCode(); } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return EPERM; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return EPERM; } } @@ -565,10 +565,10 @@ void Service::OnBackupExtensionDied(const string &&bundleName, ErrCode ret) } catch (const BError &e) { return; } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return; } } @@ -576,7 +576,7 @@ void Service::OnBackupExtensionDied(const string &&bundleName, ErrCode ret) void Service::ExtStart(const string &bundleName) { try { - HILOGE("begin %{public}s", bundleName.data()); + HILOGI("begin %{public}s", bundleName.data()); IServiceReverse::Scenario scenario = session_->GetScenario(); auto backUpConnection = session_->GetExtConnection(bundleName); auto proxy = backUpConnection->GetBackupExtProxy(); @@ -613,10 +613,10 @@ void Service::ExtStart(const string &bundleName) } catch (const BError &e) { return; } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return; } } @@ -651,10 +651,10 @@ void Service::ExtConnectFailed(const string &bundleName, ErrCode ret) } catch (const BError &e) { return; } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return; } } @@ -699,10 +699,10 @@ void Service::ExtConnectDone(string bundleName) } catch (const BError &e) { return; } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return; } } @@ -717,10 +717,10 @@ void Service::ClearSessionAndSchedInfo(const string &bundleName) } catch (const BError &e) { return; } catch (const exception &e) { - HILOGI("Catched an unexpected low-level exception %{public}s", e.what()); + HILOGE("Catched an unexpected low-level exception %{public}s", e.what()); return; } catch (...) { - HILOGI("Unexpected exception"); + HILOGE("Unexpected exception"); return; } } 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 59d98db8e..33d6be1e0 100644 --- a/services/backup_sa/src/module_ipc/svc_session_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_session_manager.cpp @@ -190,7 +190,6 @@ UniqueFd SvcSessionManager::OnBunleExtManageInfo(const string &bundleName, Uniqu void SvcSessionManager::RemoveExtInfo(const string &bundleName) { - HILOGI("Begin"); unique_lock lock(lock_); auto it = impl_.backupExtNameMap.find(bundleName); if (it == impl_.backupExtNameMap.end()) { @@ -204,7 +203,6 @@ void SvcSessionManager::RemoveExtInfo(const string &bundleName) wptr SvcSessionManager::GetExtConnection(const BundleName &bundleName) { - HILOGI("Begin"); shared_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -278,7 +276,6 @@ void SvcSessionManager::InitClient(Impl &newImpl) void SvcSessionManager::SetExtFileNameRequest(const string &bundleName, const string &fileName) { - HILOGI("Begin"); unique_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -290,7 +287,6 @@ void SvcSessionManager::SetExtFileNameRequest(const string &bundleName, const st std::set SvcSessionManager::GetExtFileNameRequest(const std::string &bundleName) { - HILOGI("Begin"); unique_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -335,7 +331,6 @@ bool SvcSessionManager::GetSchedBundleName(string &bundleName) BConstants::ServiceSchedAction SvcSessionManager::GetServiceSchedAction(const std::string &bundleName) { - HILOGI("Begin"); shared_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -346,7 +341,6 @@ BConstants::ServiceSchedAction SvcSessionManager::GetServiceSchedAction(const st void SvcSessionManager::SetServiceSchedAction(const string &bundleName, BConstants::ServiceSchedAction action) { - HILOGI("Begin"); unique_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -361,7 +355,6 @@ void SvcSessionManager::SetServiceSchedAction(const string &bundleName, BConstan void SvcSessionManager::SetBackupExtName(const string &bundleName, const string &backupExtName) { - HILOGI("Begin"); unique_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -373,7 +366,6 @@ void SvcSessionManager::SetBackupExtName(const string &bundleName, const string string SvcSessionManager::GetBackupExtName(const string &bundleName) { - HILOGI("Begin"); shared_lock lock(lock_); if (!impl_.clientToken) { throw BError(BError::Codes::SA_INVAL_ARG, "No caller token was specified"); @@ -608,7 +600,7 @@ uint32_t SvcSessionManager::CalAppProcessTime(const std::string &bundleName) timeout = defaultTimeout; } resTimeoutMs = (uint32_t)(timeout * invertMillisecond % UINT_MAX); /* conver second to millisecond */ - HILOGI("Calculate App extension process run timeout=%{public}u(s), bundleName=%{public}s ", + HILOGI("Calculate App extension process run timeout=%{public}u(ms), bundleName=%{public}s ", resTimeoutMs, bundleName.c_str()); return resTimeoutMs; } diff --git a/services/backup_sa/src/module_sched/sched_scheduler.cpp b/services/backup_sa/src/module_sched/sched_scheduler.cpp index f7c009d7c..0ec0b4cdb 100644 --- a/services/backup_sa/src/module_sched/sched_scheduler.cpp +++ b/services/backup_sa/src/module_sched/sched_scheduler.cpp @@ -50,7 +50,7 @@ void SchedScheduler::Sched(string bundleName) sessionPtr_->SetServiceSchedAction(bundleName, BConstants::ServiceSchedAction::INSTALLING); } } - HILOGE("Sched bundleName %{public}s", bundleName.data()); + HILOGD("Sched bundleName %{public}s", bundleName.data()); auto callStart = [schedPtr {wptr(this)}, bundleName]() { try { auto ptr = schedPtr.promote(); diff --git a/utils/include/b_json/b_json_cached_entity.h b/utils/include/b_json/b_json_cached_entity.h index 8413c5615..0eddef43b 100644 --- a/utils/include/b_json/b_json_cached_entity.h +++ b/utils/include/b_json/b_json_cached_entity.h @@ -58,7 +58,7 @@ public: { Json::StreamWriterBuilder builder; const std::string jsonFileContent = Json::writeString(builder, obj_); - HILOGI("Try to persist a Json object, whose content reads: %{public}s", jsonFileContent.c_str()); + HILOGD("Try to persist a Json object, whose content reads: %{public}s", jsonFileContent.c_str()); BFile::Write(srcFile_, jsonFileContent); } diff --git a/utils/include/b_json/b_json_entity_caps.h b/utils/include/b_json/b_json_entity_caps.h index db51d4270..e52dd173b 100644 --- a/utils/include/b_json/b_json_entity_caps.h +++ b/utils/include/b_json/b_json_entity_caps.h @@ -110,7 +110,6 @@ public: string restoreDeps(""); if (item.isMember("restoreDeps") && item["restoreDeps"].isString()) { restoreDeps = item["restoreDeps"].asString(); - HILOGI("restoreDeps is %{public}s", restoreDeps.data()); } bundleInfos.emplace_back(BundleInfo {item["name"].asString(), item["versionCode"].asUInt(), item["versionName"].asString(), item["spaceOccupied"].asInt64(), diff --git a/utils/src/b_filesystem/b_dir.cpp b/utils/src/b_filesystem/b_dir.cpp index 045a96ce5..404e99382 100644 --- a/utils/src/b_filesystem/b_dir.cpp +++ b/utils/src/b_filesystem/b_dir.cpp @@ -76,7 +76,7 @@ static pair> GetDirFilesDetail(const string &p } } - return {BError(BError::Codes::OK).GetCode(), files}; + return {ERR_OK, files}; } tuple> BDir::GetDirFiles(const string &path) @@ -100,7 +100,7 @@ tuple> BDir::GetDirFiles(const string &path) } } - return {BError(BError::Codes::OK).GetCode(), files}; + return {ERR_OK, files}; } static set ExpandPathWildcard(const vector &vec) diff --git a/utils/src/b_json/b_json_entity_ext_manage.cpp b/utils/src/b_json/b_json_entity_ext_manage.cpp index bff04e1d7..69c66d1ef 100644 --- a/utils/src/b_json/b_json_entity_ext_manage.cpp +++ b/utils/src/b_json/b_json_entity_ext_manage.cpp @@ -46,7 +46,7 @@ static bool CheckBigFile(const string &tarFile) static bool CheckUserTar(const string &fileName) { if (access(fileName.c_str(), F_OK) != 0) { - HILOGI("file does not exists"); + HILOGE("file does not exists"); return false; } @@ -201,8 +201,6 @@ std::vector BJsonEntityExtManage::GetExtManageInfo() const string fileName = item.isMember("fileName") && item["fileName"].isString() ? item["fileName"].asString() : ""; bool isUserTar = item.isMember("isUserTar") && item["isUserTar"].isBool() ? item["isUserTar"].asBool() : false; bool isBigFile = item.isMember("isBigFile") && item["isBigFile"].isBool() ? item["isBigFile"].asBool() : false; - HILOGI("GetExtManageInfo, fileName:%{public}s, isUserTar:%{public}d, isBigFile:%{public}d", fileName.data(), - isUserTar, isBigFile); if (!fileName.empty() && !path.empty()) { ExtManageInfo info = { .hashName = fileName, .fileName = path, .sta = sta, .isUserTar = isUserTar, .isBigFile = isBigFile}; -- Gitee