diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 3a0412238318f4f5220a3c6db6f2c73688b7db80..81d482128171098dc619fe9051f95cfedcfa6638 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -2154,6 +2154,9 @@ private: void ReportEventToRSS(const AppExecFwk::AbilityInfo &abilityInfo, sptr callerToken); + void ReportOtherCallerConnectEvent(const AppExecFwk::AbilityInfo &abilityInfo, + sptr callerToken); + void ReportAppRecoverResult(const int32_t appId, const AppExecFwk::ApplicationInfo &appInfo, const std::string& abilityName, const std::string& result); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index ceeb387a34d999a0ec3fea6e01c661233f2f3fe3..3f56740ea47b754b7ab71757d9a00ae6a623f385 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -2752,6 +2752,31 @@ void AbilityManagerService::ReportEventToRSS(const AppExecFwk::AbilityInfo &abil }); } +void AbilityManagerService::ReportOtherCallerConnectEvent(const AppExecFwk::AbilityInfo &abilityInfo, + sptr callerToken) +{ + if (PermissionVerification::GetInstance()->IsSACall()) { + return; + } + if (type != AppExecFwk::AbilityType::EXTENSION || + targetExtensionType == AppExecFwk::ExtensionAbilityType::SERVICE) { + return; + } + + EventInfo eventInfo; + eventInfo.bundleName = abilityRequest.want.GetElement().GetBundleName(); + eventInfo.moduleName = abilityRequest.want.GetElement().GetModuleName(); + eventInfo.abilityName = abilityRequest.want.GetElement().GetAbilityName(); + eventInfo.extensionType = static_cast(targetExtensionType); + + auto callerAbility = Token::GetAbilityRecordByToken(callerToken); + const int32_t callerPid = (callerAbility != nullptr) ? callerAbility->GetPid() : IPCSkeleton::GetCallingPid(); + eventInfo.pid = callerPid; + eventInfo.uid = callerAbility->GetUid(); + + EventReport::SendStartAbilityOtherExtensionEvent(EventName::START_ABILITY_OTHER_EXTENSION, eventInfo); +} + int32_t AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &callerToken, int32_t userId, AppExecFwk::ExtensionAbilityType extensionType) { @@ -4434,6 +4459,8 @@ int32_t AbilityManagerService::ConnectLocalAbility(const Want &want, const int32 return result; } + ReportOtherCallerConnectEvent(abilityInfo, callerToken); + if (!ExtensionPermissionsUtil::CheckSAPermission(targetExtensionType)) { TAG_LOGE(AAFwkTag::ABILITYMGR, "SA doesn't have target extension permission"); return CHECK_PERMISSION_FAILED;