diff --git a/interfaces/inner_api/src/distributed_bms_proxy.cpp b/interfaces/inner_api/src/distributed_bms_proxy.cpp index 132e585d3d54cf8f6d894ef12be9b1bbccac5625..ebb4a348d806a1d34815676d04cd82258b9bbaba 100644 --- a/interfaces/inner_api/src/distributed_bms_proxy.cpp +++ b/interfaces/inner_api/src/distributed_bms_proxy.cpp @@ -45,21 +45,21 @@ int32_t DistributedBmsProxy::GetRemoteAbilityInfo(const OHOS::AppExecFwk::Elemen APP_LOGD("DistributedBmsProxy GetRemoteAbilityInfoWithLocale"); int32_t checkRet = CheckElementName(elementName); if (checkRet != ERR_OK) { - APP_LOGE("DistributedBmsProxy GetRemoteAbilityInfoWithLocale check elementName failed"); + APP_LOGE("check elementName failed"); return checkRet; } MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(GetDescriptor())) { - APP_LOGE("fail to GetRemoteAbilityInfo due to write InterfaceToken fail"); + APP_LOGE("write InterfaceToken fail"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteParcelable(&elementName)) { - APP_LOGE("DistributedBmsProxy GetRemoteAbilityInfo write elementName error"); + APP_LOGE("write elementName error"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(localeInfo)) { - APP_LOGE("DistributedBmsProxy GetRemoteAbilityInfo write localeInfo error"); + APP_LOGE("write localeInfo error"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -86,22 +86,22 @@ int32_t DistributedBmsProxy::GetRemoteAbilityInfos(const std::vector( @@ -163,15 +163,15 @@ int32_t DistributedBmsProxy::GetAbilityInfos(const std::vector &ele MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(GetDescriptor())) { - APP_LOGE("fail to GetAbilityInfos due to write InterfaceToken fail"); + APP_LOGE("write InterfaceToken fail"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!WriteParcelableVector(elementNames, data)) { - APP_LOGE("DistributedBmsProxy GetAbilityInfos write elementName error"); + APP_LOGE("write elementName error"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(localeInfo)) { - APP_LOGE("DistributedBmsProxy GetRemoteAbilityInfos write localeInfo error"); + APP_LOGE("write localeInfo error"); return ERR_APPEXECFWK_PARCEL_ERROR; } int32_t result = GetParcelableInfos( @@ -189,15 +189,15 @@ bool DistributedBmsProxy::GetDistributedBundleInfo(const std::string &networkId, APP_LOGD("DistributedBmsProxy GetDistributedBundleInfo"); MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { - APP_LOGE("fail to GetDistributedBundleInfo due to write InterfaceToken fail"); + APP_LOGE("write InterfaceToken fail"); return false; } if (!data.WriteString(networkId)) { - APP_LOGE("DistributedBmsProxy GetDistributedBundleInfo write networkId error"); + APP_LOGE("write networkId error"); return false; } if (!data.WriteString(bundleName)) { - APP_LOGE("DistributedBmsProxy GetDistributedBundleInfo write bundleName error"); + APP_LOGE("write bundleName error"); return false; } int32_t result = GetParcelableInfo( @@ -213,15 +213,15 @@ int32_t DistributedBmsProxy::GetDistributedBundleName(const std::string &network { MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { - APP_LOGE("fail to get distributed bundleInfo list due to write InterfaceToken fail"); + APP_LOGE("write InterfaceToken fail"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteString(networkId)) { - APP_LOGE("distributed mms proxy get distributed bundleInfo list write networkId error"); + APP_LOGE("write networkId error"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!data.WriteUint32(accessTokenId)) { - APP_LOGE("distributed mms proxy get distributed bundleInfo list write accessTokenId error"); + APP_LOGE("write accessTokenId error"); return ERR_APPEXECFWK_PARCEL_ERROR; } MessageParcel reply; @@ -310,7 +310,7 @@ int32_t DistributedBmsProxy::SendRequest(DistributedInterfaceCode code, MessageP sptr remote = Remote(); MessageOption option(MessageOption::TF_SYNC); if (remote == nullptr) { - APP_LOGE("fail to send %{public}d cmd to service due to remote object is null", code); + APP_LOGE("fail to send %{public}d cmd to service due to null remote", code); return ERR_APPEXECFWK_FAILED_GET_REMOTE_PROXY; } int32_t result = remote->SendRequest(static_cast(code), data, reply, option); @@ -323,11 +323,11 @@ int32_t DistributedBmsProxy::SendRequest(DistributedInterfaceCode code, MessageP int32_t DistributedBmsProxy::CheckElementName(const ElementName &elementName) { if (elementName.GetBundleName().empty()) { - APP_LOGE("fail to GetRemoteAbilityInfo due to bundleName empty"); + APP_LOGE("bundleName empty"); return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; } if (elementName.GetAbilityName().empty()) { - APP_LOGE("fail to GetRemoteAbilityInfo due to abilityName empty"); + APP_LOGE("abilityName empty"); return ERR_BUNDLE_MANAGER_ABILITY_NOT_EXIST; } if (elementName.GetDeviceID().empty()) { diff --git a/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp b/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp index 4d2315d0baa5792d08ae07c99d515bc79559f5d7..95ca0de20480d9dc2608cfe3688fa7a4bb5f92e0 100644 --- a/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp +++ b/interfaces/kits/js/distributebundlemgr/distributed_bundle_mgr.cpp @@ -73,7 +73,7 @@ static OHOS::sptr GetDistributedBundleMgr() APP_LOGI("GetDistributedBundleMgr"); auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { - APP_LOGE("GetSystemAbilityManager failed, samgr is nullptr."); + APP_LOGE("null samgr"); return nullptr; } auto remoteObject = samgr->GetSystemAbility(OHOS::DISTRIBUTED_BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); @@ -86,13 +86,13 @@ static std::string GetStringFromNAPI(napi_env env, napi_value value) size_t size = 0; if (napi_get_value_string_utf8(env, value, nullptr, NAPI_RETURN_ZERO, &size) != napi_ok) { - APP_LOGE("can not get string size"); + APP_LOGE("not get string size"); return ""; } result.reserve(size + NAPI_RETURN_ONE); result.resize(size); if (napi_get_value_string_utf8(env, value, result.data(), (size + NAPI_RETURN_ONE), &size) != napi_ok) { - APP_LOGE("can not get string value"); + APP_LOGE("not get string value"); return ""; } return result; @@ -171,7 +171,7 @@ static void ConvertRemoteAbilityInfos( napi_env env, napi_value objRemoteAbilityInfos, const std::vector &remoteAbilityInfos) { if (remoteAbilityInfos.size() == 0) { - APP_LOGE("ConvertRemoteAbilityInfos remoteAbilityInfos is empty"); + APP_LOGE("remoteAbilityInfos empty"); return; } size_t index = 0; @@ -201,7 +201,7 @@ static bool ParseModuleName(napi_env env, std::string &moduleName, napi_value ar if ((status == napi_ok) && (valueType == napi_string)) { moduleName = GetStringFromNAPI(env, prop); } else { - APP_LOGE("begin to parse ElementName moduleName failed"); + APP_LOGE("parse ElementName moduleName failed"); return false; } } @@ -224,7 +224,7 @@ static bool ParseElementName(napi_env env, OHOS::AppExecFwk::ElementName &elemen if (status == napi_ok && valueType == napi_string) { elementName.SetDeviceID(GetStringFromNAPI(env, prop)); } else { - APP_LOGE("begin to parse ElementName deviceId failed"); + APP_LOGE("parse ElementName deviceId failed"); return false; } prop = nullptr; @@ -233,7 +233,7 @@ static bool ParseElementName(napi_env env, OHOS::AppExecFwk::ElementName &elemen if (status == napi_ok && valueType == napi_string) { elementName.SetBundleName(GetStringFromNAPI(env, prop)); } else { - APP_LOGE("begin to parse ElementName bundleName failed"); + APP_LOGE("parse ElementName bundleName failed"); return false; } prop = nullptr; @@ -242,7 +242,7 @@ static bool ParseElementName(napi_env env, OHOS::AppExecFwk::ElementName &elemen if (status == napi_ok && valueType == napi_string) { elementName.SetAbilityName(GetStringFromNAPI(env, prop)); } else { - APP_LOGE("begin to parse ElementName abilityName failed"); + APP_LOGE("parse ElementName abilityName failed"); return false; } std::string moduleName; @@ -260,7 +260,7 @@ static bool ParseElementNames(napi_env env, std::vector &elementNam bool isArray = false; NAPI_CALL_BASE(env, napi_is_array(env, args, &isArray), false); if (!isArray) { - APP_LOGE("parseElementNames args not array"); + APP_LOGE("args not array"); return false; } uint32_t arrayLength = 0; @@ -292,7 +292,7 @@ static int32_t InnerGetRemoteAbilityInfo( { auto iDistBundleMgr = GetDistributedBundleMgr(); if (!iDistBundleMgr) { - APP_LOGE("can not get iDistBundleMgr"); + APP_LOGE("not get iDistBundleMgr"); return ERR_INNER_ERROR; } int32_t result = iDistBundleMgr->GetRemoteAbilityInfo(elementName, locale, remoteAbilityInfo); @@ -306,17 +306,17 @@ static int32_t InnerGetRemoteAbilityInfos(const std::vector &elemen std::vector &remoteAbilityInfos) { if (elementNames.size() == 0) { - APP_LOGE("InnerGetRemoteAbilityInfos elementNames is empty"); + APP_LOGE("elementNames empty"); return ERR_INVALID_PARAM; } auto iDistBundleMgr = GetDistributedBundleMgr(); if (!iDistBundleMgr) { - APP_LOGE("can not get iDistBundleMgr"); + APP_LOGE("not get iDistBundleMgr"); return ERR_INNER_ERROR; } int32_t result = iDistBundleMgr->GetRemoteAbilityInfos(elementNames, locale, remoteAbilityInfos); if (result != 0) { - APP_LOGE("InnerGetRemoteAbilityInfo failed"); + APP_LOGE("failed"); } return ConvertResultCode(result); } @@ -428,7 +428,7 @@ napi_value GetRemoteAbilityInfos(napi_env env, napi_callback_info info) asyncCallbackInfo->errCode = ERR_INVALID_PARAM; } if (static_cast(asyncCallbackInfo->elementNames.size()) > GET_REMOTE_ABILITY_INFO_MAX_SIZE) { - APP_LOGE("InnerGetRemoteAbilityInfos elementNames more than max"); + APP_LOGE("elementNames more than max"); asyncCallbackInfo->errCode = ERR_PARAMETERS_MORE_THAN_MAX; } } else if ((i == PARAM1) && (valueType == napi_string)) { diff --git a/interfaces/kits/js/distributedBundle/distributed_bundle.cpp b/interfaces/kits/js/distributedBundle/distributed_bundle.cpp index 920cb18319638b1bcad7a71e576f51e0f8eef254..b5401bd2fc85dcccc35b35415425334cf13e06a1 100644 --- a/interfaces/kits/js/distributedBundle/distributed_bundle.cpp +++ b/interfaces/kits/js/distributedBundle/distributed_bundle.cpp @@ -47,17 +47,17 @@ static OHOS::sptr GetDistributedBundleMgr() APP_LOGD("GetDistributedBundleMgr start"); auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { - APP_LOGE("GetDistributedBundleMgr samgr is nullptr"); + APP_LOGE("null samgr"); return nullptr; } auto remoteObject = samgr->GetSystemAbility(OHOS::DISTRIBUTED_BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); if (remoteObject == nullptr) { - APP_LOGE("GetDistributedBundleMgr remoteObject is nullptr"); + APP_LOGE("null remoteObject"); return nullptr; } auto distributeBundleMgr = OHOS::iface_cast(remoteObject); if (distributeBundleMgr == nullptr) { - APP_LOGE("GetDistributedBundleMgr distributeBundleMgr is nullptr"); + APP_LOGE("null distributeBundleMgr"); return nullptr; } return distributeBundleMgr; @@ -108,7 +108,7 @@ static void ConvertRemoteAbilityInfos( napi_env env, const std::vector &remoteAbilityInfos, napi_value objRemoteAbilityInfos) { if (remoteAbilityInfos.size() == 0) { - APP_LOGE("ConvertRemoteAbilityInfos remoteAbilityInfos is empty"); + APP_LOGE("remoteAbilityInfos empty"); return; } size_t index = 0; @@ -136,28 +136,28 @@ static bool ParseElementName(napi_env env, napi_value args, OHOS::AppExecFwk::El } std::string deviceId; if (!CommonFunc::ParseStringPropertyFromObject(env, args, "deviceId", true, deviceId)) { - APP_LOGE("begin to parse ElementName deviceId failed"); + APP_LOGE("parse ElementName deviceId failed"); return false; } elementName.SetDeviceID(deviceId); std::string bundleName; if (!CommonFunc::ParseStringPropertyFromObject(env, args, "bundleName", true, bundleName)) { - APP_LOGE("begin to parse ElementName bundleName failed"); + APP_LOGE("parse ElementName bundleName failed"); return false; } elementName.SetBundleName(bundleName); std::string abilityName; if (!CommonFunc::ParseStringPropertyFromObject(env, args, "abilityName", true, abilityName)) { - APP_LOGE("begin to parse ElementName abilityName failed"); + APP_LOGE("parse ElementName abilityName failed"); return false; } elementName.SetAbilityName(abilityName); std::string moduleName; if (!CommonFunc::ParseStringPropertyFromObject(env, args, "moduleName", false, moduleName)) { - APP_LOGE("begin to parse ElementName moduleName failed"); + APP_LOGE("parse ElementName moduleName failed"); return false; } elementName.SetModuleName(moduleName); @@ -182,7 +182,7 @@ static bool ParseElementNames(napi_env env, napi_value args, bool &isArray, std: NAPI_CALL_BASE(env, napi_get_array_length(env, args, &arrayLength), false); APP_LOGD("arrayLength:%{public}d", arrayLength); if (arrayLength == 0) { - APP_LOGE("error: ElementNames is empty"); + APP_LOGE("elementNames empty"); return false; } for (uint32_t i = 0; i < arrayLength; i++) { @@ -209,12 +209,12 @@ int32_t InnerGetRemoteAbilityInfo(const std::vector &elementNames, bool isArray, std::vector &remoteAbilityInfos) { if (elementNames.size() == 0) { - APP_LOGE("InnerGetRemoteAbilityInfos elementNames is empty"); + APP_LOGE("elementNames empty"); return ERROR_BUNDLE_SERVICE_EXCEPTION; } auto iDistBundleMgr = GetDistributedBundleMgr(); if (iDistBundleMgr == nullptr) { - APP_LOGE("can not get iDistBundleMgr"); + APP_LOGE("null iDistBundleMgr"); return ERROR_DISTRIBUTED_SERVICE_NOT_RUNNING; } int32_t result; @@ -226,7 +226,7 @@ int32_t InnerGetRemoteAbilityInfo(const std::vector &elementNames, remoteAbilityInfos.push_back(remoteAbilityInfo); } if (result != 0) { - APP_LOGE("InnerGetRemoteAbilityInfo failed"); + APP_LOGE("failed"); } return CommonFunc::ConvertErrCode(result); } @@ -235,7 +235,7 @@ void GetRemoteAbilityInfoExec(napi_env env, void *data) { GetRemoteAbilityInfoCallbackInfo *asyncCallbackInfo = reinterpret_cast(data); if (asyncCallbackInfo == nullptr) { - APP_LOGE("asyncCallbackInfo is null"); + APP_LOGE("null asyncCallbackInfo"); return; } asyncCallbackInfo->err = InnerGetRemoteAbilityInfo(asyncCallbackInfo->elementNames, @@ -246,7 +246,7 @@ void GetRemoteAbilityInfoComplete(napi_env env, napi_status status, void *data) { GetRemoteAbilityInfoCallbackInfo *asyncCallbackInfo = reinterpret_cast(data); if (asyncCallbackInfo == nullptr) { - APP_LOGE("asyncCallbackInfo is null in %{public}s", __func__); + APP_LOGE("null asyncCallbackInfo"); return; } std::unique_ptr callbackPtr {asyncCallbackInfo}; @@ -290,7 +290,7 @@ napi_value GetRemoteAbilityInfo(napi_env env, napi_callback_info info) } std::unique_ptr callbackPtr {asyncCallbackInfo}; if (!args.Init(ARGS_SIZE_ONE, ARGS_SIZE_THREE)) { - APP_LOGE("param count invalid."); + APP_LOGE("param count invalid"); BusinessError::ThrowTooFewParametersError(env, ERROR_PARAM_CHECK_ERROR); return nullptr; } diff --git a/services/dbms/src/distributed_bms.cpp b/services/dbms/src/distributed_bms.cpp index 1bde3d4b16fe656255aeb16153860723cc50186f..50139721b20c629022c706aa11b9fb5d0c8aac22 100644 --- a/services/dbms/src/distributed_bms.cpp +++ b/services/dbms/src/distributed_bms.cpp @@ -115,28 +115,28 @@ const bool REGISTER_RESULT = DistributedBms::DistributedBms() : SystemAbility(DISTRIBUTED_BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, true) { - APP_LOGI("DistributedBms :%{public}s call", __func__); + APP_LOGI("begin"); } DistributedBms::~DistributedBms() { - APP_LOGI("DistributedBms: DBundleMgrService"); + APP_LOGI("destructor"); } void DistributedBms::OnStart() { - APP_LOGI("DistributedBms: OnStart"); + APP_LOGI("begin"); Init(); bool res = Publish(this); if (!res) { - APP_LOGE("DistributedBms: OnStart failed"); + APP_LOGE("Publish failed"); } - APP_LOGI("DistributedBms: OnStart end"); + APP_LOGI("end"); } void DistributedBms::OnStop() { - APP_LOGI("DistributedBms: OnStop"); + APP_LOGI("begin"); if (distributedSub_ != nullptr) { EventFwk::CommonEventManager::UnSubscribeCommonEvent(distributedSub_); } @@ -144,7 +144,7 @@ void DistributedBms::OnStop() void DistributedBms::Init() { - APP_LOGI("DistributedBms: Init"); + APP_LOGI("begin"); InitDeviceManager(); DistributedDataStorage::GetInstance(); if (distributedSub_ == nullptr) { @@ -170,7 +170,7 @@ void DistributedBms::InitDeviceManager() if (dbmsDeviceManager_ == nullptr) { std::lock_guard lock(dbmsDeviceManagerMutex_); if (dbmsDeviceManager_ == nullptr) { - APP_LOGI("Create device manager"); + APP_LOGI("create device manager"); dbmsDeviceManager_ = std::make_shared(); } } @@ -183,12 +183,12 @@ OHOS::sptr DistributedBms::GetBundleMgr() if (bundleMgr_ == nullptr) { auto systemAbilityManager = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (systemAbilityManager == nullptr) { - APP_LOGE("GetBundleMgr GetSystemAbilityManager is null"); + APP_LOGE("null systemAbilityManager"); return nullptr; } auto bundleMgrSa = systemAbilityManager->GetSystemAbility(OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); if (bundleMgrSa == nullptr) { - APP_LOGE("GetBundleMgr GetSystemAbility is null"); + APP_LOGE("null bundleMgrSa"); return nullptr; } bundleMgr_ = OHOS::iface_cast(bundleMgrSa); @@ -200,7 +200,7 @@ OHOS::sptr DistributedBms::GetBundleMgr() int32_t DistributedBms::GetUdidByNetworkId(const std::string &networkId, std::string &udid) { if (dbmsDeviceManager_ == nullptr) { - APP_LOGI("deviceManager_ is nullptr"); + APP_LOGI("null dbmsDeviceManager_"); InitDeviceManager(); } return dbmsDeviceManager_->GetUdidByNetworkId(networkId, udid); @@ -209,7 +209,7 @@ int32_t DistributedBms::GetUdidByNetworkId(const std::string &networkId, std::st int32_t DistributedBms::GetUuidByNetworkId(const std::string &networkId, std::string &uuid) { if (dbmsDeviceManager_ == nullptr) { - APP_LOGI("deviceManager_ is nullptr"); + APP_LOGI("null dbmsDeviceManager_"); InitDeviceManager(); } return dbmsDeviceManager_->GetUuidByNetworkId(networkId, uuid); @@ -219,15 +219,15 @@ static OHOS::sptr GetDistributedBundleMgr(con { auto samgr = OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (samgr == nullptr) { - APP_LOGE("GetSystemAbilityManager failed"); + APP_LOGE("null samgr"); return nullptr; } OHOS::sptr remoteObject; if (deviceId.empty()) { - APP_LOGW("GetDistributedBundleMgr deviceId is empty"); + APP_LOGW("deviceId empty"); return nullptr; } else { - APP_LOGI("GetDistributedBundleMgr get remote d-bms"); + APP_LOGI("get remote d-bms"); remoteObject = samgr->CheckSystemAbility(OHOS::DISTRIBUTED_BUNDLE_MGR_SERVICE_SYS_ABILITY_ID, deviceId); } return OHOS::iface_cast(remoteObject); @@ -290,7 +290,7 @@ int32_t DistributedBms::GetRemoteAbilityInfos(const std::vector &el return ERR_BUNDLE_MANAGER_PERMISSION_DENIED; } if (elementNames.empty()) { - APP_LOGE("GetDistributedBundle failed due to elementNames empty"); + APP_LOGE("elementNames empty"); return ERR_BUNDLE_MANAGER_PARAM_ERROR; } auto iDistBundleMgr = GetDistributedBundleMgr(elementNames[0].GetDeviceID()); @@ -323,7 +323,7 @@ int32_t DistributedBms::GetAbilityInfo( int32_t DistributedBms::GetAbilityInfo(const OHOS::AppExecFwk::ElementName &elementName, const std::string &localeInfo, RemoteAbilityInfo &remoteAbilityInfo) { - APP_LOGI("DistributedBms GetAbilityInfo bundleName:%{public}s , abilityName:%{public}s, localeInfo:%{public}s", + APP_LOGI("bundleName:%{public}s , abilityName:%{public}s, localeInfo:%{public}s", elementName.GetBundleName().c_str(), elementName.GetAbilityName().c_str(), localeInfo.c_str()); if (!VerifyCallingPermission(Constants::PERMISSION_GET_BUNDLE_INFO_PRIVILEGED)) { APP_LOGE("verify GET_BUNDLE_INFO_PRIVILEGED failed"); @@ -331,7 +331,7 @@ int32_t DistributedBms::GetAbilityInfo(const OHOS::AppExecFwk::ElementName &elem } auto iBundleMgr = GetBundleMgr(); if (!iBundleMgr) { - APP_LOGE("DistributedBms GetBundleMgr failed"); + APP_LOGE("GetBundleMgr failed"); return ERR_APPEXECFWK_FAILED_SERVICE_DIED; } int userId = AccountManagerHelper::GetCurrentActiveUserId(); @@ -345,17 +345,17 @@ int32_t DistributedBms::GetAbilityInfo(const OHOS::AppExecFwk::ElementName &elem ErrCode ret = iBundleMgr->QueryAbilityInfosV9(want, static_cast( GetAbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION), userId, abilityInfos); if (ret != ERR_OK) { - APP_LOGE("DistributedBms QueryAbilityInfo failed"); + APP_LOGE("QueryAbilityInfo failed"); return ret; } if (abilityInfos.empty()) { - APP_LOGE("DistributedBms QueryAbilityInfo abilityInfos empty"); + APP_LOGE("abilityInfos empty"); return ERR_APPEXECFWK_FAILED_GET_ABILITY_INFO; } std::string label = iBundleMgr->GetStringById( abilityInfos[0].bundleName, abilityInfos[0].moduleName, abilityInfos[0].labelId, userId, localeInfo); if (label.empty()) { - APP_LOGE("DistributedBms QueryAbilityInfo label empty"); + APP_LOGE("label empty"); return ERR_APPEXECFWK_FAILED_GET_ABILITY_INFO; } remoteAbilityInfo.label = label; @@ -368,7 +368,7 @@ int32_t DistributedBms::GetAbilityIconByContent( { auto iBundleMgr = GetBundleMgr(); if (!iBundleMgr) { - APP_LOGE("DistributedBms GetBundleMgr failed"); + APP_LOGE("GetBundleMgr failed"); return ERR_APPEXECFWK_FAILED_SERVICE_DIED; } #ifdef DISTRIBUTED_BUNDLE_IMAGE_ENABLE @@ -377,7 +377,7 @@ int32_t DistributedBms::GetAbilityIconByContent( ErrCode ret = iBundleMgr->GetMediaData(abilityInfo.bundleName, abilityInfo.moduleName, abilityInfo.name, imageContent, imageContentSize, userId); if (ret != ERR_OK) { - APP_LOGE("DistributedBms GetMediaData failed"); + APP_LOGE("GetMediaData failed"); return ret; } APP_LOGD("imageContentSize is %{public}d", static_cast(imageContentSize)); @@ -391,7 +391,7 @@ int32_t DistributedBms::GetAbilityIconByContent( return Base64WithoutCompress(imageContent, imageContentSize, remoteAbilityInfo); } if (!GetMediaBase64(compressData, compressSize, imageType, remoteAbilityInfo.icon)) { - APP_LOGE("DistributedBms GetMediaBase64 failed"); + APP_LOGE("GetMediaBase64 failed"); return ERR_APPEXECFWK_ENCODE_BASE64_FILE_FAILED; } } else { @@ -411,7 +411,7 @@ int32_t DistributedBms::Base64WithoutCompress(std::unique_ptr &imageC return ERR_APPEXECFWK_INPUT_WRONG_TYPE_FILE; } if (!GetMediaBase64(imageContent, static_cast(imageContentSize), imageType, remoteAbilityInfo.icon)) { - APP_LOGE("DistributedBms GetMediaBase64 failed"); + APP_LOGE("GetMediaBase64 failed"); return ERR_APPEXECFWK_ENCODE_BASE64_FILE_FAILED; } return OHOS::NO_ERROR; diff --git a/services/dbms/src/distributed_bms_host.cpp b/services/dbms/src/distributed_bms_host.cpp index fd0a28a4faae09560f64677741b06796a50b51e2..193ebee00598dd3fe00a057916f6109786186429 100644 --- a/services/dbms/src/distributed_bms_host.cpp +++ b/services/dbms/src/distributed_bms_host.cpp @@ -89,11 +89,11 @@ int DistributedBmsHost::HandleGetRemoteAbilityInfo(Parcel &data, Parcel &reply) return ret; } if (!reply.WriteBool(true)) { - APP_LOGE("GetRemoteAbilityInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!reply.WriteParcelable(&remoteAbilityInfo)) { - APP_LOGE("GetRemoteAbilityInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } return NO_ERROR; @@ -104,7 +104,7 @@ int DistributedBmsHost::HandleGetRemoteAbilityInfos(Parcel &data, Parcel &reply) APP_LOGI("DistributedBmsHost handle get remote ability infos"); std::vector elementNames; if (!GetParcelableInfos(data, elementNames)) { - APP_LOGE("GetRemoteAbilityInfos get parcelable infos failed"); + APP_LOGE("get parcelable infos failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } std::string localeInfo = data.ReadString(); @@ -115,11 +115,11 @@ int DistributedBmsHost::HandleGetRemoteAbilityInfos(Parcel &data, Parcel &reply) return ret; } if (!reply.WriteBool(true)) { - APP_LOGE("GetRemoteAbilityInfos write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!WriteParcelableVector(remoteAbilityInfos, reply)) { - APP_LOGE("GetRemoteAbilityInfos write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } return NO_ERROR; @@ -142,11 +142,11 @@ int DistributedBmsHost::HandleGetAbilityInfo(Parcel &data, Parcel &reply) return ret; } if (!reply.WriteBool(true)) { - APP_LOGE("GetRemoteAbilityInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!reply.WriteParcelable(&remoteAbilityInfo)) { - APP_LOGE("GetRemoteAbilityInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } return NO_ERROR; @@ -157,7 +157,7 @@ int DistributedBmsHost::HandleGetAbilityInfos(Parcel &data, Parcel &reply) APP_LOGI("DistributedBmsHost handle get ability infos"); std::vector elementNames; if (!GetParcelableInfos(data, elementNames)) { - APP_LOGE("GetRemoteAbilityInfos get parcelable infos failed"); + APP_LOGE("get parcelable infos failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } std::string localeInfo = data.ReadString(); @@ -168,11 +168,11 @@ int DistributedBmsHost::HandleGetAbilityInfos(Parcel &data, Parcel &reply) return ret; } if (!reply.WriteBool(true)) { - APP_LOGE("GetAbilityInfos write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!WriteParcelableVector(remoteAbilityInfos, reply)) { - APP_LOGE("GetAbilityInfos write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } return NO_ERROR; @@ -190,11 +190,11 @@ int DistributedBmsHost::HandleGetDistributedBundleInfo(Parcel &data, Parcel &rep return INVALID_OPERATION; } if (!reply.WriteBool(true)) { - APP_LOGE("GetDistributedBundleInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } if (!reply.WriteParcelable(&distributedBundleInfo)) { - APP_LOGE("GetDistributedBundleInfo write failed"); + APP_LOGE("write failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } return NO_ERROR; @@ -242,7 +242,7 @@ bool DistributedBmsHost::GetParcelableInfos(Parcel &data, std::vector &parcel for (int32_t i = 0; i < infoSize; i++) { std::unique_ptr info(data.ReadParcelable()); if (!info) { - APP_LOGE("Read Parcelable infos failed"); + APP_LOGE("read Parcelable infos fail"); return false; } parcelableInfos.emplace_back(*info); diff --git a/services/dbms/src/distributed_data_storage.cpp b/services/dbms/src/distributed_data_storage.cpp index bbb411f4be28ddfd14441646755f308e6009251d..4be39aa8e837e158ea15c0e7e04d08ed03f27541 100644 --- a/services/dbms/src/distributed_data_storage.cpp +++ b/services/dbms/src/distributed_data_storage.cpp @@ -74,7 +74,7 @@ void DistributedDataStorage::SaveStorageDistributeInfo(const std::string &bundle { std::lock_guard lock(kvStorePtrMutex_); if (!CheckKvStore()) { - APP_LOGE("kvStore is nullptr"); + APP_LOGE("null kvStore"); return; } } @@ -88,7 +88,7 @@ void DistributedDataStorage::SaveStorageDistributeInfo(const std::string &bundle } auto bundleMgr = DelayedSingleton::GetInstance()->GetBundleMgr(); if (bundleMgr == nullptr) { - APP_LOGE("Get bundleMgr shared_ptr nullptr"); + APP_LOGE("null bundleMgr"); return; } BundleInfo bundleInfo; @@ -118,7 +118,7 @@ bool DistributedDataStorage::InnerSaveStorageDistributeInfo(const DistributedBun Status status = kvStorePtr_->Put(key, value); if (status == Status::IPC_ERROR) { status = kvStorePtr_->Put(key, value); - APP_LOGW("distribute database ipc error and try to call again, result = %{public}d", status); + APP_LOGW("ipc error try to call again, result = %{public}d", status); } if (status != Status::SUCCESS) { APP_LOGE("put to kvStore error: %{public}d", status); @@ -134,7 +134,7 @@ void DistributedDataStorage::DeleteStorageDistributeInfo(const std::string &bund { std::lock_guard lock(kvStorePtrMutex_); if (!CheckKvStore()) { - APP_LOGE("kvStore is nullptr"); + APP_LOGE("null kvStore"); return; } } @@ -154,7 +154,7 @@ void DistributedDataStorage::DeleteStorageDistributeInfo(const std::string &bund Status status = kvStorePtr_->Delete(key); if (status == Status::IPC_ERROR) { status = kvStorePtr_->Delete(key); - APP_LOGW("distribute database ipc error and try to call again, result = %{public}d", status); + APP_LOGW("ipc error try to call again, result = %{public}d", status); } if (status != Status::SUCCESS) { APP_LOGE("delete key error: %{public}d", status); @@ -170,7 +170,7 @@ bool DistributedDataStorage::GetStorageDistributeInfo(const std::string &network { std::lock_guard lock(kvStorePtrMutex_); if (!CheckKvStore()) { - APP_LOGE("kvStore is nullptr"); + APP_LOGE("null kvStore"); return false; } } @@ -192,11 +192,11 @@ bool DistributedDataStorage::GetStorageDistributeInfo(const std::string &network Status status = kvStorePtr_->Get(key, value); if (status == Status::IPC_ERROR) { status = kvStorePtr_->Get(key, value); - APP_LOGW("distribute database ipc error and try to call again, result = %{public}d", status); + APP_LOGW("ipc error try to call again, result = %{public}d", status); } if (status == Status::SUCCESS) { if (!info.FromJsonString(value.ToString())) { - APP_LOGE("it's an error value"); + APP_LOGE("error value"); kvStorePtr_->Delete(key); return false; } @@ -212,7 +212,7 @@ int32_t DistributedDataStorage::GetDistributedBundleName(const std::string &netw { std::lock_guard lock(kvStorePtrMutex_); if (!CheckKvStore()) { - APP_LOGE("kvStore is nullptr"); + APP_LOGE("null kvStore"); return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; } } @@ -223,7 +223,7 @@ int32_t DistributedDataStorage::GetDistributedBundleName(const std::string &netw return ret; } if (udid.size() == 0) { - APP_LOGE("get udid is Empty"); + APP_LOGE("udid empty"); return ERR_BUNDLE_MANAGER_INTERNAL_ERROR; } bool resBool = SyncAndCompleted(udid, networkId); @@ -250,7 +250,7 @@ int32_t DistributedDataStorage::GetDistributedBundleName(const std::string &netw return OHOS::NO_ERROR; } } - APP_LOGE("get distributed bundleName no matching data: %{private}s %{private}s %{private}d", + APP_LOGE("no matching data: %{private}s %{private}s %{private}d", networkId.c_str(), udid.c_str(), accessTokenId); return ERR_BUNDLE_MANAGER_BUNDLE_NOT_EXIST; } @@ -283,7 +283,7 @@ bool DistributedDataStorage::CheckKvStore() if (status == Status::SUCCESS && kvStorePtr_ != nullptr) { return true; } - APP_LOGI("CheckKvStore, Times: %{public}d", tryTimes); + APP_LOGI("CheckKvStore, times: %{public}d", tryTimes); usleep(SLEEP_INTERVAL); tryTimes--; } @@ -309,7 +309,7 @@ bool DistributedDataStorage::SyncAndCompleted(const std::string &udid, const std return false; } if (udid.size() == 0) { - APP_LOGE("get uuid is Empty"); + APP_LOGE("udid empty"); return false; } DistributedKv::DataQuery dataQuery; @@ -319,16 +319,16 @@ bool DistributedDataStorage::SyncAndCompleted(const std::string &udid, const std syncCallback->setUuid(uuid); Status status = kvStorePtr_->Sync(networkIdList, DistributedKv::SyncMode::PUSH_PULL, dataQuery, syncCallback); if (status != Status::SUCCESS) { - APP_LOGE("distribute database start sync data: %{public}d", status); + APP_LOGE("start sync data: %{public}d", status); return false; } - APP_LOGI("distribute database start sync data success"); + APP_LOGI("sync data success"); Status statusResult = syncCallback->GetResultCode(); if (statusResult != Status::SUCCESS) { - APP_LOGE("distribute database syncCompleted status: %{public}d", statusResult); + APP_LOGE("syncCompleted status: %{public}d", statusResult); return false; } - APP_LOGI("distribute database start sync data syncCompleted success"); + APP_LOGI("sync data syncCompleted success"); return true; } @@ -357,7 +357,7 @@ void DistributedDataStorage::TryTwice(const std::function &func) const Status status = func(); if (status == Status::IPC_ERROR) { status = func(); - APP_LOGW("distribute database ipc error and try to call again, result = %{public}d", status); + APP_LOGW("ipc error try to call again, result = %{public}d", status); } } @@ -366,7 +366,7 @@ bool DistributedDataStorage::GetLocalUdid(std::string &udid) char innerUdid[DEVICE_UDID_LENGTH] = {0}; int ret = GetDevUdid(innerUdid, DEVICE_UDID_LENGTH); if (ret != 0) { - APP_LOGI("GetDevUdid failed ,ret:%{public}d", ret); + APP_LOGI("GetDevUdid failed, ret:%{public}d", ret); return false; } udid = std::string(innerUdid); @@ -377,7 +377,7 @@ int32_t DistributedDataStorage::GetUdidByNetworkId(const std::string &networkId, { auto dbms = DelayedSingleton::GetInstance(); if (dbms == nullptr) { - APP_LOGE("dbms is null"); + APP_LOGE("null dbms"); return Constants::INVALID_UDID; } return dbms->GetUdidByNetworkId(networkId, udid); @@ -387,7 +387,7 @@ int32_t DistributedDataStorage::GetUuidByNetworkId(const std::string &networkId, { auto dbms = DelayedSingleton::GetInstance(); if (dbms == nullptr) { - APP_LOGE("dbms is null"); + APP_LOGE("null dbms"); return Constants::INVALID_UDID; } return dbms->GetUuidByNetworkId(networkId, uuid); @@ -436,7 +436,7 @@ void DistributedDataStorage::UpdateDistributedData(int32_t userId) APP_LOGI("UpdateDistributedData"); auto bundleMgr = DelayedSingleton::GetInstance()->GetBundleMgr(); if (bundleMgr == nullptr) { - APP_LOGE("Get bundleMgr shared_ptr nullptr"); + APP_LOGE("null bundleMgr"); return; } std::vector bundleInfos; @@ -462,7 +462,7 @@ void DistributedDataStorage::UpdateDistributedData(int32_t userId) } } if (!InnerSaveStorageDistributeInfo(ConvertToDistributedBundleInfo(bundleInfo))) { - APP_LOGW("UpdateDistributedData SaveStorageDistributeInfo:%{public}s failed", bundleInfo.name.c_str()); + APP_LOGW("SaveStorageDistributeInfo:%{public}s failed", bundleInfo.name.c_str()); } } } @@ -473,7 +473,7 @@ std::map DistributedDataStorage::GetAllOldDi APP_LOGD("start"); std::map oldDistributedBundleInfos; if (kvStorePtr_ == nullptr) { - APP_LOGE("kvStorePtr_ is null"); + APP_LOGE("null kvStorePtr_"); return oldDistributedBundleInfos; } std::string udid; @@ -500,7 +500,7 @@ std::map DistributedDataStorage::GetAllOldDi bundleNames.end()) { APP_LOGW("bundleName:%{public}s need delete", distributedBundleInfo.bundleName.c_str()); if (kvStorePtr_->Delete(entry.key) != Status::SUCCESS) { - APP_LOGE("Delete key:%{public}s failed", key.c_str()); + APP_LOGE("delete key:%{public}s failed", key.c_str()); } continue; } @@ -526,12 +526,12 @@ void DistributedDataStorageCallback::SyncCompleted(const std::map lock(setVauleMutex_); if (!isSetValue_) { @@ -555,7 +555,7 @@ DistributedKv::Status DistributedDataStorageCallback::GetResultCode() APP_LOGI("GetResultCode status %{public}d", status); return status; } - APP_LOGW("GetResultCode time out"); + APP_LOGW("time out"); return Status::TIME_OUT; } } // namespace AppExecFwk diff --git a/services/dbms/src/image_compress.cpp b/services/dbms/src/image_compress.cpp index 6365e817bd2303b854828d89f1a7d2beb232fee4..5caefef171c3c3c324501fcae2daabca1e71a7c3 100644 --- a/services/dbms/src/image_compress.cpp +++ b/services/dbms/src/image_compress.cpp @@ -100,7 +100,7 @@ bool ImageCompress::GetImageTypeString(const std::unique_ptr &fileDat { ImageType type = GetImageType(fileData, fileLength); if (type == ImageType::WORNG_TYPE) { - APP_LOGE("input wrong type image!"); + APP_LOGE("input wrong type image"); return false; } imageType = type == ImageType::JPEG ? JPEG_FORMAT : PNG_FORMAT; @@ -116,7 +116,7 @@ bool ImageCompress::GetImageFileInfo(const std::string &srcFile, } FILE* file = fopen(srcFile.c_str(), "rb"); if (!file) { - APP_LOGE("ImageCompress: GetImageTypeByFile %{public}s is unavailable", srcFile.c_str()); + APP_LOGE("GetImageTypeByFile %{public}s is unavailable", srcFile.c_str()); return false; } if (fseek(file, 0L, SEEK_END) != 0) { @@ -127,12 +127,12 @@ bool ImageCompress::GetImageFileInfo(const std::string &srcFile, rewind(file); fileContent = std::make_unique(fileLength); if (!fread(fileContent.get(), sizeof(uint8_t), fileLength, file)) { - APP_LOGE("read file failed!"); + APP_LOGE("read file failed"); fclose(file); return false; } if (fclose(file) != 0) { - APP_LOGE("close file failed!"); + APP_LOGE("close file failed"); return false; } return true; @@ -143,7 +143,7 @@ bool ImageCompress::CompressImageByContent(const std::unique_ptr &fil { ImageType type = GetImageType(fileData, fileSize); if (type == ImageType::WORNG_TYPE) { - APP_LOGE("input wrong image!"); + APP_LOGE("input wrong image"); return false; } imageType = type == ImageType::JPEG ? JPEG_FORMAT : WEBP_FORMAT; @@ -152,7 +152,7 @@ bool ImageCompress::CompressImageByContent(const std::unique_ptr &fil std::unique_ptr imageSourcePtr = Media::ImageSource::CreateImageSource(fileData.get(), fileSize, options, errorCode); if (imageSourcePtr == nullptr) { - APP_LOGE("imageSourcePtr nullptr"); + APP_LOGE("null imageSourcePtr"); return false; } // do compress @@ -177,7 +177,7 @@ bool ImageCompress::CompressImageByContent(const std::unique_ptr &fil packOption.numberHint = MUNBER_ONE; uint8_t *resultBuffer = reinterpret_cast(malloc(BUFFER_SIZE)); if (resultBuffer == nullptr) { - APP_LOGE("image packer malloc buffer failed."); + APP_LOGE("null resultBuffer"); return 0; } imagePacker.StartPacking(resultBuffer, BUFFER_SIZE, packOption); @@ -188,7 +188,7 @@ bool ImageCompress::CompressImageByContent(const std::unique_ptr &fil uint8_t *result = compressedData.get(); if (memcpy_s(result, compressedSize, resultBuffer, compressedSize) != EOK) { free(resultBuffer); - APP_LOGE("memcpy_s to compressedData failed!"); + APP_LOGE("memcpy_s to compressedData failed"); return false; } free(resultBuffer);