From 3826d4a447151c4b9a235fabebe7025a02c87fcd Mon Sep 17 00:00:00 2001 From: weixin_45932406 Date: Fri, 5 Sep 2025 15:38:50 +0800 Subject: [PATCH] fix alarm Signed-off-by: zhaogan --- .../src/extension_ability_info.cpp | 2 +- .../bundlemgr/bundle_status_callback_host.cpp | 2 +- .../bundle_stream_installer_proxy.cpp | 10 +++--- .../src/bundlemgr/bundle_user_mgr_host.cpp | 2 +- .../bundlemgr/clean_cache_callback_host.cpp | 2 +- .../bundlemgr/process_cache_callback_host.cpp | 2 +- .../src/bundlemgr/status_receiver_host.cpp | 2 +- .../quick_fix_status_callback_host.cpp | 2 +- .../kits/js/app_control/js_app_control.cpp | 4 +-- interfaces/kits/js/bundlemgr/bundle_mgr.cpp | 24 ++++++------- .../kits/js/common/installer_helper.cpp | 1 - interfaces/kits/js/installer/installer.cpp | 3 +- .../js/launchermgr/bundle_status_callback.cpp | 2 +- .../js/shortcut_manager/shortcut_manager.cpp | 10 +++--- interfaces/kits/js/zip/napi/napi_zlib.cpp | 2 +- .../include/bundle_exception_handler.h | 2 +- .../include/quick_fix/quick_fix_deployer.h | 2 +- .../src/bundle_exception_handler.cpp | 16 ++++----- .../bundlemgr/src/bundle_installer_host.cpp | 31 ++++++++++++++-- .../src/bundle_mgr_service_event_handler.cpp | 2 +- .../bundlemgr/src/hmp_bundle_installer.cpp | 36 +++++++++---------- services/bundlemgr/src/ipc/installd_host.cpp | 2 +- .../bundle_overlay_install_checker.cpp | 4 +-- .../src/quick_fix/quick_fix_deployer.cpp | 4 +-- .../quick_fix/quick_fix_manager_host_impl.cpp | 2 +- .../sandbox_app/bundle_sandbox_data_mgr.cpp | 4 +-- 26 files changed, 98 insertions(+), 77 deletions(-) diff --git a/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp b/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp index 5d76452190..3e2ef6f92a 100644 --- a/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp +++ b/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp @@ -245,7 +245,7 @@ bool ExtensionAbilityInfo::ReadFromParcel(Parcel &parcel) READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, validDataGroupIdsSize); CONTAINER_SECURITY_VERIFY(parcel, validDataGroupIdsSize, &validDataGroupIds); for (auto i = 0; i < validDataGroupIdsSize; i++) { - dataGroupIds.emplace_back(Str16ToStr8(parcel.ReadString16())); + validDataGroupIds.emplace_back(Str16ToStr8(parcel.ReadString16())); } customProcess = Str16ToStr8(parcel.ReadString16()); arkTSMode = parcel.ReadString(); diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_host.cpp index 768fa7ab76..4cd961fe90 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_status_callback_host.cpp @@ -41,7 +41,7 @@ int BundleStatusCallbackHost::OnRemoteRequest( std::u16string descripter = BundleStatusCallbackHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in status callback host due to the reply is nullptr"); + APP_LOGE("descripter is not matched"); return OBJECT_NULL; } 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 8c3fe56914..cda5e1e54c 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 @@ -31,7 +31,7 @@ BundleStreamInstallerProxy::BundleStreamInstallerProxy(const sptr BundleStreamInstallerProxy:: ~BundleStreamInstallerProxy() { - LOG_D(BMS_TAG_INSTALLER, "destory bundle stream installer proxy instance"); + LOG_D(BMS_TAG_INSTALLER, "destroy bundle stream installer proxy instance"); } int32_t BundleStreamInstallerProxy::CreateStream(const std::string &fileName) @@ -39,7 +39,7 @@ int32_t BundleStreamInstallerProxy::CreateStream(const std::string &fileName) LOG_D(BMS_TAG_INSTALLER, "bundle stream installer proxy create stream begin"); int32_t fd = Constants::DEFAULT_STREAM_FD; if (fileName.empty()) { - LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create stream faile due to empty fileName"); + LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create stream fail due to empty fileName"); return fd; } MessageParcel data; @@ -77,7 +77,7 @@ int32_t BundleStreamInstallerProxy::CreateSignatureFileStream(const std::string LOG_D(BMS_TAG_INSTALLER, "bundle stream installer proxy create signature file stream begin"); int32_t fd = Constants::DEFAULT_STREAM_FD; if (moduleName.empty() || fileName.empty()) { - LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create stream faile due to empty fileName or moduleName"); + LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create stream fail due to empty fileName or moduleName"); return fd; } MessageParcel data; @@ -117,7 +117,7 @@ int32_t BundleStreamInstallerProxy::CreateSharedBundleStream(const std::string & LOG_D(BMS_TAG_INSTALLER, "bundle stream installer proxy create shared bundle stream begin"); int32_t fd = Constants::DEFAULT_STREAM_FD; if (hspName.empty()) { - LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create shared bundle stream faile due to empty hspName"); + LOG_E(BMS_TAG_INSTALLER, "BundleStreamInstallerProxy create shared bundle stream fail due to empty hspName"); return fd; } MessageParcel data; @@ -159,7 +159,7 @@ int32_t BundleStreamInstallerProxy::CreatePgoFileStream(const std::string &modul LOG_D(BMS_TAG_INSTALLER, "create pgo file stream begin"); int32_t fd = Constants::DEFAULT_STREAM_FD; if (moduleName.empty() || fileName.empty()) { - LOG_E(BMS_TAG_INSTALLER, "create stream faile due to empty fileName or moduleName"); + LOG_E(BMS_TAG_INSTALLER, "create stream fail due to empty fileName or moduleName"); return fd; } MessageParcel data; diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_host.cpp index addd636e7b..13467c41ec 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/bundle_user_mgr_host.cpp @@ -41,7 +41,7 @@ int BundleUserMgrHost::OnRemoteRequest( std::u16string descripter = BundleUserMgrHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in bundle user mgr host due to the reply is nullptr"); + APP_LOGE("descripter is not matched"); return OBJECT_NULL; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_host.cpp index 735f64cfa9..608a665a88 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/clean_cache_callback_host.cpp @@ -40,7 +40,7 @@ int CleanCacheCallbackHost::OnRemoteRequest( std::u16string descripter = CleanCacheCallbackHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in clean cache host due to the reply is nullptr"); + APP_LOGE("descripter is not matched"); return OBJECT_NULL; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp index bd87f98223..659f55cf37 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/process_cache_callback_host.cpp @@ -41,7 +41,7 @@ int ProcessCacheCallbackHost::OnRemoteRequest( std::u16string descripter = ProcessCacheCallbackHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in process cache host due to the reply is nullptr"); + APP_LOGE("descripter is not matched"); return OBJECT_NULL; } diff --git a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/status_receiver_host.cpp b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/status_receiver_host.cpp index 34f0b9b0e7..5ddfd70382 100644 --- a/interfaces/inner_api/appexecfwk_core/src/bundlemgr/status_receiver_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/bundlemgr/status_receiver_host.cpp @@ -40,7 +40,7 @@ int StatusReceiverHost::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess std::u16string descripter = StatusReceiverHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - APP_LOGE("fail to write reply message in status receiver host due to the reply is nullptr"); + APP_LOGE("descripter is not matched"); return OBJECT_NULL; } diff --git a/interfaces/inner_api/appexecfwk_core/src/quick_fix/quick_fix_status_callback_host.cpp b/interfaces/inner_api/appexecfwk_core/src/quick_fix/quick_fix_status_callback_host.cpp index 4e9fb344db..4eb3d9105c 100644 --- a/interfaces/inner_api/appexecfwk_core/src/quick_fix/quick_fix_status_callback_host.cpp +++ b/interfaces/inner_api/appexecfwk_core/src/quick_fix/quick_fix_status_callback_host.cpp @@ -43,7 +43,7 @@ int QuickFixStatusCallbackHost::OnRemoteRequest( std::u16string descripter = QuickFixStatusCallbackHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - LOG_E(BMS_TAG_DEFAULT, "fail to write reply message in clean cache host due to the reply is nullptr"); + LOG_E(BMS_TAG_DEFAULT, "descripter is not matched"); return OBJECT_NULL; } switch (code) { diff --git a/interfaces/kits/js/app_control/js_app_control.cpp b/interfaces/kits/js/app_control/js_app_control.cpp index 7739bcdf8d..3992c2aa38 100644 --- a/interfaces/kits/js/app_control/js_app_control.cpp +++ b/interfaces/kits/js/app_control/js_app_control.cpp @@ -547,7 +547,7 @@ bool ParseDiposedRule(napi_env env, napi_value nRule, DisposedRule &rule) napi_get_named_property(env, nRule, "controlType", &prop); int32_t controlType; if (!CommonFunc::ParseInt(env, prop, controlType)) { - APP_LOGW("disposedType parseInt failed"); + APP_LOGW("controlType parseInt failed"); return false; } if (controlType > static_cast(ControlType::DISALLOWED_LIST) || @@ -658,7 +658,7 @@ bool ParseDisposedRuleConfigurationArray(napi_env env, napi_value nDisposedRuleC napi_valuetype valueType = napi_undefined; NAPI_CALL_BASE(env, napi_typeof(env, value, &valueType), false); if (valueType != napi_object) { - APP_LOGE("disposedRuleConfiguration bot objext"); + APP_LOGE("disposedRuleConfiguration bot object"); disposedRuleConfigurations.clear(); return false; } diff --git a/interfaces/kits/js/bundlemgr/bundle_mgr.cpp b/interfaces/kits/js/bundlemgr/bundle_mgr.cpp index fa55ca85bb..3621cc0d55 100644 --- a/interfaces/kits/js/bundlemgr/bundle_mgr.cpp +++ b/interfaces/kits/js/bundlemgr/bundle_mgr.cpp @@ -1597,8 +1597,8 @@ static bool InnerGetBundleInfos( static void ProcessBundleInfos( napi_env env, napi_value result, const std::vector &bundleInfos) { - if (bundleInfos.size() > 0) { - APP_LOGI("-----bundleInfos is not null-----"); + if (!bundleInfos.empty()) { + APP_LOGI("-----bundleInfos is not empty-----"); size_t index = 0; for (const auto &item : bundleInfos) { APP_LOGD("name is %{public}s and bundleName is %{public}s ", @@ -1614,7 +1614,7 @@ static void ProcessBundleInfos( index++; } } else { - APP_LOGI("-----bundleInfos is null-----"); + APP_LOGI("-----bundleInfos is empty-----"); } } @@ -2845,7 +2845,7 @@ napi_value CreateAbilityTypeObject(napi_env env) napi_value value = nullptr; NAPI_CALL(env, napi_create_object(env, &value)); - + napi_value nUnknown = nullptr; NAPI_CALL(env, napi_create_int32(env, static_cast(AbilityType::UNKNOWN), &nUnknown)); NAPI_CALL(env, napi_set_named_property(env, value, "UNKNOWN", nUnknown)); @@ -3155,7 +3155,7 @@ napi_value CreateBundleFlagObject(napi_env env) static_cast(AbilityInfoFlag::GET_ABILITY_INFO_WITH_METADATA), &nAbilityInfoWithMetaData)); NAPI_CALL(env, napi_set_named_property(env, value, "GET_ABILITY_INFO_WITH_METADATA", nAbilityInfoWithMetaData)); - + napi_value nBundleWithHashValue = nullptr; NAPI_CALL(env, napi_create_int32(env, static_cast(BundleFlag::GET_BUNDLE_WITH_HASH_VALUE), &nBundleWithHashValue)); @@ -3173,7 +3173,7 @@ napi_value CreateBundleFlagObject(napi_env env) static_cast(ApplicationFlag::GET_APPLICATION_INFO_WITH_PERMISSION), &nAppInfoWithPermission)); NAPI_CALL(env, napi_set_named_property(env, value, "GET_APPLICATION_INFO_WITH_PERMISSION", nAppInfoWithPermission)); - + napi_value nAppInfoWithMetaData = nullptr; NAPI_CALL(env, napi_create_int32(env, static_cast(ApplicationFlag::GET_APPLICATION_INFO_WITH_METADATA), &nAppInfoWithMetaData)); @@ -3185,14 +3185,14 @@ napi_value CreateBundleFlagObject(napi_env env) static_cast(ApplicationFlag::GET_APPLICATION_INFO_WITH_DISABLE), &nAppInfoWithDisable)); NAPI_CALL(env, napi_set_named_property(env, value, "GET_APPLICATION_INFO_WITH_DISABLE", nAppInfoWithDisable)); - + napi_value nAppInfoWithCertificate = nullptr; NAPI_CALL(env, napi_create_int32(env, static_cast(ApplicationFlag::GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT), &nAppInfoWithCertificate)); NAPI_CALL(env, napi_set_named_property(env, value, "GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT", nAppInfoWithCertificate)); - + return value; } @@ -3696,7 +3696,7 @@ napi_value GetAbilityIcon(napi_env env, napi_callback_info info) NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); } } - + auto promise = CommonFunc::AsyncCallNativeMethod( env, asyncCallbackInfo, GET_ABILITY_ICON, GetAbilityIconExec, GetAbilityIconComplete); callbackPtr.release(); @@ -3919,7 +3919,7 @@ napi_value GetLaunchWantForBundle(napi_env env, napi_callback_info info) NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); } } - + auto promise = CommonFunc::AsyncCallNativeMethod( env, asyncCallbackInfo, GET_LAUNCH_WANT_FOR_BUNDLE, GetLaunchWantForBundleExec, GetLaunchWantForBundleComplete); callbackPtr.release(); @@ -4001,7 +4001,7 @@ napi_value IsAbilityEnabled(napi_env env, napi_callback_info info) NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); } } - + auto promise = CommonFunc::AsyncCallNativeMethod( env, asyncCallbackInfo, IS_ABILITY_ENABLED, IsAbilityEnabledExec, IsAbilityEnabledComplete); callbackPtr.release(); @@ -4083,7 +4083,7 @@ napi_value IsApplicationEnabled(napi_env env, napi_callback_info info) NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); } } - + auto promise = CommonFunc::AsyncCallNativeMethod(env, asyncCallbackInfo, IS_SET_APPLICATION_ENABLED, IsApplicationEnabledExec, IsApplicationEnabledComplete); callbackPtr.release(); diff --git a/interfaces/kits/js/common/installer_helper.cpp b/interfaces/kits/js/common/installer_helper.cpp index b3fb1d701c..62ce913f68 100755 --- a/interfaces/kits/js/common/installer_helper.cpp +++ b/interfaces/kits/js/common/installer_helper.cpp @@ -127,7 +127,6 @@ void InstallerHelper::CreateErrCodeMap(std::unordered_map& err { IStatusReceiver::ERR_INSTALL_SO_INCOMPATIBLE, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, { IStatusReceiver::ERR_INSTALL_AN_INCOMPATIBLE, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, { IStatusReceiver::ERR_INSTALL_TYPE_ERROR, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, - { IStatusReceiver::ERR_INSTALL_TYPE_ERROR, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, { IStatusReceiver::ERR_INSTALL_NOT_UNIQUE_DISTRO_MODULE_NAME, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, { IStatusReceiver::ERR_INSTALL_INCONSISTENT_MODULE_NAME, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, { IStatusReceiver::ERR_INSTALL_INVALID_NUMBER_OF_ENTRY_HAP, ERROR_INSTALL_MULTIPLE_HAP_INFO_INCONSISTENT }, diff --git a/interfaces/kits/js/installer/installer.cpp b/interfaces/kits/js/installer/installer.cpp index 31acd1be0e..e93b02ebea 100644 --- a/interfaces/kits/js/installer/installer.cpp +++ b/interfaces/kits/js/installer/installer.cpp @@ -204,7 +204,6 @@ napi_value GetBundleInstallerSync(napi_env env, napi_callback_info info) NAPI_CALL(env, napi_new_instance(env, m_classBundleInstaller, 0, nullptr, &nBundleInstaller)); APP_LOGD("call GetBundleInstallerSync done"); return nBundleInstaller; - APP_LOGI("call GetBundleInstallerSync done"); } static bool ParseHashParam(napi_env env, napi_value args, std::string &key, std::string &value) @@ -713,7 +712,7 @@ static bool ParseUninstallParam(napi_env env, napi_value args, UninstallParam &u !ParseModuleName(env, args, uninstallParam.moduleName) || !ParseVersionCode(env, args, uninstallParam.versionCode) || !ParseUserId(env, args, uninstallParam.userId)) { - APP_LOGE("Parse UninstallParam faied"); + APP_LOGE("Parse UninstallParam failed"); return false; } return true; diff --git a/interfaces/kits/js/launchermgr/bundle_status_callback.cpp b/interfaces/kits/js/launchermgr/bundle_status_callback.cpp index d805bd019b..981fc69cfc 100644 --- a/interfaces/kits/js/launchermgr/bundle_status_callback.cpp +++ b/interfaces/kits/js/launchermgr/bundle_status_callback.cpp @@ -221,7 +221,7 @@ void BundleStatusCallback::OnBundleRemoved(const std::string& bundleName, const .callback_ = removeCallback_, }; if (asyncCallbackInfo == nullptr) { - APP_LOGW("BundleStatusCallback OnBundleUpdated asyncCallbackInfo is nullptr bundleName : %{public}s", + APP_LOGW("BundleStatusCallback OnBundleRemoved asyncCallbackInfo is nullptr bundleName : %{public}s", bundleName.c_str()); delete work; return; diff --git a/interfaces/kits/js/shortcut_manager/shortcut_manager.cpp b/interfaces/kits/js/shortcut_manager/shortcut_manager.cpp index 1a74eabdb8..fc7379f839 100644 --- a/interfaces/kits/js/shortcut_manager/shortcut_manager.cpp +++ b/interfaces/kits/js/shortcut_manager/shortcut_manager.cpp @@ -144,7 +144,7 @@ void DeleteDesktopShortcutInfoComplete(napi_env env, napi_status status, void *d if (asyncCallbackInfo->err == SUCCESS) { NAPI_CALL_RETURN_VOID(env, napi_get_null(env, &result[ARGS_POS_ZERO])); } else { - result[0] = BusinessError::CreateCommonError(env, asyncCallbackInfo->err, ADD_DESKTOP_SHORTCUT_INFO, + result[0] = BusinessError::CreateCommonError(env, asyncCallbackInfo->err, DELETE_DESKTOP_SHORTCUT_INFO, Constants::PERMISSION_MANAGER_SHORTCUT); } CommonFunc::NapiReturnDeferred( @@ -361,7 +361,7 @@ static ErrCode InnerGetAllShortcutInfoForSelf(std::vectorGetAllShortcutInfoForSelf(shortcutInfos); } - + void GetAllShortcutInfoForSelfExec(napi_env env, void *data) { GetAllShortcutInfoForSelfCallbackInfo *asyncCallbackInfo = @@ -373,7 +373,7 @@ void GetAllShortcutInfoForSelfExec(napi_env env, void *data) asyncCallbackInfo->err = CommonFunc::ConvertErrCode( InnerGetAllShortcutInfoForSelf(asyncCallbackInfo->shortcutInfos)); } - + void GetAllShortcutInfoForSelfComplete(napi_env env, napi_status status, void *data) { GetAllShortcutInfoForSelfCallbackInfo *asyncCallbackInfo = @@ -394,7 +394,7 @@ void GetAllShortcutInfoForSelfComplete(napi_env env, napi_status status, void *d CommonFunc::NapiReturnDeferred( env, asyncCallbackInfo, result, ARGS_SIZE_TWO); } - + napi_value GetAllShortcutInfoForSelf(napi_env env, napi_callback_info info) { APP_LOGD("Napi begin GetAllShortcutInfoForSelf"); @@ -405,7 +405,7 @@ napi_value GetAllShortcutInfoForSelf(napi_env env, napi_callback_info info) return nullptr; } std::unique_ptr callbackPtr {asyncCallbackInfo}; - + auto promise = CommonFunc::AsyncCallNativeMethod(env, asyncCallbackInfo, "GetAllShortcutInfoForSelf", GetAllShortcutInfoForSelfExec, GetAllShortcutInfoForSelfComplete); callbackPtr.release(); diff --git a/interfaces/kits/js/zip/napi/napi_zlib.cpp b/interfaces/kits/js/zip/napi/napi_zlib.cpp index dc950df258..2b8e8677da 100755 --- a/interfaces/kits/js/zip/napi/napi_zlib.cpp +++ b/interfaces/kits/js/zip/napi/napi_zlib.cpp @@ -925,7 +925,7 @@ void DecompressExcute(napi_env env, AsyncZipCallbackInfo *asyncZipCallbackInfo) napi_value DecompressFile(napi_env env, napi_callback_info info) { - APP_LOGD("napi begin CompressFile"); + APP_LOGD("napi begin DecompressFile"); NapiArg args(env, info); if (!args.Init(ARGS_SIZE_TWO, ARGS_SIZE_FOUR)) { BusinessError::ThrowError(env, ERROR_PARAM_CHECK_ERROR, WRONG_PARAM); diff --git a/services/bundlemgr/include/bundle_exception_handler.h b/services/bundlemgr/include/bundle_exception_handler.h index 842df283a4..705da60027 100644 --- a/services/bundlemgr/include/bundle_exception_handler.h +++ b/services/bundlemgr/include/bundle_exception_handler.h @@ -38,7 +38,7 @@ public: * @param dataDir Indicates the dir needs to be removed. * @return Returns true for remove successfully, returns false otherwise. */ - bool RemoveBundleAndDataDir(const std::string &bundleDir, const std::string &bundleOrMoudleDir, + bool RemoveBundleAndDataDir(const std::string &bundleDir, const std::string &bundleOrModuleDir, int32_t userId) const; /** * @brief to obtain the bundle path and data path according to the input base bundle or data path. diff --git a/services/bundlemgr/include/quick_fix/quick_fix_deployer.h b/services/bundlemgr/include/quick_fix/quick_fix_deployer.h index 5333477fef..10a92d322c 100755 --- a/services/bundlemgr/include/quick_fix/quick_fix_deployer.h +++ b/services/bundlemgr/include/quick_fix/quick_fix_deployer.h @@ -53,7 +53,7 @@ private: const std::vector &bundleFilePaths, std::unordered_map &infos); - ErrCode ToInnerAppQuickFix(const std::unordered_map infos, + ErrCode ToInnerAppQuickFix(const std::unordered_map &infos, const InnerAppQuickFix &oldInnerAppQuickFix, InnerAppQuickFix &newInnerAppQuickFix); ErrCode GetBundleInfo(const std::string &bundleName, BundleInfo &bundleInfo); diff --git a/services/bundlemgr/src/bundle_exception_handler.cpp b/services/bundlemgr/src/bundle_exception_handler.cpp index 54838fdc2f..25ce54851e 100644 --- a/services/bundlemgr/src/bundle_exception_handler.cpp +++ b/services/bundlemgr/src/bundle_exception_handler.cpp @@ -22,12 +22,12 @@ namespace AppExecFwk { BundleExceptionHandler::BundleExceptionHandler(const std::shared_ptr &dataStorage) : dataStorage_(dataStorage) { - APP_LOGD("create bundle excepetion handler instance"); + APP_LOGD("create bundle exception handler instance"); } BundleExceptionHandler::~BundleExceptionHandler() { - APP_LOGD("destroy bundle excepetion handler instance"); + APP_LOGD("destroy bundle exception handler instance"); } @@ -51,7 +51,7 @@ void BundleExceptionHandler::InnerCheckSystemHspPath(const InnerBundleInfo &info } bool BundleExceptionHandler::RemoveBundleAndDataDir(const std::string &bundleDir, - const std::string &bundleOrMoudleDir, int32_t userId) const + const std::string &bundleOrModuleDir, int32_t userId) const { ErrCode result = InstalldClient::GetInstance()->RemoveDir(bundleDir); if (result != ERR_OK) { @@ -59,17 +59,17 @@ bool BundleExceptionHandler::RemoveBundleAndDataDir(const std::string &bundleDir return false; } - if (bundleOrMoudleDir.find(ServiceConstants::HAPS) != std::string::npos) { - result = InstalldClient::GetInstance()->RemoveModuleDataDir(bundleOrMoudleDir, userId); + if (bundleOrModuleDir.find(ServiceConstants::HAPS) != std::string::npos) { + result = InstalldClient::GetInstance()->RemoveModuleDataDir(bundleOrModuleDir, userId); if (result != ERR_OK) { - APP_LOGE("fail to remove module data dir %{public}s, error is %{public}d", bundleOrMoudleDir.c_str(), + APP_LOGE("fail to remove module data dir %{public}s, error is %{public}d", bundleOrModuleDir.c_str(), result); return false; } } else { - result = InstalldClient::GetInstance()->RemoveBundleDataDir(bundleOrMoudleDir, userId); + result = InstalldClient::GetInstance()->RemoveBundleDataDir(bundleOrModuleDir, userId); if (result != ERR_OK) { - APP_LOGE("fail to remove bundle data dir %{public}s, error is %{public}d", bundleOrMoudleDir.c_str(), + APP_LOGE("fail to remove bundle data dir %{public}s, error is %{public}d", bundleOrModuleDir.c_str(), result); return false; } diff --git a/services/bundlemgr/src/bundle_installer_host.cpp b/services/bundlemgr/src/bundle_installer_host.cpp index ea2ad68f01..f1d546d081 100644 --- a/services/bundlemgr/src/bundle_installer_host.cpp +++ b/services/bundlemgr/src/bundle_installer_host.cpp @@ -72,7 +72,7 @@ int BundleInstallerHost::OnRemoteRequest( std::u16string descripter = GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - LOG_E(BMS_TAG_INSTALLER, "fail to write reply message in bundle mgr host due to the reply is nullptr"); + LOG_E(BMS_TAG_INSTALLER, "descripter is not matched"); return OBJECT_NULL; } switch (code) { @@ -146,6 +146,10 @@ void BundleInstallerHost::HandleInstallMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } installParam->withCopyHaps = true; Install(bundlePath, *installParam, statusReceiver); LOG_D(BMS_TAG_INSTALLER, "handle install message finished"); @@ -167,6 +171,10 @@ void BundleInstallerHost::HandleRecoverMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } installParam->preinstallSourceFlag = ApplicationInfoFlag::FLAG_RECOVER_INSTALLED; Recover(bundleName, *installParam, statusReceiver); @@ -201,6 +209,10 @@ void BundleInstallerHost::HandleInstallMultipleHapsMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } installParam->withCopyHaps = true; Install(pathVec, *installParam, statusReceiver); LOG_D(BMS_TAG_INSTALLER, "handle install multiple haps finished"); @@ -222,7 +234,10 @@ void BundleInstallerHost::HandleUninstallMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); - + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } Uninstall(bundleName, *installParam, statusReceiver); LOG_D(BMS_TAG_INSTALLER, "handle uninstall message finished"); } @@ -244,6 +259,10 @@ void BundleInstallerHost::HandleUninstallModuleMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } Uninstall(bundleName, modulePackage, *installParam, statusReceiver); LOG_D(BMS_TAG_INSTALLER, "handle uninstall message finished"); } @@ -262,6 +281,10 @@ void BundleInstallerHost::HandleUninstallByUninstallParam(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } Uninstall(*uninstallParam, statusReceiver); } @@ -414,6 +437,10 @@ void BundleInstallerHost::HandleUninstallAndRecoverMessage(MessageParcel &data) return; } sptr statusReceiver = iface_cast(object); + if (statusReceiver == nullptr) { + LOG_E(BMS_TAG_INSTALLER, "statusReceiver is nullptr"); + return; + } installParam->preinstallSourceFlag = ApplicationInfoFlag::FLAG_RECOVER_INSTALLED; UninstallAndRecover(bundleName, *installParam, statusReceiver); LOG_D(BMS_TAG_INSTALLER, "handle UninstallAndRecover message finished"); diff --git a/services/bundlemgr/src/bundle_mgr_service_event_handler.cpp b/services/bundlemgr/src/bundle_mgr_service_event_handler.cpp index a552aeb0a9..40704f2c9d 100644 --- a/services/bundlemgr/src/bundle_mgr_service_event_handler.cpp +++ b/services/bundlemgr/src/bundle_mgr_service_event_handler.cpp @@ -1024,7 +1024,7 @@ void BMSEventHandler::ProcessScanDir(const std::string &dir, std::list bundleList = scanner.Scan(dir); - for (auto item : bundleList) { + for (const auto &item : bundleList) { auto iter = std::find(bundleDirs.begin(), bundleDirs.end(), item); if (iter == bundleDirs.end()) { bundleDirs.push_back(item); diff --git a/services/bundlemgr/src/hmp_bundle_installer.cpp b/services/bundlemgr/src/hmp_bundle_installer.cpp index 66b4129111..56c7644d12 100644 --- a/services/bundlemgr/src/hmp_bundle_installer.cpp +++ b/services/bundlemgr/src/hmp_bundle_installer.cpp @@ -351,32 +351,28 @@ void HmpBundleInstaller::CheckUninstallSystemHsp(const std::string &bundleName) APP_LOGD("bundleName %{public}s is not a system hsp", bundleName.c_str()); return; } - bool isExistHsp = false; for (const auto &item : info.GetInnerModuleInfos()) { if (item.second.distro.moduleType == "shared") { - isExistHsp = true; return; } } APP_LOGI("appService %{public}s does not have any hsp, so it need to be uninstalled.", bundleName.c_str()); - if (!isExistHsp) { - InstallParam installParam; - installParam.userId = Constants::DEFAULT_USERID; - installParam.needSavePreInstallInfo = true; - installParam.isPreInstallApp = true; - installParam.SetKillProcess(false); - installParam.needSendEvent = false; - installParam.isKeepData = true; - MarkPreBundleSyeEventBootTag(false); - ErrCode result = UninstallBundle(bundleName, installParam); - if (result != ERR_OK) { - APP_LOGW("uninstall system bundle fail, error: %{public}d", result); - return; - } - PreInstallBundleInfo preInstallBundleInfo; - if ((dataMgr_->GetPreInstallBundleInfo(bundleName, preInstallBundleInfo))) { - dataMgr_->DeletePreInstallBundleInfo(bundleName, preInstallBundleInfo); - } + InstallParam installParam; + installParam.userId = Constants::DEFAULT_USERID; + installParam.needSavePreInstallInfo = true; + installParam.isPreInstallApp = true; + installParam.SetKillProcess(false); + installParam.needSendEvent = false; + installParam.isKeepData = true; + MarkPreBundleSyeEventBootTag(false); + ErrCode result = UninstallBundle(bundleName, installParam); + if (result != ERR_OK) { + APP_LOGW("uninstall system bundle fail, error: %{public}d", result); + return; + } + PreInstallBundleInfo preInstallBundleInfo; + if ((dataMgr_->GetPreInstallBundleInfo(bundleName, preInstallBundleInfo))) { + dataMgr_->DeletePreInstallBundleInfo(bundleName, preInstallBundleInfo); } } diff --git a/services/bundlemgr/src/ipc/installd_host.cpp b/services/bundlemgr/src/ipc/installd_host.cpp index 1ba065c5c9..aee1734610 100644 --- a/services/bundlemgr/src/ipc/installd_host.cpp +++ b/services/bundlemgr/src/ipc/installd_host.cpp @@ -55,7 +55,7 @@ int InstalldHost::OnRemoteRequest(uint32_t code, MessageParcel &data, MessagePar std::u16string descripter = InstalldHost::GetDescriptor(); std::u16string remoteDescripter = data.ReadInterfaceToken(); if (descripter != remoteDescripter) { - LOG_E(BMS_TAG_INSTALLD, "installd host fail to write reply message due to the reply is nullptr"); + LOG_E(BMS_TAG_INSTALLD, "descripter is not matched"); return OHOS::ERR_APPEXECFWK_PARCEL_ERROR; } criticalManager_.BeforeRequest(); diff --git a/services/bundlemgr/src/overlay/bundle_overlay_install_checker.cpp b/services/bundlemgr/src/overlay/bundle_overlay_install_checker.cpp index c077c04ca3..18e7a3d26f 100644 --- a/services/bundlemgr/src/overlay/bundle_overlay_install_checker.cpp +++ b/services/bundlemgr/src/overlay/bundle_overlay_install_checker.cpp @@ -101,7 +101,7 @@ ErrCode BundleOverlayInstallChecker::CheckInternalBundle( // 4. check TargetModule with moduleName std::string targetModuleName = innerModuleInfos.at(moduleName).targetModuleName; if (targetModuleName == moduleName) { - APP_LOGE("target moduleName cannot be same with moudleName"); + APP_LOGE("target moduleName cannot be same with moduleName"); return ERR_BUNDLEMANAGER_OVERLAY_INSTALLATION_FAILED_INVALID_MODULE_NAME; } // 5. check target module is non-overlay hap @@ -252,7 +252,7 @@ ErrCode BundleOverlayInstallChecker::CheckTargetBundle(const std::string &target } // 1. check target bundle is not external overlay bundle if (oldInfo.GetOverlayType() == OVERLAY_EXTERNAL_BUNDLE) { - APP_LOGE("target bundle is cannot be external overlay bundle"); + APP_LOGE("target bundle cannot be external overlay bundle"); return ERR_BUNDLEMANAGER_OVERLAY_INSTALLATION_FAILED_TARGET_BUNDLE_IS_OVERLAY_BUNDLE; } // 2. check target bundle is system application diff --git a/services/bundlemgr/src/quick_fix/quick_fix_deployer.cpp b/services/bundlemgr/src/quick_fix/quick_fix_deployer.cpp index 3c04d10369..d700890ac2 100755 --- a/services/bundlemgr/src/quick_fix/quick_fix_deployer.cpp +++ b/services/bundlemgr/src/quick_fix/quick_fix_deployer.cpp @@ -91,7 +91,7 @@ ErrCode QuickFixDeployer::DeployQuickFix() } else { oldPath += ServiceConstants::PATCH_PATH + std::to_string(appQuick.deployingAppqfInfo.versionCode); } - if (InstalldClient::GetInstance()->RemoveDir(oldPath)) { + if (InstalldClient::GetInstance()->RemoveDir(oldPath) != ERR_OK) { LOG_E(BMS_TAG_DEFAULT, "delete %{private}s failed", oldPath.c_str()); } } @@ -530,7 +530,7 @@ ErrCode QuickFixDeployer::GetBundleInfo(const std::string &bundleName, BundleInf return ERR_OK; } -ErrCode QuickFixDeployer::ToInnerAppQuickFix(const std::unordered_map infos, +ErrCode QuickFixDeployer::ToInnerAppQuickFix(const std::unordered_map &infos, const InnerAppQuickFix &oldInnerAppQuickFix, InnerAppQuickFix &newInnerAppQuickFix) { LOG_D(BMS_TAG_DEFAULT, "ToInnerAppQuickFix start"); diff --git a/services/bundlemgr/src/quick_fix/quick_fix_manager_host_impl.cpp b/services/bundlemgr/src/quick_fix/quick_fix_manager_host_impl.cpp index 79c2219de1..f9a3dbc565 100644 --- a/services/bundlemgr/src/quick_fix/quick_fix_manager_host_impl.cpp +++ b/services/bundlemgr/src/quick_fix/quick_fix_manager_host_impl.cpp @@ -28,7 +28,7 @@ QuickFixManagerHostImpl::QuickFixManagerHostImpl() QuickFixManagerHostImpl::~QuickFixManagerHostImpl() { - LOG_I(BMS_TAG_DEFAULT, "destory QuickFixManagerHostImpl"); + LOG_I(BMS_TAG_DEFAULT, "destroy QuickFixManagerHostImpl"); } ErrCode QuickFixManagerHostImpl::DeployQuickFix(const std::vector &bundleFilePaths, diff --git a/services/bundlemgr/src/sandbox_app/bundle_sandbox_data_mgr.cpp b/services/bundlemgr/src/sandbox_app/bundle_sandbox_data_mgr.cpp index 80ee7e1c18..826f1d7ba7 100644 --- a/services/bundlemgr/src/sandbox_app/bundle_sandbox_data_mgr.cpp +++ b/services/bundlemgr/src/sandbox_app/bundle_sandbox_data_mgr.cpp @@ -345,8 +345,8 @@ void BundleSandboxDataMgr::RestoreSandboxUidAndGid(std::map lock(sandboxAppMutex_); for (const auto &info : sandboxAppInfos_) { - for (auto infoItem : info.second.GetInnerBundleUserInfos()) { - auto innerBundleUserInfo = infoItem.second; + for (const auto &infoItem : info.second.GetInnerBundleUserInfos()) { + auto &innerBundleUserInfo = infoItem.second; int32_t bundleId = innerBundleUserInfo.uid - innerBundleUserInfo.bundleUserInfo.userId * Constants::BASE_USER_RANGE; auto item = bundleIdMap.find(bundleId); -- Gitee