diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index a75fdebec4d3384ac1b916cdf1bb08d9a647987d..1227693962e601d23964d8a3947dddb9016d78dd 100755 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -23,6 +23,7 @@ #include "ability_util.h" #include "bytrace.h" #include "hilog_wrapper.h" +#include "in_process_call_wrapper.h" namespace OHOS { namespace AAFwk { @@ -1029,8 +1030,8 @@ void AbilityConnectManager::GetExtensionRunningInfo(std::shared_ptr extensionInfos; - bool queryResult = bms->QueryExtensionAbilityInfos(abilityRecord->GetWant(), - AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, extensionInfos); + bool queryResult = IN_PROCESS_CALL(bms->QueryExtensionAbilityInfos(abilityRecord->GetWant(), + AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, extensionInfos)); if (queryResult) { HILOG_INFO("Query Extension Ability Infos Success."); auto abilityInfo = abilityRecord->GetAbilityInfo(); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 3cb24bb52699cdbadfec25421aa3f1cbfee5ff10..5fb1d98d9a0cca7b7d557b59c20edd0a5788a2af 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -35,6 +35,7 @@ #include "distributed_client.h" #include "hilog_wrapper.h" #include "if_system_ability_manager.h" +#include "in_process_call_wrapper.h" #include "ipc_skeleton.h" #include "iservice_registry.h" #include "itest_observer.h" @@ -501,15 +502,12 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs { HILOG_DEBUG("AbilityManagerService::GrantUriPermission is called."); auto bms = GetBundleManager(); - if (!bms) { - HILOG_ERROR("Get bundle manager service failed."); - return; - } + CHECK_POINTER_IS_NULLPTR(bms); auto bundleName = want.GetBundle(); AppExecFwk::BundleInfo bundleInfo; auto bundleFlag = AppExecFwk::BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO; - if (!bms->GetBundleInfo(bundleName, bundleFlag, bundleInfo, validUserId)) { + if (!IN_PROCESS_CALL(bms->GetBundleInfo(bundleName, bundleFlag, bundleInfo, validUserId))) { HILOG_ERROR("Not found ExtensionAbilityInfo according to the uri."); return; } @@ -524,10 +522,7 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUserId, uint32_t targetTokenId) { auto bms = GetBundleManager(); - if (!bms) { - HILOG_ERROR("Get bundle manager service failed."); - return; - } + CHECK_POINTER_IS_NULLPTR(bms); auto uriStr = want.GetUri().ToString(); auto uriVec = want.GetStringArrayParam(AbilityConfig::PARAMS_STREAM); uriVec.emplace_back(uriStr); @@ -535,7 +530,7 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs auto fromTokenId = IPCSkeleton::GetCallingTokenID(); AppExecFwk::ExtensionAbilityInfo info; for (auto str : uriVec) { - if (!bms->QueryExtensionAbilityInfoByUri(str, validUserId, info)) { + if (!IN_PROCESS_CALL(bms->QueryExtensionAbilityInfoByUri(str, validUserId, info))) { HILOG_WARN("Not found ExtensionAbilityInfo according to the uri."); continue; } @@ -704,16 +699,19 @@ std::string AbilityManagerService::AnonymizeDeviceId(const std::string& deviceId void AbilityManagerService::RequestPermission(const Want *resultWant) { HILOG_INFO("Request permission."); - CHECK_POINTER(iBundleManager_); CHECK_POINTER_IS_NULLPTR(resultWant); + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); auto callerBundleName = resultWant->GetStringParam(AbilityConfig::SYSTEM_DIALOG_CALLER_BUNDLENAME); auto permissions = resultWant->GetStringArrayParam(AbilityConfig::SYSTEM_DIALOG_REQUEST_PERMISSIONS); - for (auto &it : permissions) { - auto ret = iBundleManager_->RequestPermissionFromUser(callerBundleName, it, GetUserId()); - HILOG_INFO("Request permission from user result :%{public}d, permission:%{public}s.", ret, it.c_str()); - } + IN_PROCESS_CALL_WITHOUT_RET( + for (auto &it : permissions) { + auto ret = bms->RequestPermissionFromUser(callerBundleName, it, GetUserId()); + HILOG_INFO("Request permission from user result :%{public}d, permission:%{public}s.", ret, it.c_str()); + } + ); } int AbilityManagerService::TerminateAbilityByCaller(const sptr &callerToken, int requestCode) @@ -1189,11 +1187,11 @@ sptr AbilityManagerService::GetWantSender( if (!wantSenderInfo.bundleName.empty()) { bool bundleMgrResult = false; if (wantSenderInfo.userId < 0) { - bundleMgrResult = bms->GetBundleInfo(wantSenderInfo.bundleName, - AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo); + bundleMgrResult = IN_PROCESS_CALL(bms->GetBundleInfo(wantSenderInfo.bundleName, + AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo)); } else { - bundleMgrResult = bms->GetBundleInfo(wantSenderInfo.bundleName, - AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, wantSenderInfo.userId); + bundleMgrResult = IN_PROCESS_CALL(bms->GetBundleInfo(wantSenderInfo.bundleName, + AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, wantSenderInfo.userId)); } if (!bundleMgrResult) { HILOG_ERROR("GetBundleInfo is fail."); @@ -1203,7 +1201,8 @@ sptr AbilityManagerService::GetWantSender( HILOG_INFO("AbilityManagerService::GetWantSender: bundleName = %{public}s", wantSenderInfo.bundleName.c_str()); return pendingWantManager_->GetWantSender( - callerUid, bundleInfo.uid, bms->CheckIsSystemAppByUid(callerUid), wantSenderInfo, callerToken); + callerUid, bundleInfo.uid, + IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)), wantSenderInfo, callerToken); } int AbilityManagerService::SendWantSender(const sptr &target, const SenderInfo &senderInfo) @@ -1227,14 +1226,15 @@ void AbilityManagerService::CancelWantSender(const sptr &sender) sptr record = iface_cast(sender->AsObject()); AppExecFwk::BundleInfo bundleInfo; - bool bundleMgrResult = - bms->GetBundleInfo(record->GetKey()->GetBundleName(), AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo); + bool bundleMgrResult = IN_PROCESS_CALL( + bms->GetBundleInfo(record->GetKey()->GetBundleName(), AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo)); if (!bundleMgrResult) { HILOG_ERROR("GetBundleInfo is fail."); return; } - pendingWantManager_->CancelWantSender(callerUid, bundleInfo.uid, bms->CheckIsSystemAppByUid(callerUid), sender); + pendingWantManager_->CancelWantSender(callerUid, bundleInfo.uid, + IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)), sender); } int AbilityManagerService::GetPendingWantUid(const sptr &target) @@ -1341,7 +1341,7 @@ int AbilityManagerService::SetShowOnLockScreen(bool isAllow) CHECK_POINTER_AND_RETURN(bms, GET_ABILITY_SERVICE_FAILED); int callerUid = IPCSkeleton::GetCallingUid(); std::string bundleName; - bool result = bms->GetBundleNameForUid(callerUid, bundleName); + bool result = IN_PROCESS_CALL(bms->GetBundleNameForUid(callerUid, bundleName)); if (!result) { HILOG_ERROR("GetBundleNameForUid fail"); return GET_BUNDLENAME_BY_UID_FAIL; @@ -1561,7 +1561,7 @@ sptr AbilityManagerService::AcquireDataAbility( AbilityRequest abilityRequest; std::string dataAbilityUri = localUri.ToString(); HILOG_INFO("%{public}s, called. userId %{public}d", __func__, userId); - bool queryResult = iBundleManager_->QueryAbilityInfoByUri(dataAbilityUri, userId, abilityRequest.abilityInfo); + bool queryResult = IN_PROCESS_CALL(bms->QueryAbilityInfoByUri(dataAbilityUri, userId, abilityRequest.abilityInfo)); if (!queryResult || abilityRequest.abilityInfo.name.empty() || abilityRequest.abilityInfo.bundleName.empty()) { HILOG_ERROR("Invalid ability info for data ability acquiring."); return nullptr; @@ -2359,10 +2359,8 @@ int AbilityManagerService::GetUserId() bool AbilityManagerService::StartingLauncherAbility(bool isBoot) { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return false; - } + auto bms = GetBundleManager(); + CHECK_POINTER_AND_RETURN(bms, false); /* query if launcher ability has installed */ AppExecFwk::AbilityInfo abilityInfo; @@ -2372,7 +2370,7 @@ bool AbilityManagerService::StartingLauncherAbility(bool isBoot) want.SetElementName(AbilityConfig::LAUNCHER_BUNDLE_NAME, AbilityConfig::LAUNCHER_ABILITY_NAME); HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); int attemptNums = 0; - while (!(iBundleManager_->QueryAbilityInfo(want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, + while (!IN_PROCESS_CALL(bms->QueryAbilityInfo(want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, abilityInfo))) { HILOG_INFO("Waiting query launcher ability info completed."); if (!isBoot && ++attemptNums > SWITCH_ACCOUNT_TRY) { @@ -2391,10 +2389,8 @@ bool AbilityManagerService::StartingLauncherAbility(bool isBoot) void AbilityManagerService::StartingPhoneServiceAbility() { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); AppExecFwk::AbilityInfo phoneServiceInfo; Want phoneServiceWant; @@ -2404,13 +2400,15 @@ void AbilityManagerService::StartingPhoneServiceAbility() auto userId = GetUserId(); int attemptNums = 1; HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); - while (!(iBundleManager_->QueryAbilityInfo(phoneServiceWant, - OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, phoneServiceInfo)) && - attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { - HILOG_INFO("Waiting query phone service ability info completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - attemptNums++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!(bms->QueryAbilityInfo(phoneServiceWant, + OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, phoneServiceInfo)) && + attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { + HILOG_INFO("Waiting query phone service ability info completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + attemptNums++; + } + ); (void)StartAbility(phoneServiceWant, userId, DEFAULT_INVAL_VALUE); } @@ -2418,10 +2416,8 @@ void AbilityManagerService::StartingPhoneServiceAbility() void AbilityManagerService::StartingContactsAbility() { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); AppExecFwk::AbilityInfo contactsInfo; Want contactsWant; @@ -2430,13 +2426,15 @@ void AbilityManagerService::StartingContactsAbility() auto userId = GetUserId(); int attemptNums = 1; HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); - while (!(iBundleManager_->QueryAbilityInfo(contactsWant, - OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, contactsInfo)) && - attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { - HILOG_INFO("Waiting query contacts service completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - attemptNums++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!(bms->QueryAbilityInfo(contactsWant, + OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, contactsInfo)) && + attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { + HILOG_INFO("Waiting query contacts service completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + attemptNums++; + } + ); HILOG_INFO("attemptNums : %{public}d", attemptNums); if (attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { @@ -2447,10 +2445,8 @@ void AbilityManagerService::StartingContactsAbility() void AbilityManagerService::StartingMmsAbility() { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); AppExecFwk::AbilityInfo mmsInfo; Want mmsWant; @@ -2459,13 +2455,15 @@ void AbilityManagerService::StartingMmsAbility() auto userId = GetUserId(); int attemptNums = 1; HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); - while (!(iBundleManager_->QueryAbilityInfo(mmsWant, - OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, mmsInfo)) && - attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { - HILOG_INFO("Waiting query mms service completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - attemptNums++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!(bms->QueryAbilityInfo(mmsWant, + OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, mmsInfo)) && + attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { + HILOG_INFO("Waiting query mms service completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + attemptNums++; + } + ); HILOG_INFO("attemptNums : %{public}d", attemptNums); if (attemptNums <= MAX_NUMBER_OF_CONNECT_BMS) { @@ -2492,12 +2490,11 @@ int AbilityManagerService::GenerateAbilityRequest( AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_PERMISSION | AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_METADATA); HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); - bms->QueryAbilityInfo( - want, abilityInfoFlag, userId, request.abilityInfo); + IN_PROCESS_CALL_WITHOUT_RET(bms->QueryAbilityInfo(want, abilityInfoFlag, userId, request.abilityInfo)); if (request.abilityInfo.name.empty() || request.abilityInfo.bundleName.empty()) { // try to find extension std::vector extensionInfos; - bms->QueryExtensionAbilityInfos(want, abilityInfoFlag, userId, extensionInfos); + IN_PROCESS_CALL_WITHOUT_RET(bms->QueryExtensionAbilityInfos(want, abilityInfoFlag, userId, extensionInfos)); if (extensionInfos.size() <= 0) { HILOG_ERROR("Get extension info failed."); return RESOLVE_ABILITY_ERR; @@ -2658,7 +2655,8 @@ int AbilityManagerService::KillProcess(const std::string &bundleName) CHECK_POINTER_AND_RETURN(bms, KILL_PROCESS_FAILED); int32_t userId = GetUserId(); AppExecFwk::BundleInfo bundleInfo; - if (!bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, userId)) { + if (!IN_PROCESS_CALL( + bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, userId))) { HILOG_ERROR("Failed to get bundle info when kill process."); return GET_BUNDLE_INFO_FAILED; } @@ -2737,7 +2735,8 @@ int AbilityManagerService::PreLoadAppDataAbilities(const std::string &bundleName CHECK_POINTER_AND_RETURN(bms, GET_ABILITY_SERVICE_FAILED); AppExecFwk::BundleInfo bundleInfo; - bool ret = bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, userId); + bool ret = IN_PROCESS_CALL( + bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo, userId)); if (!ret) { HILOG_ERROR("Failed to get bundle info when app data abilities preloading, userId is %{public}d", userId); return RESOLVE_APP_ERR; @@ -3127,11 +3126,12 @@ int AbilityManagerService::LockMission(int missionId) { HILOG_INFO("request lock mission id :%{public}d", missionId); CHECK_POINTER_AND_RETURN(currentStackManager_, ERR_NO_INIT); - CHECK_POINTER_AND_RETURN(iBundleManager_, ERR_NO_INIT); + auto bms = GetBundleManager(); + CHECK_POINTER_AND_RETURN(bms, ERR_NO_INIT); int callerUid = IPCSkeleton::GetCallingUid(); int callerPid = IPCSkeleton::GetCallingPid(); - bool isSystemApp = iBundleManager_->CheckIsSystemAppByUid(callerUid); + bool isSystemApp = IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)); HILOG_DEBUG("locker uid :%{public}d, pid :%{public}d. isSystemApp: %{public}d", callerUid, callerPid, isSystemApp); return currentStackManager_->StartLockMission(callerUid, missionId, isSystemApp, true); } @@ -3140,19 +3140,21 @@ int AbilityManagerService::UnlockMission(int missionId) { HILOG_INFO("request unlock mission id :%{public}d", missionId); CHECK_POINTER_AND_RETURN(currentStackManager_, ERR_NO_INIT); - CHECK_POINTER_AND_RETURN(iBundleManager_, ERR_NO_INIT); + auto bms = GetBundleManager(); + CHECK_POINTER_AND_RETURN(bms, ERR_NO_INIT); int callerUid = IPCSkeleton::GetCallingUid(); int callerPid = IPCSkeleton::GetCallingPid(); - bool isSystemApp = iBundleManager_->CheckIsSystemAppByUid(callerUid); + bool isSystemApp = IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)); HILOG_DEBUG("locker uid :%{public}d, pid :%{public}d. isSystemApp: %{public}d", callerUid, callerPid, isSystemApp); return currentStackManager_->StartLockMission(callerUid, missionId, isSystemApp, false); } int AbilityManagerService::GetUidByBundleName(std::string bundleName) { - CHECK_POINTER_AND_RETURN(iBundleManager_, -1); - return iBundleManager_->GetUidByBundleName(bundleName, GetUserId()); + auto bms = GetBundleManager(); + CHECK_POINTER_AND_RETURN(bms, ERR_NO_INIT); + return IN_PROCESS_CALL(bms->GetUidByBundleName(bundleName, GetUserId())); } void AbilityManagerService::RestartAbility(const sptr &token) @@ -3181,7 +3183,7 @@ void AbilityManagerService::NotifyBmsAbilityLifeStatus( auto bundleManager = GetBundleManager(); CHECK_POINTER(bundleManager); HILOG_INFO("NotifyBmsAbilityLifeStatus is called, uid :%{public}d", uid); - bundleManager->NotifyAbilityLifeStatus(bundleName, abilityName, launchTime, uid); + IN_PROCESS_CALL_WITHOUT_RET(bundleManager->NotifyAbilityLifeStatus(bundleName, abilityName, launchTime, uid)); } void AbilityManagerService::StartSystemApplication() @@ -3206,19 +3208,19 @@ void AbilityManagerService::StartingSystemUiAbility() { HILOG_DEBUG("%{public}s", __func__); AppExecFwk::AbilityInfo systemUiInfo; - if (!iBundleManager_) { - HILOG_INFO("bms server is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); Want systemUiWant; systemUiWant.SetElementName(AbilityConfig::SYSTEM_UI_BUNDLE_NAME, AbilityConfig::SYSTEM_UI_ABILITY_NAME); uint32_t waitCnt = 0; // Wait 10 minutes for the installation to complete. - while (!iBundleManager_->QueryAbilityInfo(systemUiWant, systemUiInfo) && waitCnt < MAX_WAIT_SYSTEM_UI_NUM) { - HILOG_INFO("Waiting query system ui info completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - waitCnt++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!bms->QueryAbilityInfo(systemUiWant, systemUiInfo) && waitCnt < MAX_WAIT_SYSTEM_UI_NUM) { + HILOG_INFO("Waiting query system ui info completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + waitCnt++; + } + ); (void)StartAbility(systemUiWant, U0_USER_ID, DEFAULT_INVAL_VALUE); } @@ -3255,7 +3257,7 @@ bool AbilityManagerService::CheckCallerIsSystemAppByIpc() CHECK_POINTER_RETURN_BOOL(bms); int32_t callerUid = IPCSkeleton::GetCallingUid(); HILOG_ERROR("callerUid %{public}d", callerUid); - return bms->CheckIsSystemAppByUid(callerUid); + return IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)); } int AbilityManagerService::GetWantSenderInfo(const sptr &target, std::shared_ptr &info) @@ -3383,21 +3385,21 @@ sptr AbilityManagerService::GetAbilityTokenByMissionId(int32_t mi void AbilityManagerService::StartingSettingsDataAbility() { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); AppExecFwk::AbilityInfo abilityInfo; Want want; want.SetElementName(AbilityConfig::SETTINGS_DATA_BUNDLE_NAME, AbilityConfig::SETTINGS_DATA_ABILITY_NAME); uint32_t waitCnt = 0; - while (!iBundleManager_->QueryAbilityInfo(want, OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, - U0_USER_ID, abilityInfo) && waitCnt < MAX_WAIT_SETTINGS_DATA_NUM) { - HILOG_INFO("Waiting query settings data info completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - waitCnt++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!bms->QueryAbilityInfo(want, OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, + U0_USER_ID, abilityInfo) && waitCnt < MAX_WAIT_SETTINGS_DATA_NUM) { + HILOG_INFO("Waiting query settings data info completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + waitCnt++; + } + ); // node: do not use abilityInfo.uri directly, need check uri first. auto GetValidUri = [&]() -> std::string { @@ -3523,14 +3525,14 @@ int AbilityManagerService::CheckCallPermissions(const AbilityRequest &abilityReq } auto bms = GetBundleManager(); CHECK_POINTER_AND_RETURN(bms, GET_ABILITY_SERVICE_FAILED); - auto isCallerSystemApp = bms->CheckIsSystemAppByUid(callerUid); - auto isTargetSystemApp = bms->CheckIsSystemAppByUid(targetUid); + auto isCallerSystemApp = IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(callerUid)); + auto isTargetSystemApp = IN_PROCESS_CALL(bms->CheckIsSystemAppByUid(targetUid)); HILOG_ERROR("isCallerSystemApp:%{public}d, isTargetSystemApp:%{public}d", isCallerSystemApp, isTargetSystemApp); if (callerUid != SYSTEM_UID && !isCallerSystemApp) { HILOG_DEBUG("caller is common app."); std::string bundleName; - bool result = bms->GetBundleNameForUid(callerUid, bundleName); + bool result = IN_PROCESS_CALL(bms->GetBundleNameForUid(callerUid, bundleName)); if (!result) { HILOG_ERROR("GetBundleNameForUid from bms fail."); return RESOLVE_CALL_NO_PERMISSIONS; @@ -3940,15 +3942,12 @@ int AbilityManagerService::SetAbilityController(const sptr & { HILOG_DEBUG("%{public}s, imAStabilityTest: %{public}d", __func__, imAStabilityTest); auto bms = GetBundleManager(); - if (bms == nullptr) { - HILOG_ERROR("bms nullptr"); - return ERR_INVALID_VALUE; - } + CHECK_POINTER_AND_RETURN(bms, ERR_INVALID_VALUE); std::string bundleName; int uid = IPCSkeleton::GetCallingUid(); - bms->GetBundleNameForUid(uid, bundleName); + IN_PROCESS_CALL_WITHOUT_RET(bms->GetBundleNameForUid(uid, bundleName)); HILOG_INFO("%{public}s, bundleName: %{public}s, uid = %{public}d", __func__, bundleName.c_str(), uid); - if (bms->CheckPermission(bundleName, PERMISSION_SET_ABILITY_CONTROLLER) == 0) { + if (IN_PROCESS_CALL(bms->CheckPermission(bundleName, PERMISSION_SET_ABILITY_CONTROLLER)) == 0) { HILOG_ERROR("PERMISSION_SET_ABILITY_CONTROLLER check failed"); return CHECK_PERMISSION_FAILED; } @@ -4068,10 +4067,12 @@ int AbilityManagerService::StartUserTest(const Want &want, const sptrGetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, U0_USER_ID)) { + if (!IN_PROCESS_CALL( + bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, U0_USER_ID))) { HILOG_ERROR("Failed to get bundle info by U0_USER_ID %{public}d.", U0_USER_ID); int32_t userId = GetUserId(); - if (!bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, GetUserId())) { + if (!IN_PROCESS_CALL( + bms->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, GetUserId()))) { HILOG_ERROR("Failed to get bundle info by userId %{public}d.", userId); return GET_BUNDLE_INFO_FAILED; } @@ -4106,7 +4107,7 @@ int AbilityManagerService::GetCurrentTopAbility(sptr &token) auto callerUid = IPCSkeleton::GetCallingUid(); std::string bundleName; - auto result = bms->GetBundleNameForUid(callerUid, bundleName); + auto result = IN_PROCESS_CALL(bms->GetBundleNameForUid(callerUid, bundleName)); if (!result) { HILOG_ERROR("GetBundleNameForUid fail"); return GET_BUNDLENAME_BY_UID_FAIL; @@ -4210,7 +4211,10 @@ int32_t AbilityManagerService::ShowPickerDialog(const Want& want, int32_t userId CHECK_POINTER_AND_RETURN(bms, GET_ABILITY_SERVICE_FAILED); HILOG_INFO("share content: ShowPickerDialog, userId is %{public}d", userId); std::vector abilityInfos; - bms->QueryAbilityInfos(want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, abilityInfos); + IN_PROCESS_CALL_WITHOUT_RET( + bms->QueryAbilityInfos( + want, AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_WITH_APPLICATION, userId, abilityInfos) + ); return Ace::UIServiceMgrClient::GetInstance()->ShowAppPickerDialog(want, abilityInfos, userId); } @@ -4247,10 +4251,8 @@ bool AbilityManagerService::JudgeMultiUserConcurrency(const AppExecFwk::AbilityI void AbilityManagerService::StartingScreenLockAbility() { HILOG_DEBUG("%{public}s", __func__); - if (!iBundleManager_) { - HILOG_INFO("bms service is null"); - return; - } + auto bms = GetBundleManager(); + CHECK_POINTER_IS_NULLPTR(bms); constexpr int maxAttemptNums = 5; auto userId = GetUserId(); @@ -4259,13 +4261,15 @@ void AbilityManagerService::StartingScreenLockAbility() Want screenLockWant; screenLockWant.SetElementName(AbilityConfig::SCREEN_LOCK_BUNDLE_NAME, AbilityConfig::SCREEN_LOCK_ABILITY_NAME); HILOG_DEBUG("%{public}s, QueryAbilityInfo, userId is %{public}d", __func__, userId); - while (!(iBundleManager_->QueryAbilityInfo(screenLockWant, - OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, screenLockInfo)) && - attemptNums <= maxAttemptNums) { - HILOG_INFO("Waiting query mms service completed."); - usleep(REPOLL_TIME_MICRO_SECONDS); - attemptNums++; - } + IN_PROCESS_CALL_WITHOUT_RET( + while (!(bms->QueryAbilityInfo(screenLockWant, + OHOS::AppExecFwk::AbilityInfoFlag::GET_ABILITY_INFO_DEFAULT, userId, screenLockInfo)) && + attemptNums <= maxAttemptNums) { + HILOG_INFO("Waiting query mms service completed."); + usleep(REPOLL_TIME_MICRO_SECONDS); + attemptNums++; + } + ); HILOG_INFO("attemptNums : %{public}d", attemptNums); if (attemptNums <= maxAttemptNums) { @@ -4415,13 +4419,11 @@ void AbilityManagerService::StartupResidentProcess(int userId) { // Location may change auto bms = GetBundleManager(); - if (bms == nullptr) { - HILOG_ERROR("StartupResidentProcess bms is nullptr"); - return; - } + CHECK_POINTER_IS_NULLPTR(bms); std::vector bundleInfos; - bool getBundleInfos = iBundleManager_->GetBundleInfos(OHOS::AppExecFwk::GET_BUNDLE_DEFAULT, bundleInfos, userId); + bool getBundleInfos = IN_PROCESS_CALL( + bms->GetBundleInfos(OHOS::AppExecFwk::GET_BUNDLE_DEFAULT, bundleInfos, userId)); if (!getBundleInfos) { HILOG_ERROR("get bundle infos failed"); return; diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 49506827a3f632e7e638c9249b7f3bb582708d76..15b731773f41558d24a73a4725045a6baeb39825 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -32,6 +32,7 @@ #include "common_event_manager.h" #include "common_event_support.h" #include "hisysevent.h" +#include "in_process_call_wrapper.h" #include "ipc_skeleton.h" #include "iremote_object.h" #include "iservice_registry.h" @@ -222,13 +223,13 @@ bool AppMgrServiceInner::GetBundleAndHapInfo(const AbilityInfo &abilityInfo, } auto userId = GetUserIdByUid(appInfo->uid); - bool bundleMgrResult = bundleMgr_->GetBundleInfo(appInfo->bundleName, - BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, userId); + bool bundleMgrResult = IN_PROCESS_CALL(bundleMgr_->GetBundleInfo(appInfo->bundleName, + BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, userId)); if (!bundleMgrResult) { APP_LOGE("GetBundleInfo is fail"); return false; } - bundleMgrResult = bundleMgr_->GetHapModuleInfo(abilityInfo, hapModuleInfo); + bundleMgrResult = IN_PROCESS_CALL(bundleMgr_->GetHapModuleInfo(abilityInfo, hapModuleInfo)); if (!bundleMgrResult) { APP_LOGE("GetHapModuleInfo is fail"); return false; @@ -486,13 +487,13 @@ int32_t AppMgrServiceInner::KillApplicationByUserId(const std::string &bundleNam } int32_t callerUid = IPCSkeleton::GetCallingUid(); - if (!bundleMgr_->CheckIsSystemAppByUid(callerUid)) { + if (!IN_PROCESS_CALL(bundleMgr_->CheckIsSystemAppByUid(callerUid))) { APP_LOGE("caller is not systemApp, callerUid %{public}d", callerUid); return ERR_INVALID_VALUE; } APP_LOGI("userId value is %{public}d", userId); - int uid = bundleMgr_->GetUidByBundleName(bundleName, userId); + int uid = IN_PROCESS_CALL(bundleMgr_->GetUidByBundleName(bundleName, userId)); APP_LOGI("uid value is %{public}d", uid); if (!appRunningManager_->ProcessExitByBundleNameAndUid(bundleName, uid, pids)) { APP_LOGI("The process corresponding to the package name did not start"); @@ -545,7 +546,7 @@ void AppMgrServiceInner::ClearUpApplicationDataByUserId( return; } // 2.delete bundle side user data - if (!bundleMgr_->CleanBundleDataFiles(bundleName, userId)) { + if (!IN_PROCESS_CALL(bundleMgr_->CleanBundleDataFiles(bundleName, userId))) { APP_LOGE("Delete bundle side user data is fail"); return; } @@ -1219,8 +1220,8 @@ void AppMgrServiceInner::StartProcess(const std::string &appName, const std::str AppSpawnStartMsg startMsg; BundleInfo bundleInfo; std::vector bundleInfos; - bool bundleMgrResult = bundleMgr_->GetBundleInfos(AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, - bundleInfos, userId); + bool bundleMgrResult = IN_PROCESS_CALL(bundleMgr_->GetBundleInfos(AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, + bundleInfos, userId)); if (!bundleMgrResult) { APP_LOGE("GetBundleInfo is fail"); return; @@ -1244,7 +1245,7 @@ void AppMgrServiceInner::StartProcess(const std::string &appName, const std::str APP_LOGD("StartProcess accessTokenId:%{public}d, apl:%{public}s, bundleName:%{public}s coldStart:%{public}d", startMsg.accessTokenId, startMsg.apl.c_str(), bundleName.c_str(), coldStart); - bundleMgrResult = bundleMgr_->GetBundleGidsByUid(bundleName, uid, startMsg.gids); + bundleMgrResult = IN_PROCESS_CALL(bundleMgr_->GetBundleGidsByUid(bundleName, uid, startMsg.gids)); if (!bundleMgrResult) { APP_LOGE("GetBundleGids is fail"); return; @@ -1554,7 +1555,7 @@ int AppMgrServiceInner::CompelVerifyPermission(const std::string &permission, in APP_LOGE("GetBundleManager fail"); return ERR_NO_INIT; } - auto bmsUid = bundleMgr->GetUidByBundleName(bundleName, userId); + auto bmsUid = IN_PROCESS_CALL(bundleMgr->GetUidByBundleName(bundleName, userId)); if (bmsUid == ROOT_UID || bmsUid == SYSTEM_UID) { APP_LOGI("uid is root or system, PERMISSION_GRANTED"); message = ENUM_TO_STRING(PERMISSION_GRANTED); @@ -1564,7 +1565,7 @@ int AppMgrServiceInner::CompelVerifyPermission(const std::string &permission, in APP_LOGI("check uid != bms uid, PERMISSION_NOT_GRANTED"); return PERMISSION_NOT_GRANTED; } - auto result = bundleMgr->CheckPermissionByUid(bundleName, permission, userId); + auto result = IN_PROCESS_CALL(bundleMgr->CheckPermissionByUid(bundleName, permission, userId)); if (result != PERMISSION_GRANTED) { return PERMISSION_NOT_GRANTED; } @@ -1705,7 +1706,8 @@ void AppMgrServiceInner::RestartResidentProcess(std::shared_ptrGetBundleManager(); BundleInfo bundleInfo; - if (!bundleMgr->GetBundleInfo(appRecord->GetBundleName(), BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo)) { + if (!IN_PROCESS_CALL( + bundleMgr->GetBundleInfo(appRecord->GetBundleName(), BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo))) { APP_LOGE("GetBundleInfo fail"); return; } diff --git a/services/common/include/in_process_call_wrapper.h b/services/common/include/in_process_call_wrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..d3aa7d082ad161bb99df55cba3e55661913cd0c2 --- /dev/null +++ b/services/common/include/in_process_call_wrapper.h @@ -0,0 +1,36 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef IN_PROCESS_CALL_WRAPPER_H +#define IN_PROCESS_CALL_WRAPPER_H + +#include "ipc_skeleton.h" + +#define IN_PROCESS_CALL(theCall) \ + ([&]() { \ + std::string identity = IPCSkeleton::ResetCallingIdentity(); \ + auto retVal = theCall; \ + IPCSkeleton::SetCallingIdentity(identity); \ + return retVal; \ + }()) + +#define IN_PROCESS_CALL_WITHOUT_RET(theCall) \ + do { \ + std::string identity = IPCSkeleton::ResetCallingIdentity(); \ + theCall; \ + IPCSkeleton::SetCallingIdentity(identity); \ + } while (0) + +#endif // INNER_PROCESS_CALL_WRAPPER_H \ No newline at end of file diff --git a/services/formmgr/src/form_info_mgr.cpp b/services/formmgr/src/form_info_mgr.cpp index d4a988f3c381b5d44317e4f0ae0111d7229e7dc1..f932eca147fe4044f530ac1a1b47d7d70c87aac4 100644 --- a/services/formmgr/src/form_info_mgr.cpp +++ b/services/formmgr/src/form_info_mgr.cpp @@ -23,6 +23,7 @@ #include "form_bms_helper.h" #include "form_info_storage_mgr.h" #include "form_util.h" +#include "in_process_call_wrapper.h" #include "ipc_skeleton.h" #include "json_serializer.h" #include "permission_verification.h" @@ -47,8 +48,8 @@ ErrCode FormInfoHelper::LoadFormConfigInfoByBundleName(const std::string &bundle } BundleInfo bundleInfo; - if (!iBundleMgr->GetBundleInfo(bundleName, GET_BUNDLE_WITH_EXTENSION_INFO, - bundleInfo, FormUtil::GetCurrentAccountId())) { + if (!IN_PROCESS_CALL(iBundleMgr->GetBundleInfo(bundleName, GET_BUNDLE_WITH_EXTENSION_INFO, + bundleInfo, FormUtil::GetCurrentAccountId()))) { APP_LOGE("failed to get bundle info."); return ERR_APPEXECFWK_FORM_GET_INFO_FAILED; } @@ -112,7 +113,7 @@ ErrCode FormInfoHelper::LoadAbilityFormConfigInfo(const BundleInfo &bundleInfo, for (const auto &modelInfo: bundleInfo.hapModuleInfos) { const std::string &moduleName = modelInfo.moduleName; std::vector formInfoVec {}; - if (!iBundleMgr->GetFormsInfoByModule(bundleName, moduleName, formInfoVec)) { + if (!IN_PROCESS_CALL(iBundleMgr->GetFormsInfoByModule(bundleName, moduleName, formInfoVec))) { continue; } for (const auto &formInfo: formInfoVec) { @@ -377,7 +378,8 @@ bool FormInfoMgr::IsCaller(std::string bundleName) return false; } AppExecFwk::BundleInfo bundleInfo; - bool ret = bms->GetBundleInfo(bundleName, GET_BUNDLE_DEFAULT, bundleInfo, FormUtil::GetCurrentAccountId()); + bool ret = IN_PROCESS_CALL( + bms->GetBundleInfo(bundleName, GET_BUNDLE_DEFAULT, bundleInfo, FormUtil::GetCurrentAccountId())); if (!ret) { APP_LOGE("Failed to get bundle info."); return false; diff --git a/services/formmgr/src/form_mgr_adapter.cpp b/services/formmgr/src/form_mgr_adapter.cpp index e4fe509d2707282550fae964996f38d01f789e43..87e057ebd73d6f1a8d8200a17212bbbc2514fae1 100644 --- a/services/formmgr/src/form_mgr_adapter.cpp +++ b/services/formmgr/src/form_mgr_adapter.cpp @@ -40,6 +40,7 @@ #include "form_timer_mgr.h" #include "form_util.h" #include "if_system_ability_manager.h" +#include "in_process_call_wrapper.h" #include "ipc_skeleton.h" #include "iservice_registry.h" #include "ohos_account_kits.h" @@ -399,7 +400,7 @@ int FormMgrAdapter::UpdateForm(const int64_t formId, // check bundle uid for permission int callingUid = IPCSkeleton::GetCallingUid(); int32_t userId = GetCurrentUserId(callingUid); - int32_t bundleUid = iBundleMgr->GetUidByBundleName(bundleName, userId); + int32_t bundleUid = IN_PROCESS_CALL(iBundleMgr->GetUidByBundleName(bundleName, userId)); if (bundleUid != callingUid) { APP_LOGE("%{public}s error, permission denied, the updated form is not your own.", __func__); return ERR_APPEXECFWK_FORM_INVALID_PARAM; @@ -1039,8 +1040,8 @@ ErrCode FormMgrAdapter::GetBundleInfo(const AAFwk::Want &want, BundleInfo &bundl return ERR_APPEXECFWK_FORM_GET_BMS_FAILED; } - if (!iBundleMgr->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, - bundleInfo, FormUtil::GetCurrentAccountId())) { + if (!IN_PROCESS_CALL(iBundleMgr->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_WITH_ABILITIES, + bundleInfo, FormUtil::GetCurrentAccountId()))) { APP_LOGE("GetBundleInfo, failed to get bundle info."); return ERR_APPEXECFWK_FORM_GET_INFO_FAILED; } @@ -1180,12 +1181,12 @@ ErrCode FormMgrAdapter::CreateFormItemInfo(const BundleInfo &bundleInfo, return ERR_APPEXECFWK_FORM_GET_BMS_FAILED; } std::string hostBundleName {}; - if (!iBundleMgr->GetBundleNameForUid(IPCSkeleton::GetCallingUid(), hostBundleName)) { + if (!IN_PROCESS_CALL(iBundleMgr->GetBundleNameForUid(IPCSkeleton::GetCallingUid(), hostBundleName))) { APP_LOGE("GetFormsInfoByModule, failed to get form config info."); return ERR_APPEXECFWK_FORM_GET_INFO_FAILED; } itemInfo.SetHostBundleName(hostBundleName); - std::string icon = iBundleMgr->GetAbilityIcon(bundleInfo.name, formInfo.abilityName); + std::string icon = IN_PROCESS_CALL(iBundleMgr->GetAbilityIcon(bundleInfo.name, formInfo.abilityName)); itemInfo.SetIcon(icon); itemInfo.SetAbilityName(formInfo.abilityName); @@ -1249,7 +1250,7 @@ int FormMgrAdapter::SetNextRefreshTime(const int64_t formId, const int64_t nextT int32_t userId = GetCurrentUserId(callingUid); APP_LOGI("%{public}s, userId:%{public}d, callingUid:%{public}d.", __func__, userId, callingUid); - int32_t bundleUid = iBundleMgr->GetUidByBundleName(bundleName, userId); + int32_t bundleUid = IN_PROCESS_CALL(iBundleMgr->GetUidByBundleName(bundleName, userId)); if (bundleUid != callingUid) { APP_LOGE("%{public}s error, permission denied, the form is not your own.", __func__); return ERR_APPEXECFWK_FORM_INVALID_PARAM; @@ -1291,12 +1292,12 @@ bool FormMgrAdapter::GetBundleName(std::string &bundleName) } int uid = IPCSkeleton::GetCallingUid(); - if (!iBundleMgr->CheckIsSystemAppByUid(uid)) { + if (!IN_PROCESS_CALL(iBundleMgr->CheckIsSystemAppByUid(uid))) { APP_LOGE("%{public}s fail, form is not system app. uid:%{public}d", __func__, uid); return false; } - bool result = iBundleMgr->GetBundleNameForUid(uid, bundleName); + bool result = IN_PROCESS_CALL(iBundleMgr->GetBundleNameForUid(uid, bundleName)); if (!result || bundleName.empty()) { APP_LOGE("%{public}s failed, cannot get bundle name by uid:%{public}d", __func__, uid); return false; @@ -1651,10 +1652,10 @@ bool FormMgrAdapter::UpdateProviderInfoToHost(const int64_t matchedFormId, const bool FormMgrAdapter::CheckIsSystemAppByBundleName(const sptr &iBundleMgr, const std::string &bundleName) { BundleInfo bundleInfo; - if (iBundleMgr->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_DEFAULT, - bundleInfo, FormUtil::GetCurrentAccountId())) { + if (IN_PROCESS_CALL(iBundleMgr->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_DEFAULT, + bundleInfo, FormUtil::GetCurrentAccountId()))) { APP_LOGD("%{public}s, get bundle uid success", __func__); - if (!iBundleMgr->CheckIsSystemAppByUid(bundleInfo.uid)) { + if (!IN_PROCESS_CALL(iBundleMgr->CheckIsSystemAppByUid(bundleInfo.uid))) { APP_LOGW("%{public}s fail, form provider is not system app, bundleName: %{public}s", __func__, bundleName.c_str()); return false; diff --git a/services/formmgr/src/form_sys_event_receiver.cpp b/services/formmgr/src/form_sys_event_receiver.cpp index 797782fad7dc7e3dbb16250f027df5b91d301808..15fe912c61feb4374c3c4ff9246b73a2353386fe 100644 --- a/services/formmgr/src/form_sys_event_receiver.cpp +++ b/services/formmgr/src/form_sys_event_receiver.cpp @@ -31,6 +31,7 @@ #include "form_sys_event_receiver.h" #include "form_timer_mgr.h" #include "form_util.h" +#include "in_process_call_wrapper.h" #include "want.h" namespace OHOS { @@ -110,7 +111,7 @@ void FormSysEventReceiver::HandleProviderUpdated(const std::string &bundleName, } std::vector targetForms; - if (!iBundleMgr->GetFormsInfoByApp(bundleName, targetForms)) { + if (!IN_PROCESS_CALL(iBundleMgr->GetFormsInfoByApp(bundleName, targetForms))) { APP_LOGE("%{public}s error, failed to get forms info.", __func__); return; }