From 8c7eeab0440e98d05640a329189c14f2f44c6582 Mon Sep 17 00:00:00 2001 From: wang19954 Date: Mon, 1 Sep 2025 15:20:45 +0800 Subject: [PATCH 1/2] IssueNo:#ICVRLD Description:fix codecheck Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangtiantian --- .../src/app_control/app_control_proxy.cpp | 12 ++++++------ .../src/bundle_resource/bundle_resource_proxy.cpp | 2 +- .../src/bundlemgr/bundle_installer_proxy.cpp | 10 +++++----- .../src/bundlemgr/bundle_mgr_mini_proxy.cpp | 2 +- .../src/overlay/overlay_manager_host.cpp | 2 +- .../bundle_distributed_manager.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/interfaces/inner_api/appexecfwk_core/src/app_control/app_control_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/app_control/app_control_proxy.cpp index 71711f25bb..356566511d 100644 --- a/interfaces/inner_api/appexecfwk_core/src/app_control/app_control_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/app_control/app_control_proxy.cpp @@ -209,7 +209,7 @@ ErrCode AppControlProxy::DeleteAppRunningControlRule(int32_t userId) ErrCode AppControlProxy::GetAppRunningControlRule(int32_t userId, std::vector &appIds) { - LOG_D(BMS_TAG_DEFAULT, "begin to call GetAppInstallControlRule"); + LOG_D(BMS_TAG_DEFAULT, "begin to call GetAppRunningControlRule"); MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { LOG_E(BMS_TAG_DEFAULT, "WriteInterfaceToken failed"); @@ -232,7 +232,7 @@ ErrCode AppControlProxy::GetAppRunningControlRule( return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(bundleName)) { - LOG_E(BMS_TAG_DEFAULT, "fail to GetMediaData due to write bundleName fail"); + LOG_E(BMS_TAG_DEFAULT, "write bundleName fail"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteInt32(userId)) { @@ -274,7 +274,7 @@ ErrCode AppControlProxy::ConfirmAppJumpControlRule(const std::string &callerBund ErrCode AppControlProxy::AddAppJumpControlRule(const std::vector &controlRules, int32_t userId) { if (controlRules.empty()) { - LOG_E(BMS_TAG_DEFAULT, "DeleteAppJumpControlRule failed due to params error"); + LOG_E(BMS_TAG_DEFAULT, "AddAppJumpControlRule failed due to params error"); return ERR_BUNDLE_MANAGER_INVALID_PARAMETER; } MessageParcel data; @@ -362,11 +362,11 @@ ErrCode AppControlProxy::GetAppJumpControlRule(const std::string &callerBundleNa return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(callerBundleName)) { - LOG_E(BMS_TAG_DEFAULT, "fail to write callerBundleName fail"); + LOG_E(BMS_TAG_DEFAULT, "fail to write callerBundleName"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(targetBundleName)) { - LOG_E(BMS_TAG_DEFAULT, "fail to write targetBundleName fail"); + LOG_E(BMS_TAG_DEFAULT, "fail to write targetBundleName"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteInt32(userId)) { @@ -451,7 +451,7 @@ ErrCode AppControlProxy::GetDisposedStatus(const std::string &appId, Want &want, return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(appId)) { - LOG_E(BMS_TAG_DEFAULT, "write bundleName failed"); + LOG_E(BMS_TAG_DEFAULT, "write appId failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteInt32(userId)) { diff --git a/interfaces/inner_api/appexecfwk_core/src/bundle_resource/bundle_resource_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundle_resource/bundle_resource_proxy.cpp index 50481462f8..dc75e6b10b 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundle_resource/bundle_resource_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundle_resource/bundle_resource_proxy.cpp @@ -82,7 +82,7 @@ ErrCode BundleResourceProxy::GetBundleResourceInfo(const std::string &bundleName return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteInt32(appIndex)) { - APP_LOGE("fail to write flags"); + APP_LOGE("fail to write appIndex"); return ERR_APPEXECFWK_PARCEL_ERROR; } return GetParcelInfo( diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp index 1875578ba4..3f8c3f0881 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_installer_proxy.cpp @@ -213,7 +213,7 @@ ErrCode BundleInstallerProxy::InstallSandboxApp(const std::string &bundleName, i return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } if (!data.WriteInt32(dlpType)) { - LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write appIndex fail"); + LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write dlpType fail"); return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } if (!data.WriteInt32(userId)) { @@ -243,19 +243,19 @@ ErrCode BundleInstallerProxy::UninstallSandboxApp(const std::string &bundleName, MessageOption option(MessageOption::TF_SYNC); if (!data.WriteInterfaceToken(GetDescriptor())) { - LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write MessageParcel fail"); + LOG_E(BMS_TAG_INSTALLER, "failed to UninstallSandboxApp due to write MessageParcel fail"); return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } if (!data.WriteString16(Str8ToStr16(bundleName))) { - LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write bundleName fail"); + LOG_E(BMS_TAG_INSTALLER, "failed to UninstallSandboxApp due to write bundleName fail"); return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } if (!data.WriteInt32(appIndex)) { - LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write appIndex fail"); + LOG_E(BMS_TAG_INSTALLER, "failed to UninstallSandboxApp due to write appIndex fail"); return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } if (!data.WriteInt32(userId)) { - LOG_E(BMS_TAG_INSTALLER, "failed to InstallSandboxApp due to write userId fail"); + LOG_E(BMS_TAG_INSTALLER, "failed to UninstallSandboxApp due to write userId fail"); return ERR_APPEXECFWK_SANDBOX_INSTALL_WRITE_PARCEL_ERROR; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_mini_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_mini_proxy.cpp index 3c4e4bc279..99169b506a 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_mini_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_mini_proxy.cpp @@ -120,7 +120,7 @@ int32_t BundleMgrMiniProxy::GetUidByBundleName(const std::string &bundleName, co return Constants::INVALID_UID; } if (!data.WriteInt32(appIndex)) { - APP_LOGE("failed to GetUidByBundleName due to write uid fail"); + APP_LOGE("failed to GetUidByBundleName due to write appIndex fail"); return Constants::INVALID_UID; } diff --git a/interfaces/inner_api/appexecfwk_core/src/overlay/overlay_manager_host.cpp b/interfaces/inner_api/appexecfwk_core/src/overlay/overlay_manager_host.cpp index a2fa33663b..aea19ef750 100644 --- a/interfaces/inner_api/appexecfwk_core/src/overlay/overlay_manager_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/overlay/overlay_manager_host.cpp @@ -42,7 +42,7 @@ int OverlayManagerHost::OnRemoteRequest(uint32_t code, MessageParcel& data, std::u16string descriptor = OverlayManagerHost::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { - APP_LOGE("fail to write reply message in bundle mgr host due to the reply is nullptr"); + APP_LOGE("descriptor invalid"); return OBJECT_NULL; } diff --git a/services/bundlemgr/src/distributed_manager/bundle_distributed_manager.cpp b/services/bundlemgr/src/distributed_manager/bundle_distributed_manager.cpp index 68be4abb0e..3304312931 100644 --- a/services/bundlemgr/src/distributed_manager/bundle_distributed_manager.cpp +++ b/services/bundlemgr/src/distributed_manager/bundle_distributed_manager.cpp @@ -95,7 +95,7 @@ int32_t BundleDistributedManager::ComparePcIdString(const Want &want, const RpcI } std::string capabilities = jsonObject[CHARACTER_PRIVATE_SYSCAP]; if (capabilities.empty()) { - pcId.resize(pcId.length() - 1); + pcId.resize(pcId.empty() ? pcId.length() : (pcId.length() - 1)); } else { pcId = pcId + capabilities; } -- Gitee From 6f15b410f64e034c6d30f19acccb49a137dc2cc8 Mon Sep 17 00:00:00 2001 From: wang19954 Date: Tue, 2 Sep 2025 16:50:43 +0800 Subject: [PATCH 2/2] IssueNo:#ICVRLD Description:fix codecheck Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangtiantian --- .../src/bundlemgr/bundle_mgr_host.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_host.cpp index 560b0fa845..18488f84c9 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_host.cpp @@ -36,7 +36,6 @@ namespace OHOS { namespace AppExecFwk { namespace { -const int16_t LIMIT_PARCEL_SIZE = 1024; const int32_t MAX_LIMIT_SIZE = 100; const int8_t ASHMEM_LEN = 16; constexpr size_t MAX_PARCEL_CAPACITY = 100 * 1024 * 1024; // 100M @@ -51,19 +50,6 @@ constexpr size_t MAX_PARCEL_CAPACITY_OF_ASHMEM = 1024 * 1024 * 1024; // max allo constexpr size_t MAX_IPC_REWDATA_SIZE = 120 * 1024 * 1024; // max ipc size 120MB const std::string BUNDLE_MANAGER_ASHMEM_NAME = "bundleManagerAshemeName"; -void SplitString(const std::string &source, std::vector &strings) -{ - int splitSize = (source.size() / LIMIT_PARCEL_SIZE); - if ((source.size() % LIMIT_PARCEL_SIZE) != 0) { - splitSize++; - } - APP_LOGD("the dump string split into %{public}d size", splitSize); - for (int i = 0; i < splitSize; i++) { - int32_t start = LIMIT_PARCEL_SIZE * i; - strings.emplace_back(source.substr(start, LIMIT_PARCEL_SIZE)); - } -} - bool GetData(void *&buffer, size_t size, const void *data) { if (data == nullptr) { -- Gitee