From 5012226e760166d3c70d6eba3fa557287c848cf5 Mon Sep 17 00:00:00 2001 From: s00494828 Date: Mon, 16 May 2022 09:29:29 +0800 Subject: [PATCH] fix programming specification problem Signed-off-by: s00494828 Change-Id: Ie45d45758e0ec1d4bb2c241ac13d907d65eb5069 --- bundle_tool/frameworks/src/bundle_command.cpp | 15 +++--- common/utils/include/bundle_file_util.h | 2 +- common/utils/src/bundle_file_util.cpp | 23 ++++---- .../src/bundlemgr/bundle_installer_proxy.cpp | 16 +++--- .../src/bundlemgr/bundle_mgr_host.cpp | 30 +++++------ .../src/bundlemgr/bundle_mgr_proxy.cpp | 16 +++--- .../bundle_status_callback_proxy.cpp | 2 +- .../bundle_stream_installer_host.cpp | 2 +- .../bundle_stream_installer_proxy.cpp | 4 +- .../src/bundlemgr/bundle_user_mgr_proxy.cpp | 2 +- .../bundlemgr/clean_cache_callback_proxy.cpp | 2 +- .../src/bundlemgr/launcher_service.cpp | 18 +++---- interfaces/kits/js/bundlemgr/bundle_mgr.cpp | 52 +++++++++---------- .../kits/js/launchermgr/js_launcher.cpp | 12 ++--- interfaces/kits/js/package/package.cpp | 2 +- .../bundle/src/bundle_mgr_proxy_native.cpp | 2 +- .../bundle/src/native_interface_bundle.cpp | 2 +- .../bundlemgr/src/ability_manager_helper.cpp | 2 +- .../bundlemgr/src/aging/bundle_aging_mgr.cpp | 6 +-- .../recently_unused_bundle_aging_handler.cpp | 8 ++- .../bundlemgr/src/base_bundle_installer.cpp | 12 ++--- services/bundlemgr/src/bundle_clone_mgr.cpp | 2 +- services/bundlemgr/src/bundle_data_mgr.cpp | 6 +-- services/bundlemgr/src/bundle_installer.cpp | 2 +- .../bundlemgr/src/bundle_installer_host.cpp | 18 +++---- .../src/bundle_installer_manager.cpp | 14 ++--- services/bundlemgr/src/bundle_mgr_service.cpp | 36 ++++++------- ...bundle_status_callback_death_recipient.cpp | 2 +- services/bundlemgr/src/bundle_util.cpp | 4 +- .../src/distributed_data_storage.cpp | 2 +- .../service_center_status_callback.cpp | 2 +- services/bundlemgr/src/hidump_helper.cpp | 14 ++--- .../bundlemgr/src/installd/installd_main.cpp | 2 +- services/bundlemgr/src/installd_client.cpp | 10 ++-- .../src/kvstore_death_recipient_callback.cpp | 4 +- .../sandbox_app/bundle_sandbox_installer.cpp | 8 +-- .../bundlemgr/src/status_receiver_proxy.cpp | 6 +-- .../bundlemgr/src/system_ability_helper.cpp | 2 +- .../bundlemgr/src/system_bundle_installer.cpp | 6 +-- 39 files changed, 190 insertions(+), 180 deletions(-) diff --git a/bundle_tool/frameworks/src/bundle_command.cpp b/bundle_tool/frameworks/src/bundle_command.cpp index 86cc0566..2b183580 100644 --- a/bundle_tool/frameworks/src/bundle_command.cpp +++ b/bundle_tool/frameworks/src/bundle_command.cpp @@ -505,16 +505,17 @@ ErrCode BundleManagerShellCommand::init() { ErrCode result = OHOS::ERR_OK; - if (!bundleMgrProxy_) { + if (bundleMgrProxy_ == nullptr) { bundleMgrProxy_ = GetBundleMgrProxy(); if (bundleMgrProxy_) { - if (!bundleInstallerProxy_) { + if (bundleInstallerProxy_ == nullptr) { bundleInstallerProxy_ = bundleMgrProxy_->GetBundleInstaller(); } } } - if (!bundleMgrProxy_ || !bundleInstallerProxy_ || !bundleInstallerProxy_->AsObject()) { + if ((bundleMgrProxy_ == nullptr) || (bundleInstallerProxy_ == nullptr) || + (bundleInstallerProxy_->AsObject() == nullptr)) { result = OHOS::ERR_INVALID_VALUE; } @@ -525,13 +526,13 @@ sptr BundleManagerShellCommand::GetBundleMgrProxy() const { sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (!systemAbilityManager) { + if (systemAbilityManager == nullptr) { APP_LOGE("failed to get system ability mgr."); return nullptr; } sptr remoteObject = systemAbilityManager->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); - if (!remoteObject) { + if (remoteObject == nullptr) { APP_LOGE("failed to get bundle manager proxy."); return nullptr; } @@ -543,13 +544,13 @@ sptr BundleManagerShellCommand::GetBundleMgrProxy() const sptr BundleManagerShellCommand::GetInstallerProxy() const { sptr bundleMgrProxy = GetBundleMgrProxy(); - if (!bundleMgrProxy) { + if (bundleMgrProxy == nullptr) { APP_LOGE("bundle mgr proxy is nullptr."); return nullptr; } sptr installerProxy = bundleMgrProxy->GetBundleInstaller(); - if (!installerProxy) { + if (installerProxy == nullptr) { APP_LOGE("failed to get bundle installer proxy."); return nullptr; } diff --git a/common/utils/include/bundle_file_util.h b/common/utils/include/bundle_file_util.h index d4335fae..baf9c0af 100644 --- a/common/utils/include/bundle_file_util.h +++ b/common/utils/include/bundle_file_util.h @@ -28,7 +28,7 @@ public: static bool CheckFileType(const std::string &fileName, const std::string &extensionName); static bool CheckFileName(const std::string &fileName); static bool CheckFileSize(const std::string &bundlePath, const int64_t fileSize); - static bool GetHapFilesFromBundlePath(const std::string& currentBundlePath, std::vector& hapFileList); + static bool GetHapFilesFromBundlePath(const std::string ¤tBundlePath, std::vector &hapFileList); }; } // AppExecFwk } // OHOS diff --git a/common/utils/src/bundle_file_util.cpp b/common/utils/src/bundle_file_util.cpp index c79bde28..abf73cf7 100644 --- a/common/utils/src/bundle_file_util.cpp +++ b/common/utils/src/bundle_file_util.cpp @@ -91,15 +91,14 @@ bool BundleFileUtil::CheckFilePath(const std::vector &bundlePaths, return false; } return true; - } else { - APP_LOGD("bundlePaths has more than one element"); - for (const std::string& bundlePath : bundlePaths) { - std::string realPath = ""; - if (!CheckFilePath(bundlePath, realPath)) { - return false; - } - realPaths.emplace_back(realPath); + } + APP_LOGD("bundlePaths has more than one element"); + for (const std::string &bundlePath : bundlePaths) { + std::string realPath = ""; + if (!CheckFilePath(bundlePath, realPath)) { + return false; } + realPaths.emplace_back(realPath); } APP_LOGD("finish check file path"); return true; @@ -148,8 +147,8 @@ bool BundleFileUtil::CheckFileSize(const std::string &bundlePath, const int64_t return true; } -bool BundleFileUtil::GetHapFilesFromBundlePath(const std::string& currentBundlePath, - std::vector& hapFileList) +bool BundleFileUtil::GetHapFilesFromBundlePath(const std::string ¤tBundlePath, + std::vector &hapFileList) { APP_LOGD("GetHapFilesFromBundlePath with path is %{public}s", currentBundlePath.c_str()); if (currentBundlePath.empty()) { @@ -179,8 +178,8 @@ bool BundleFileUtil::GetHapFilesFromBundlePath(const std::string& currentBundleP hapFileList.emplace_back(realPath); APP_LOGD("find hap path %{public}s", realPath.c_str()); - if (!hapFileList.empty() && (hapFileList.size() > MAX_HAP_NUMBER)) { - APP_LOGE("reach the max hap number 128, stop to add more."); + if (hapFileList.size() > MAX_HAP_NUMBER) { + APP_LOGE("reach the max hap number %{public}hhu, stop to add more.", MAX_HAP_NUMBER); closedir(dir); return false; } 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 dae182cf..b3eb3e16 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 @@ -56,7 +56,7 @@ bool BundleInstallerProxy::Install( PARCEL_WRITE(data, String16, Str8ToStr16(bundlePath)); PARCEL_WRITE(data, Parcelable, &installParam); - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("fail to install, for statusReceiver is nullptr"); return false; } @@ -84,7 +84,7 @@ bool BundleInstallerProxy::Install(const std::vector &bundleFilePat } PARCEL_WRITE(data, Parcelable, &installParam); - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("fail to install, for statusReceiver is nullptr"); return false; } @@ -108,7 +108,7 @@ bool BundleInstallerProxy::Recover(const std::string &bundleName, PARCEL_WRITE(data, String16, Str8ToStr16(bundleName)); PARCEL_WRITE(data, Parcelable, &installParam); - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("fail to install, for statusReceiver is nullptr"); return false; } @@ -132,7 +132,7 @@ bool BundleInstallerProxy::Uninstall( PARCEL_WRITE_INTERFACE_TOKEN(data, GetDescriptor()); PARCEL_WRITE(data, String16, Str8ToStr16(bundleName)); PARCEL_WRITE(data, Parcelable, &installParam); - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("fail to uninstall, for statusReceiver is nullptr"); return false; } @@ -156,7 +156,7 @@ bool BundleInstallerProxy::Uninstall(const std::string &bundleName, const std::s PARCEL_WRITE(data, String16, Str8ToStr16(bundleName)); PARCEL_WRITE(data, String16, Str8ToStr16(modulePackage)); PARCEL_WRITE(data, Parcelable, &installParam); - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("fail to uninstall, for statusReceiver is nullptr"); return false; } @@ -269,12 +269,12 @@ sptr BundleInstallerProxy::CreateStreamInstaller(const I } uint32_t streamInstallerId = reply.ReadUint32(); sptr object = reply.ReadRemoteObject(); - if (!object) { + if (object == nullptr) { APP_LOGE("CreateStreamInstaller create nullptr remote object"); return nullptr; } sptr streamInstaller = iface_cast(object); - if (!streamInstaller) { + if (streamInstaller == nullptr) { APP_LOGE("CreateStreamInstaller failed"); return streamInstaller; } @@ -396,7 +396,7 @@ bool BundleInstallerProxy::SendInstallRequest(const uint32_t& code, MessageParce MessageOption& option) { sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to uninstall, for Remote() is nullptr"); return false; } 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 d27c4e3c..f1512542 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 @@ -661,7 +661,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfo(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -685,7 +685,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfoMutiparam(Parcel &data, Parcel &rep { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -710,7 +710,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfos(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -734,7 +734,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfosMutiparam(Parcel &data, Parcel &re { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -759,7 +759,7 @@ ErrCode BundleMgrHost::HandleQueryAllAbilityInfos(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -783,7 +783,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfosForClone(Parcel &data, Parcel &rep { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -996,7 +996,7 @@ ErrCode BundleMgrHost::HandleGetHapModuleInfoWithUserId(Parcel &data, Parcel &re { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr abilityInfo(data.ReadParcelable()); - if (!abilityInfo) { + if (abilityInfo == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -1275,7 +1275,7 @@ ErrCode BundleMgrHost::HandleSetAbilityEnabled(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr abilityInfo(data.ReadParcelable()); - if (!abilityInfo) { + if (abilityInfo == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -1384,7 +1384,7 @@ ErrCode BundleMgrHost::HandleGetBundleInstaller(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); sptr installer = GetBundleInstaller(); - if (!installer) { + if (installer == nullptr) { APP_LOGE("bundle installer is nullptr"); return ERR_APPEXECFWK_INSTALL_HOST_INSTALLER_FAILED; } @@ -1400,7 +1400,7 @@ ErrCode BundleMgrHost::HandleGetBundleUserMgr(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); sptr bundleUserMgr = GetBundleUserMgr(); - if (!bundleUserMgr) { + if (bundleUserMgr == nullptr) { APP_LOGE("bundle installer is nullptr"); return ERR_APPEXECFWK_INSTALL_HOST_INSTALLER_FAILED; } @@ -1610,7 +1610,7 @@ ErrCode BundleMgrHost::HandleQueryExtAbilityInfosWithoutType(Parcel &data, Parce ErrCode BundleMgrHost::HandleQueryExtAbilityInfos(Parcel &data, Parcel &reply) { std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -1802,7 +1802,7 @@ ErrCode BundleMgrHost::HandleImplicitQueryInfoByPriority(Parcel &data, Parcel &r { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -1897,7 +1897,7 @@ bool BundleMgrHost::WriteParcelableVectorIntoAshmem( } MessageParcel *messageParcel = reinterpret_cast(&reply); - if (!messageParcel) { + if (messageParcel == nullptr) { APP_LOGE("Type conversion failed"); return false; } @@ -1977,7 +1977,7 @@ ErrCode BundleMgrHost::HandleQueryAbilityInfoWithCallback(Parcel &data, Parcel & { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("ReadParcelable failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -2002,7 +2002,7 @@ ErrCode BundleMgrHost::HandleUpgradeAtomicService(Parcel &data, Parcel &reply) { HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__); std::unique_ptr want(data.ReadParcelable()); - if (!want) { + if (want == nullptr) { APP_LOGE("read parcelable want failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_proxy.cpp index 2f8da1ce..2b5fd6cb 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_mgr_proxy.cpp @@ -1902,7 +1902,7 @@ sptr BundleMgrProxy::GetBundleInstaller() return nullptr; } sptr installer = iface_cast(object); - if (!installer) { + if (installer == nullptr) { APP_LOGE("bundle installer is nullptr"); } @@ -1929,7 +1929,7 @@ sptr BundleMgrProxy::GetBundleUserMgr() return nullptr; } sptr bundleUserMgr = iface_cast(object); - if (!bundleUserMgr) { + if (bundleUserMgr == nullptr) { APP_LOGE("bundleUserMgr is nullptr"); } @@ -2415,14 +2415,14 @@ bool BundleMgrProxy::ImplicitQueryInfoByPriority(const Want &want, int32_t flags } std::unique_ptr abilityInfoPtr(reply.ReadParcelable()); - if (!abilityInfoPtr) { + if (abilityInfoPtr == nullptr) { APP_LOGE("read AbilityInfo failed"); return false; } abilityInfo = *abilityInfoPtr; std::unique_ptr extensionInfoPtr(reply.ReadParcelable()); - if (!extensionInfoPtr) { + if (extensionInfoPtr == nullptr) { APP_LOGE("read ExtensionAbilityInfo failed"); return false; } @@ -2513,7 +2513,7 @@ bool BundleMgrProxy::GetParcelableInfo(IBundleMgr::Message code, MessageParcel & } std::unique_ptr info(reply.ReadParcelable()); - if (!info) { + if (info == nullptr) { APP_LOGE("readParcelableInfo failed"); return false; } @@ -2533,7 +2533,7 @@ ErrCode BundleMgrProxy::GetParcelableInfoWithErrCode(IBundleMgr::Message code, M ErrCode res = reply.ReadInt32(); if (res == ERR_OK) { std::unique_ptr info(reply.ReadParcelable()); - if (!info) { + if (info == nullptr) { APP_LOGE("readParcelableInfo failed"); return ERR_APPEXECFWK_PARCEL_ERROR; } @@ -2560,7 +2560,7 @@ bool BundleMgrProxy::GetParcelableInfos(IBundleMgr::Message code, MessageParcel int32_t infoSize = reply.ReadInt32(); for (int32_t i = 0; i < infoSize; i++) { std::unique_ptr info(reply.ReadParcelable()); - if (!info) { + if (info == nullptr) { APP_LOGE("Read Parcelable infos failed"); return false; } @@ -2647,7 +2647,7 @@ bool BundleMgrProxy::SendTransactCmd(IBundleMgr::Message code, MessageParcel &da MessageOption option(MessageOption::TF_SYNC); sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to send transact cmd %{public}d due to remote object", code); return false; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_proxy.cpp index c1871701..abee5906 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_proxy.cpp @@ -251,7 +251,7 @@ void BundleStatusCallbackProxy::OnBundleStateChanged( } sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to call OnBundleStateChanged, for Remote() is nullptr"); return; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_host.cpp index e5aa932a..f1212611 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_host.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_proxy.cpp index 877e0f0d..1623f4ff 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_stream_installer_proxy.cpp @@ -82,7 +82,7 @@ bool BundleStreamInstallerProxy::Install(const sptr& receiver) APP_LOGE("fail to Install due to write interface token fail"); return false; } - if (!receiver) { + if (receiver == nullptr) { APP_LOGE("fail to install, for receiver is nullptr"); return false; } @@ -115,7 +115,7 @@ bool BundleStreamInstallerProxy::SendStreamInstallRequest(const uint32_t& code, MessageParcel& reply) { sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to send request, for remote is nullptr"); return false; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_proxy.cpp index 66f41279..224b2d22 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_proxy.cpp @@ -70,7 +70,7 @@ bool BundleUserMgrProxy::SendRequest(const int32_t& code, MessageParcel& data, M MessageOption& option) { sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to uninstall, for Remote() is nullptr"); return false; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_proxy.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_proxy.cpp index 602ea089..fa2f7797 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_proxy.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_proxy.cpp @@ -50,7 +50,7 @@ void CleanCacheCallbackProxy::OnCleanCacheFinished(bool succeeded) } sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to call OnCleanCacheFinished​, for Remote() is nullptr"); return; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/launcher_service.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/launcher_service.cpp index 04884556..66331cea 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/launcher_service.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/launcher_service.cpp @@ -76,7 +76,7 @@ bool LauncherService::RegisterCallback(const sptr &callba // check permission auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -97,7 +97,7 @@ bool LauncherService::UnRegisterCallback() // check permission auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -113,7 +113,7 @@ bool LauncherService::GetAbilityList( { APP_LOGI("GetAbilityList called"); auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr || bundleName.empty()) { + if ((iBundleMgr == nullptr) || (bundleName.empty())) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -163,7 +163,7 @@ bool LauncherService::GetAbilityList( bool LauncherService::GetAllLauncherAbilityInfos(int32_t userId, std::vector &launcherAbilityInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -209,7 +209,7 @@ bool LauncherService::GetAbilityInfo(const Want &want, const int userId, Launche { APP_LOGI("GetAbilityInfo called"); auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -269,7 +269,7 @@ bool LauncherService::GetApplicationInfo( { APP_LOGI("GetApplicationInfo called"); auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -290,7 +290,7 @@ bool LauncherService::IsBundleEnabled(const std::string &bundleName) { APP_LOGI("IsBundleEnabled called"); auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -306,7 +306,7 @@ bool LauncherService::IsAbilityEnabled(const AbilityInfo &abilityInfo) { APP_LOGI("IsAbilityEnabled called"); auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -323,7 +323,7 @@ bool LauncherService::GetShortcutInfos( return false; } auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } diff --git a/interfaces/kits/js/bundlemgr/bundle_mgr.cpp b/interfaces/kits/js/bundlemgr/bundle_mgr.cpp index 347d9b4a..586057bc 100644 --- a/interfaces/kits/js/bundlemgr/bundle_mgr.cpp +++ b/interfaces/kits/js/bundlemgr/bundle_mgr.cpp @@ -169,7 +169,7 @@ static OHOS::sptr GetBundleMgr() static bool CheckIsSystemApp() { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -1176,7 +1176,7 @@ static bool InnerGetApplicationInfos(napi_env env, int32_t flags, const int user std::vector &appInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -1361,7 +1361,7 @@ static bool InnerQueryAbilityInfos(napi_env env, const Want &want, int32_t flags, int32_t userId, std::vector &abilityInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -1915,7 +1915,7 @@ static bool InnerGetBundleInfos( napi_env env, int32_t flags, int32_t userId, std::vector &bundleInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -2044,7 +2044,7 @@ static bool InnerGetBundleInfo( napi_env env, const std::string &bundleName, int32_t flags, BundleOptions bundleOptions, BundleInfo &bundleInfo) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -2058,7 +2058,7 @@ static bool InnerGetBundleInfo( static bool InnerGetBundlePackInfo(const std::string &bundleName, int32_t flags, BundlePackInfo &bundlePackInfo) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -2520,7 +2520,7 @@ static bool InnerGetArchiveInfo( napi_env env, const std::string &hapFilePath, const int32_t flags, BundleInfo &bundleInfo) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; }; @@ -2626,7 +2626,7 @@ static bool InnerGetLaunchWantForBundle( napi_env env, const std::string &bundleName, Want &want) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -2744,7 +2744,7 @@ static void ConvertPermissionDef(napi_env env, napi_value result, const Permissi static bool InnerGetPermissionDef(napi_env env, const std::string &permissionName, PermissionDef &permissionDef) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; }; @@ -2849,7 +2849,7 @@ static void InnerInstall(napi_env env, const std::vector &bundleFil return; } auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return; } @@ -2864,7 +2864,7 @@ static void InnerInstall(napi_env env, const std::vector &bundleFil } OHOS::sptr callback = new (std::nothrow) InstallerCallback(); - if (!callback) { + if (callback == nullptr) { APP_LOGE("callback nullptr"); return; } @@ -2901,18 +2901,18 @@ static void InnerRecover(napi_env env, const std::string &bundleName, InstallPar return; } auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return; } auto iBundleInstaller = iBundleMgr->GetBundleInstaller(); - if (!iBundleInstaller) { + if (iBundleInstaller == nullptr) { APP_LOGE("can not get iBundleInstaller"); return; } OHOS::sptr callback = new (std::nothrow) InstallerCallback(); - if (!callback) { + if (callback == nullptr) { APP_LOGE("callback nullptr"); return; } @@ -3625,7 +3625,7 @@ static void InnerUninstall( napi_env env, const std::string &bundleName, InstallParam &installParam, InstallResult &installResult) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return; } @@ -3636,7 +3636,7 @@ static void InnerUninstall( } installParam.installFlag = InstallFlag::NORMAL; OHOS::sptr callback = new (std::nothrow) InstallerCallback(); - if (!callback) { + if (callback == nullptr) { APP_LOGE("callback nullptr"); return; } @@ -3790,7 +3790,7 @@ napi_value BundleInstallerConstructor(napi_env env, napi_callback_info info) static bool InnerGetAllFormsInfo(napi_env env, std::vector &formInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -3910,7 +3910,7 @@ static bool InnerGetFormInfosByModule(napi_env env, const std::string &bundleNam std::vector &formInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -4020,7 +4020,7 @@ static bool InnerGetFormInfosByApp( napi_env env, const std::string &bundleName, std::vector &formInfos) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -4343,7 +4343,7 @@ napi_value GetBundleGids(napi_env env, napi_callback_info info) static bool InnerSetApplicationEnabled(napi_env env, const std::string &bundleName, bool isEnable) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -4357,7 +4357,7 @@ static bool InnerSetApplicationEnabled(napi_env env, const std::string &bundleNa static bool InnerSetAbilityEnabled(napi_env env, const OHOS::AppExecFwk::AbilityInfo &abilityInfo, bool isEnable) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -4372,11 +4372,11 @@ static bool InnerCleanBundleCacheCallback( const std::string& bundleName, const OHOS::sptr& cleanCacheCallback) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } - if (!cleanCacheCallback) { + if (cleanCacheCallback == nullptr) { APP_LOGE("callback nullptr"); return false; } @@ -5611,7 +5611,7 @@ static std::shared_ptr InnerGetAbilityIcon( return nullptr; } auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return nullptr; } @@ -5717,7 +5717,7 @@ napi_value GetAbilityIcon(napi_env env, napi_callback_info info) static bool InnerGetNameForUid(int32_t uid, std::string &bundleName) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } @@ -6366,7 +6366,7 @@ static bool ParseWant(napi_env env, AsyncExtensionInfoCallbackInfo &info, napi_v static bool InnerQueryExtensionInfo(napi_env env, AsyncExtensionInfoCallbackInfo &info) { auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } diff --git a/interfaces/kits/js/launchermgr/js_launcher.cpp b/interfaces/kits/js/launchermgr/js_launcher.cpp index 1ba6ec00..645ae20e 100644 --- a/interfaces/kits/js/launchermgr/js_launcher.cpp +++ b/interfaces/kits/js/launchermgr/js_launcher.cpp @@ -424,11 +424,11 @@ static void ParseShortcutInfo(napi_env env, napi_value result, static bool InnerJSLauncherServiceOn(napi_env env, OHOS::sptr callbackRef) { - if (!callbackRef) { + if (callbackRef == nullptr) { APP_LOGE("Input null BundleStatusCallback"); } auto launcher = GetLauncherService(); - if (!launcher) { + if (launcher == nullptr) { APP_LOGE("can not get launcher"); return false; } @@ -547,7 +547,7 @@ static napi_value JSLauncherServiceOn(napi_env env, napi_callback_info info) static bool InnerJSLauncherServiceOff() { auto launcher = GetLauncherService(); - if (!launcher) { + if (launcher == nullptr) { APP_LOGE("can not get launcher"); return false; } @@ -651,7 +651,7 @@ static bool InnerJSGetAllLauncherAbilityInfos(napi_env env, uint32_t userId, std::vector &launcherAbilityInfos) { auto launcher = GetLauncherService(); - if (!launcher) { + if (launcher == nullptr) { APP_LOGE("can not get launcher"); return false; } @@ -754,7 +754,7 @@ static bool InnerJSGetLauncherAbilityInfos(napi_env env, std::string& bundleName uint32_t userId, std::vector& launcherAbilityInfos) { auto launcher = GetLauncherService(); - if (!launcher) { + if (launcher == nullptr) { APP_LOGE("can not get launcher"); return false; } @@ -862,7 +862,7 @@ static bool InnerJSGetShortcutInfos(napi_env env, const std::string& bundleName, std::vector& shortcutInfos) { auto launcher = GetLauncherService(); - if (!launcher) { + if (launcher == nullptr) { APP_LOGE("can not get launcher"); return false; } diff --git a/interfaces/kits/js/package/package.cpp b/interfaces/kits/js/package/package.cpp index 7613b52f..11e5cdd1 100644 --- a/interfaces/kits/js/package/package.cpp +++ b/interfaces/kits/js/package/package.cpp @@ -155,7 +155,7 @@ static bool InnerHasInstalled(std::string bundleName) return false; } auto iBundleMgr = GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return false; } diff --git a/interfaces/kits/native/bundle/src/bundle_mgr_proxy_native.cpp b/interfaces/kits/native/bundle/src/bundle_mgr_proxy_native.cpp index 73da07b5..5e6e8640 100644 --- a/interfaces/kits/native/bundle/src/bundle_mgr_proxy_native.cpp +++ b/interfaces/kits/native/bundle/src/bundle_mgr_proxy_native.cpp @@ -73,7 +73,7 @@ bool BundleMgrProxyNative::SendTransactCmd(IBundleMgr::Message code, MessageParc MessageOption option(MessageOption::TF_SYNC); sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to send transact cmd %{public}d due to remote object", code); return false; } diff --git a/interfaces/kits/native/bundle/src/native_interface_bundle.cpp b/interfaces/kits/native/bundle/src/native_interface_bundle.cpp index 7f1cb844..e38d1625 100644 --- a/interfaces/kits/native/bundle/src/native_interface_bundle.cpp +++ b/interfaces/kits/native/bundle/src/native_interface_bundle.cpp @@ -81,7 +81,7 @@ char* OH_NativeBundle_GetAppIdByBundleName(const char* bundleName) return nullptr; } auto iBundleMgr = OHOS::AppExecFwk::BundleNative::GetBundleMgr(); - if (!iBundleMgr) { + if (iBundleMgr == nullptr) { APP_LOGE("can not get iBundleMgr"); return nullptr; } diff --git a/services/bundlemgr/src/ability_manager_helper.cpp b/services/bundlemgr/src/ability_manager_helper.cpp index 46ff7bcb..d940e9b0 100644 --- a/services/bundlemgr/src/ability_manager_helper.cpp +++ b/services/bundlemgr/src/ability_manager_helper.cpp @@ -31,7 +31,7 @@ bool AbilityManagerHelper::UninstallApplicationProcesses(const std::string &bund APP_LOGI("uninstall kill running processes, app name is %{public}s", bundleName.c_str()); sptr abilityMgrProxy = iface_cast(SystemAbilityHelper::GetSystemAbility(ABILITY_MGR_SERVICE_ID)); - if (!abilityMgrProxy) { + if (abilityMgrProxy == nullptr) { APP_LOGE("fail to find the app mgr service to kill application"); return false; } diff --git a/services/bundlemgr/src/aging/bundle_aging_mgr.cpp b/services/bundlemgr/src/aging/bundle_aging_mgr.cpp index 58fe6445..000453a4 100644 --- a/services/bundlemgr/src/aging/bundle_aging_mgr.cpp +++ b/services/bundlemgr/src/aging/bundle_aging_mgr.cpp @@ -38,7 +38,7 @@ BundleAgingMgr::~BundleAgingMgr() void BundleAgingMgr::InitAgingRunner() { auto agingRunner = EventRunner::Create(AgingConstants::AGING_THREAD); - if (!agingRunner) { + if (agingRunner == nullptr) { APP_LOGE("create aging runner failed"); return; } @@ -96,7 +96,7 @@ int BundleAgingMgr::AgingQueryFormStatistics(std::vector &dataMgr) { - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("ReInitAgingRequest: dataMgr is null"); return false; } @@ -167,7 +167,7 @@ void BundleAgingMgr::Start(AgingTriggertype type) } auto dataMgr = OHOS::DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("dataMgr is null"); return; } diff --git a/services/bundlemgr/src/aging/recently_unused_bundle_aging_handler.cpp b/services/bundlemgr/src/aging/recently_unused_bundle_aging_handler.cpp index 74aeeb96..948839fc 100644 --- a/services/bundlemgr/src/aging/recently_unused_bundle_aging_handler.cpp +++ b/services/bundlemgr/src/aging/recently_unused_bundle_aging_handler.cpp @@ -74,14 +74,20 @@ bool RecentlyUnuseBundleAgingHandler::NeedContinue(const AgingRequest &request) bool RecentlyUnuseBundleAgingHandler::UnInstallBundle(const std::string &bundleName) const { auto bms = DelayedSingleton::GetInstance(); + if (bms == nullptr) { + return false; + } auto bundleInstaller = bms->GetBundleInstaller(); auto bundleDataMgr = bms->GetDataMgr(); - if (!bundleInstaller) { + if (bundleInstaller == nullptr) { APP_LOGE("bundleInstaller is null."); return false; } sptr userReceiverImpl(new (std::nothrow) AgingUninstallReceiveImpl()); + if (userReceiverImpl == nullptr) { + return false; + } InstallParam installParam; installParam.userId = AccountHelper::GetCurrentActiveUserId(); installParam.installFlag = InstallFlag::FREE_INSTALL; diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index c3ae2dfb..d58948da 100644 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -440,9 +440,9 @@ ErrCode BaseBundleInstaller::ProcessBundleInstall(const std::vector const InstallParam &installParam, const Constants::AppType appType, int32_t &uid) { APP_LOGD("ProcessBundleInstall bundlePath install"); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { dataMgr_ = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR; } @@ -649,7 +649,7 @@ ErrCode BaseBundleInstaller::ProcessBundleUninstall( } dataMgr_ = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR; } @@ -873,7 +873,7 @@ ErrCode BaseBundleInstaller::InnerProcessInstallByPreInstallInfo( const std::string &bundleName, const InstallParam &installParam, int32_t &uid, bool recoverMode) { dataMgr_ = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr."); return ERR_APPEXECFWK_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR; } @@ -1734,9 +1734,9 @@ ErrCode BaseBundleInstaller::CheckAppLabelInfo(const std::unordered_map::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; } diff --git a/services/bundlemgr/src/bundle_clone_mgr.cpp b/services/bundlemgr/src/bundle_clone_mgr.cpp index 1fec0bf4..14b37c55 100644 --- a/services/bundlemgr/src/bundle_clone_mgr.cpp +++ b/services/bundlemgr/src/bundle_clone_mgr.cpp @@ -276,7 +276,7 @@ bool BundleCloneMgr::RemoveClonedBundle(const std::string &oldName, const std::s return false; } std::shared_ptr dataMgr_ = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; } diff --git a/services/bundlemgr/src/bundle_data_mgr.cpp b/services/bundlemgr/src/bundle_data_mgr.cpp index 6c5b4ed1..ff836aa2 100644 --- a/services/bundlemgr/src/bundle_data_mgr.cpp +++ b/services/bundlemgr/src/bundle_data_mgr.cpp @@ -2305,7 +2305,7 @@ bool BundleDataMgr::SavePreInstallBundleInfo( const std::string &bundleName, const PreInstallBundleInfo &preInstallBundleInfo) { std::lock_guard lock(preInstallInfoMutex_); - if (!preInstallDataStorage_) { + if (preInstallDataStorage_ == nullptr) { return false; } @@ -2328,7 +2328,7 @@ bool BundleDataMgr::DeletePreInstallBundleInfo( const std::string &bundleName, const PreInstallBundleInfo &preInstallBundleInfo) { std::lock_guard lock(preInstallInfoMutex_); - if (!preInstallDataStorage_) { + if (preInstallDataStorage_ == nullptr) { return false; } @@ -2368,7 +2368,7 @@ bool BundleDataMgr::GetPreInstallBundleInfo( bool BundleDataMgr::LoadAllPreInstallBundleInfos(std::vector &preInstallBundleInfos) { - if (!preInstallDataStorage_) { + if (preInstallDataStorage_ == nullptr) { return false; } diff --git a/services/bundlemgr/src/bundle_installer.cpp b/services/bundlemgr/src/bundle_installer.cpp index 9e10d211..1f6d48fa 100644 --- a/services/bundlemgr/src/bundle_installer.cpp +++ b/services/bundlemgr/src/bundle_installer.cpp @@ -192,7 +192,7 @@ std::set BundleInstaller::GetExistsCommonUserIs() { std::set userIds; auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return userIds; } diff --git a/services/bundlemgr/src/bundle_installer_host.cpp b/services/bundlemgr/src/bundle_installer_host.cpp index c40666ac..9dae6d38 100644 --- a/services/bundlemgr/src/bundle_installer_host.cpp +++ b/services/bundlemgr/src/bundle_installer_host.cpp @@ -109,7 +109,7 @@ void BundleInstallerHost::HandleInstallMessage(Parcel &data) APP_LOGD("handle install message"); std::string bundlePath = Str16ToStr8(data.ReadString16()); std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } @@ -129,7 +129,7 @@ void BundleInstallerHost::HandleRecoverMessage(Parcel &data) APP_LOGD("handle install message by bundleName"); std::string bundleName = Str16ToStr8(data.ReadString16()); std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } @@ -157,7 +157,7 @@ void BundleInstallerHost::HandleInstallMultipleHapsMessage(Parcel &data) return; } std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } @@ -177,7 +177,7 @@ void BundleInstallerHost::HandleUninstallMessage(Parcel &data) APP_LOGD("handle uninstall message"); std::string bundleName = Str16ToStr8(data.ReadString16()); std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } @@ -198,7 +198,7 @@ void BundleInstallerHost::HandleUninstallModuleMessage(Parcel &data) std::string bundleName = Str16ToStr8(data.ReadString16()); std::string modulePackage = Str16ToStr8(data.ReadString16()); std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } @@ -247,13 +247,13 @@ void BundleInstallerHost::HandleCreateStreamInstaller(Parcel &data, Parcel &repl { APP_LOGD("handle create stream installer message begin"); std::unique_ptr installParam(data.ReadParcelable()); - if (!installParam) { + if (installParam == nullptr) { APP_LOGE("ReadParcelable failed"); return; } sptr streamInstaller = CreateStreamInstaller(*installParam); - if (!streamInstaller) { + if (streamInstaller == nullptr) { if (!reply.WriteBool(false)) { APP_LOGE("write result failed"); return; @@ -471,11 +471,11 @@ bool BundleInstallerHost::DestoryBundleStreamInstaller(uint32_t streamInstallerI bool BundleInstallerHost::CheckBundleInstallerManager(const sptr &statusReceiver) const { - if (!statusReceiver) { + if (statusReceiver == nullptr) { APP_LOGE("the receiver is nullptr"); return false; } - if (!manager_) { + if (manager_ == nullptr) { APP_LOGE("the bundle installer manager is nullptr"); statusReceiver->OnFinished(ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR, GET_MANAGER_FAIL); return false; diff --git a/services/bundlemgr/src/bundle_installer_manager.cpp b/services/bundlemgr/src/bundle_installer_manager.cpp index ef2d27e2..bddd9ac0 100644 --- a/services/bundlemgr/src/bundle_installer_manager.cpp +++ b/services/bundlemgr/src/bundle_installer_manager.cpp @@ -61,7 +61,7 @@ void BundleInstallerManager::CreateInstallTask( const std::string &bundleFilePath, const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -77,7 +77,7 @@ void BundleInstallerManager::CreateRecoverTask( const std::string &bundleName, const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -93,7 +93,7 @@ void BundleInstallerManager::CreateInstallTask(const std::vector &b const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -109,7 +109,7 @@ void BundleInstallerManager::CreateInstallByBundleNameTask(const std::string &bu const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -126,7 +126,7 @@ void BundleInstallerManager::CreateUninstallTask( const std::string &bundleName, const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -142,7 +142,7 @@ void BundleInstallerManager::CreateUninstallTask(const std::string &bundleName, const InstallParam &installParam, const sptr &statusReceiver) { auto installer = CreateInstaller(statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create installer failed"); return; } @@ -158,7 +158,7 @@ std::shared_ptr BundleInstallerManager::CreateInstaller(const s { int64_t installerId = GetMicroTickCount(); auto installer = std::make_shared(installerId, shared_from_this(), statusReceiver); - if (!installer) { + if (installer == nullptr) { APP_LOGE("create bundle installer failed"); return nullptr; } diff --git a/services/bundlemgr/src/bundle_mgr_service.cpp b/services/bundlemgr/src/bundle_mgr_service.cpp index 91620479..7ae6809f 100644 --- a/services/bundlemgr/src/bundle_mgr_service.cpp +++ b/services/bundlemgr/src/bundle_mgr_service.cpp @@ -89,7 +89,7 @@ void BundleMgrService::OnStart() void BundleMgrService::AfterRegisterToService() { - if (!distributedSub_) { + if (distributedSub_ == nullptr) { EventFwk::MatchingSkills matchingSkills; matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED); EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills); @@ -121,44 +121,44 @@ bool BundleMgrService::Init() if (host_ == nullptr) { host_ = new (std::nothrow) BundleMgrHostImpl(); - if (!host_) { + if (host_ == nullptr) { APP_LOGE("create host instance fail"); return false; } } APP_LOGI("init begin"); - if (!runner_) { + if (runner_ == nullptr) { runner_ = EventRunner::Create(Constants::BMS_SERVICE_NAME); - if (!runner_) { + if (runner_ == nullptr) { APP_LOGE("create runner fail"); return false; } } APP_LOGD("create runner success"); - if (!handler_) { + if (handler_ == nullptr) { handler_ = std::make_shared(runner_); - if (!handler_) { + if (handler_ == nullptr) { APP_LOGE("create bms event handler fail"); return false; } } APP_LOGD("create handler success"); - if (!installer_) { + if (installer_ == nullptr) { installer_ = new (std::nothrow) BundleInstallerHost(); - if (!installer_ || !installer_->Init()) { + if (installer_ == nullptr || !installer_->Init()) { APP_LOGE("init installer fail"); return false; } } APP_LOGD("create installer host success"); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGI("Create BundledataMgr"); dataMgr_ = std::make_shared(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("create data manager fail"); return false; } @@ -167,7 +167,7 @@ bool BundleMgrService::Init() if (userMgrHost_ == nullptr) { userMgrHost_ = new (std::nothrow) BundleUserMgrHostImpl(); - if (!userMgrHost_) { + if (userMgrHost_ == nullptr) { APP_LOGE("create userMgrHost instance fail"); return false; } @@ -183,29 +183,29 @@ bool BundleMgrService::Init() handler_->SendEvent(BMSEventHandler::BUNDLE_REBOOT_SCAN_START); } - if (!cloneMgr_) { + if (cloneMgr_ == nullptr) { APP_LOGI("Create BundleCloneMgr"); cloneMgr_ = std::make_shared(); } APP_LOGI("create BundleCloneMgr success"); #ifdef DEVICE_MANAGER_ENABLE - if (!deviceManager_) { + if (deviceManager_ == nullptr) { APP_LOGI("Create device manager"); deviceManager_ = std::make_shared(); } #endif - if (!hidumpHelper_) { + if (hidumpHelper_ == nullptr) { APP_LOGI("Create hidump helper"); hidumpHelper_ = std::make_shared(dataMgr_); } #ifdef BUNDLE_FRAMEWORK_FREE_INSTALL - if (!agingMgr_) { + if (agingMgr_ == nullptr) { APP_LOGI("Create aging manager"); agingMgr_ = DelayedSingleton::GetInstance(); - if (!agingMgr_) { + if (agingMgr_ == nullptr) { APP_LOGE("Create aging manager faild."); } if (agingMgr_) { @@ -214,7 +214,7 @@ bool BundleMgrService::Init() agingMgr_->InitAgingtTimer(); } } - if (!connectAbilityMgr_) { + if (connectAbilityMgr_ == nullptr) { APP_LOGI("Create BundleConnectAbility"); connectAbilityMgr_ = std::make_shared(); } @@ -274,7 +274,7 @@ sptr BundleMgrService::GetBundleUserMgr() const void BundleMgrService::CheckAllUser() { - if (!dataMgr_) { + if (dataMgr_ == nullptr) { return; } diff --git a/services/bundlemgr/src/bundle_status_callback_death_recipient.cpp b/services/bundlemgr/src/bundle_status_callback_death_recipient.cpp index 4ef05284..536b8a23 100644 --- a/services/bundlemgr/src/bundle_status_callback_death_recipient.cpp +++ b/services/bundlemgr/src/bundle_status_callback_death_recipient.cpp @@ -37,7 +37,7 @@ void BundleStatusCallbackDeathRecipient::OnRemoteDied(const wptr APP_LOGI("bundle status service died, remove the proxy object"); sptr callback = iface_cast(remote.promote()); APP_LOGI("bundle status service died"); - if (!callback) { + if (callback == nullptr) { APP_LOGE("callback is nullptr"); return; } diff --git a/services/bundlemgr/src/bundle_util.cpp b/services/bundlemgr/src/bundle_util.cpp index a2cf73d5..398f1174 100644 --- a/services/bundlemgr/src/bundle_util.cpp +++ b/services/bundlemgr/src/bundle_util.cpp @@ -307,7 +307,7 @@ std::string BundleUtil::CreateInstallTempDir(uint32_t installerId) std::string tempDir = Constants::HAP_COPY_PATH + Constants::PATH_SEPARATOR + std::to_string(curTime) + std::to_string(installerId) + Constants::PATH_SEPARATOR; if (!OHOS::ForceCreateDirectory(tempDir)) { - APP_LOGE("mkdir %{public}s failed", tempDir.c_str()); + APP_LOGE("mkdir %{private}s failed", tempDir.c_str()); return ""; } if (chown(tempDir.c_str(), Constants::BMS_UID, Constants::BMS_GID) != 0) { @@ -316,7 +316,7 @@ std::string BundleUtil::CreateInstallTempDir(uint32_t installerId) } mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; if (!OHOS::ChangeModeFile(tempDir, mode)) { - APP_LOGE("change mode failed, temp install dir : %{public}s", tempDir.c_str()); + APP_LOGE("change mode failed, temp install dir : %{private}s", tempDir.c_str()); return ""; } return tempDir; diff --git a/services/bundlemgr/src/distributed_data_storage.cpp b/services/bundlemgr/src/distributed_data_storage.cpp index a7478bfe..41222c17 100644 --- a/services/bundlemgr/src/distributed_data_storage.cpp +++ b/services/bundlemgr/src/distributed_data_storage.cpp @@ -81,7 +81,7 @@ bool DistributedDataStorage::SaveStorageDistributeInfo(const std::string &bundle return false; } auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; } diff --git a/services/bundlemgr/src/free_install/service_center_status_callback.cpp b/services/bundlemgr/src/free_install/service_center_status_callback.cpp index c1edab32..5a38293a 100644 --- a/services/bundlemgr/src/free_install/service_center_status_callback.cpp +++ b/services/bundlemgr/src/free_install/service_center_status_callback.cpp @@ -27,7 +27,7 @@ int32_t ServiceCenterStatusCallback::OnInstallFinished(std::string installResult { APP_LOGI("%{public}s", __func__); auto server = server_.lock(); - if (!server) { + if (server == nullptr) { APP_LOGE("pointer is nullptr."); return ERR_INVALID_VALUE; } diff --git a/services/bundlemgr/src/hidump_helper.cpp b/services/bundlemgr/src/hidump_helper.cpp index 7b44e62f..a4b32d20 100644 --- a/services/bundlemgr/src/hidump_helper.cpp +++ b/services/bundlemgr/src/hidump_helper.cpp @@ -183,7 +183,7 @@ ErrCode HidumpHelper::ProcessDump(const HidumpParam& hidumpParam, std::string &r ErrCode HidumpHelper::GetAllAbilityInfo(std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -214,7 +214,7 @@ ErrCode HidumpHelper::GetAllAbilityInfo(std::string &result) ErrCode HidumpHelper::GetAllAbilityNameList(std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -242,7 +242,7 @@ ErrCode HidumpHelper::GetAllAbilityNameList(std::string &result) ErrCode HidumpHelper::GetAbilityInfoByName(const std::string &name, std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -275,7 +275,7 @@ ErrCode HidumpHelper::GetAbilityInfoByName(const std::string &name, std::string ErrCode HidumpHelper::GetAllBundleInfo(std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -304,7 +304,7 @@ ErrCode HidumpHelper::GetAllBundleInfo(std::string &result) ErrCode HidumpHelper::GetAllBundleNameList(std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -326,7 +326,7 @@ ErrCode HidumpHelper::GetBundleInfoByName(const std::string &name, std::string & { APP_LOGD("hidump bundle info begin"); auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } @@ -353,7 +353,7 @@ ErrCode HidumpHelper::GetBundleInfoByName(const std::string &name, std::string & ErrCode HidumpHelper::GetAllDeviced(std::string &result) { auto shareDataMgr = dataMgr_.lock(); - if (!shareDataMgr) { + if (shareDataMgr == nullptr) { return ERR_APPEXECFWK_HIDUMP_SERVICE_ERROR; } diff --git a/services/bundlemgr/src/installd/installd_main.cpp b/services/bundlemgr/src/installd/installd_main.cpp index 7f03862f..331e60d2 100644 --- a/services/bundlemgr/src/installd/installd_main.cpp +++ b/services/bundlemgr/src/installd/installd_main.cpp @@ -22,7 +22,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) { using namespace OHOS::AppExecFwk; std::unique_ptr service = std::make_unique(); - if (!service) { + if (service == nullptr) { APP_LOGE("fail to create the installd service"); std::exit(EXIT_FAILURE); } diff --git a/services/bundlemgr/src/installd_client.cpp b/services/bundlemgr/src/installd_client.cpp index 2be7a9c6..add84736 100644 --- a/services/bundlemgr/src/installd_client.cpp +++ b/services/bundlemgr/src/installd_client.cpp @@ -146,17 +146,21 @@ void InstalldClient::ResetInstalldProxy() bool InstalldClient::GetInstalldProxy() { - if (!installdProxy_) { + if (installdProxy_ == nullptr) { APP_LOGD("try to get installd proxy"); std::lock_guard lock(mutex_); - if (!installdProxy_) { + if (installdProxy_ == nullptr) { sptr tempProxy = iface_cast(SystemAbilityHelper::GetSystemAbility(INSTALLD_SERVICE_ID)); - if ((!tempProxy) || (!tempProxy->AsObject())) { + if ((tempProxy == nullptr) || (tempProxy->AsObject() == nullptr)) { APP_LOGE("the installd proxy or remote object is null"); return false; } recipient_ = new (std::nothrow) InstalldDeathRecipient(); + if (recipient_ == nullptr) { + APP_LOGE("the death recipient is nullptr"); + return false; + } tempProxy->AsObject()->AddDeathRecipient(recipient_); installdProxy_ = tempProxy; } diff --git a/services/bundlemgr/src/kvstore_death_recipient_callback.cpp b/services/bundlemgr/src/kvstore_death_recipient_callback.cpp index f535f60a..8b4d8d89 100644 --- a/services/bundlemgr/src/kvstore_death_recipient_callback.cpp +++ b/services/bundlemgr/src/kvstore_death_recipient_callback.cpp @@ -43,13 +43,13 @@ void KvStoreDeathRecipientCallback::OnRemoteDied() { APP_LOGI("OnRemoteDied, register data change listener begin"); auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("dataMgr is nullptr"); return; } auto dataStorage = dataMgr->GetDataStorage(); - if (!dataStorage) { + if (dataStorage == nullptr) { APP_LOGE("dataStorage is nullptr"); return; } diff --git a/services/bundlemgr/src/sandbox_app/bundle_sandbox_installer.cpp b/services/bundlemgr/src/sandbox_app/bundle_sandbox_installer.cpp index c9a3119d..300b9d12 100644 --- a/services/bundlemgr/src/sandbox_app/bundle_sandbox_installer.cpp +++ b/services/bundlemgr/src/sandbox_app/bundle_sandbox_installer.cpp @@ -356,14 +356,14 @@ bool BundleSandboxInstaller::GetInnerBundleInfo(InnerBundleInfo &info, bool &isA ErrCode BundleSandboxInstaller::GetSandboxDataMgr() { - if (!sandboxDataMgr_) { + if (sandboxDataMgr_ == nullptr) { if (GetDataMgr() != ERR_OK) { APP_LOGE("Get dataMgr shared_ptr failed"); return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR; } sandboxDataMgr_ = dataMgr_->GetSandboxDataMgr(); - if (!sandboxDataMgr_) { + if (sandboxDataMgr_ == nullptr) { APP_LOGE("Get sandbox dataMgr shared_ptr nullptr"); return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR; } @@ -373,9 +373,9 @@ ErrCode BundleSandboxInstaller::GetSandboxDataMgr() ErrCode BundleSandboxInstaller::GetDataMgr() { - if (!dataMgr_) { + if (dataMgr_ == nullptr) { dataMgr_ = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr_) { + if (dataMgr_ == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR; } diff --git a/services/bundlemgr/src/status_receiver_proxy.cpp b/services/bundlemgr/src/status_receiver_proxy.cpp index 52e15dac..064dd672 100644 --- a/services/bundlemgr/src/status_receiver_proxy.cpp +++ b/services/bundlemgr/src/status_receiver_proxy.cpp @@ -357,7 +357,7 @@ void StatusReceiverProxy::OnStatusNotify(const int32_t progress) } sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to call OnStatusNotify, for Remote() is nullptr"); return; } @@ -393,7 +393,7 @@ void StatusReceiverProxy::OnFinished(const int32_t resultCode, const std::string } sptr remote = Remote(); - if (!remote) { + if (remote == nullptr) { APP_LOGE("fail to call OnFinished, for Remote() is nullptr"); return; } @@ -420,7 +420,7 @@ void StatusReceiverProxy::TransformResult(const int32_t resultCode) void StatusReceiverProxy::CloseStreamInstaller(uint32_t installerId) { if (installerId <= 0) { - APP_LOGE("invalid installer id: %{public}d", installerId); + APP_LOGE("invalid installer id: %{public}u", installerId); return; } sptr bundleInstaller = DelayedSingleton::GetInstance()->GetBundleInstaller(); diff --git a/services/bundlemgr/src/system_ability_helper.cpp b/services/bundlemgr/src/system_ability_helper.cpp index ae117a72..706d0b53 100644 --- a/services/bundlemgr/src/system_ability_helper.cpp +++ b/services/bundlemgr/src/system_ability_helper.cpp @@ -26,7 +26,7 @@ namespace AppExecFwk { sptr SystemAbilityHelper::GetSystemAbility(const int32_t systemAbilityId) { sptr systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (!systemAbilityMgr) { + if (systemAbilityMgr == nullptr) { APP_LOGE("fail to get the system ability manager to get %{public}d proxy", systemAbilityId); return nullptr; } diff --git a/services/bundlemgr/src/system_bundle_installer.cpp b/services/bundlemgr/src/system_bundle_installer.cpp index d6010c22..69080129 100644 --- a/services/bundlemgr/src/system_bundle_installer.cpp +++ b/services/bundlemgr/src/system_bundle_installer.cpp @@ -56,7 +56,7 @@ bool SystemBundleInstaller::OTAInstallSystemBundle( const std::vector &filePaths, Constants::AppType appType) { auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; } @@ -88,7 +88,7 @@ bool SystemBundleInstaller::OTAInstallSystemBundle( bool SystemBundleInstaller::UninstallSystemBundle(const std::string &bundleName) { auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; } @@ -114,7 +114,7 @@ bool SystemBundleInstaller::UninstallSystemBundle(const std::string &bundleName) bool SystemBundleInstaller::UninstallSystemBundle(const std::string &bundleName, const std::string &modulePackage) { auto dataMgr = DelayedSingleton::GetInstance()->GetDataMgr(); - if (!dataMgr) { + if (dataMgr == nullptr) { APP_LOGE("Get dataMgr shared_ptr nullptr"); return false; }