diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index cdb4d94e50..dfb334347b 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1018,6 +1018,8 @@ private: void ReportAbilitStartInfoToRSS(const AppExecFwk::AbilityInfo &abilityInfo); + void ReportEventToSuspendManager(const AppExecFwk::AbilityInfo &abilityInfo); + int CheckCrowdtestForeground(const Want &want, int requestCode, int32_t userId); int StartAppgallery(int requestCode, int32_t userId, std::string action); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 4135ce4dbf..eff4a6ba2a 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -474,14 +474,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptrGetUidByBundleName(abilityInfo.bundleName, validUserId), - abilityInfo.bundleName, "THAW_BY_START_NOT_PAGE_ABILITY"); - } -#endif // EFFICIENCY_MANAGER_ENABLE + ReportEventToSuspendManager(abilityInfo); return connectManager->StartAbility(abilityRequest); } @@ -495,14 +488,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptrGetUidByBundleName(abilityInfo.bundleName, validUserId), - abilityInfo.bundleName, "THAW_BY_START_PAGE_ABILITY"); - } -#endif // EFFICIENCY_MANAGER_ENABLE + ReportEventToSuspendManager(abilityInfo); HILOG_DEBUG("Start ability, name is %{public}s.", abilityInfo.name.c_str()); return missionListManager->StartAbility(abilityRequest); } @@ -903,6 +889,17 @@ void AbilityManagerService::ReportAbilitStartInfoToRSS(const AppExecFwk::Ability #endif } +void AbilityManagerService::ReportEventToSuspendManager(const AppExecFwk::AbilityInfo &abilityInfo) +{ +#ifdef EFFICIENCY_MANAGER_ENABLE + std::string reason = (abilityInfo.type == AppExecFwk::AbilityType::PAGE) ? + "THAW_BY_START_PAGE_ABILITY" : "THAW_BY_START_NOT_PAGE_ABILITY"; + SuspendManager::SuspendManagerClient::GetInstance().ThawOneApplication( + abilityInfo.applicationInfo.uid, + abilityInfo.applicationInfo.bundleName, reason); +#endif // EFFICIENCY_MANAGER_ENABLE +} + int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &callerToken, int32_t userId, AppExecFwk::ExtensionAbilityType extensionType) { @@ -1588,6 +1585,8 @@ int AbilityManagerService::ConnectLocalAbility(const Want &want, const int32_t u HILOG_ERROR("connectManager is nullptr. userId=%{public}d", validUserId); return ERR_INVALID_VALUE; } + + ReportEventToSuspendManager(abilityInfo); return connectManager->ConnectAbilityLocked(abilityRequest, connect, callerToken); } @@ -3761,7 +3760,7 @@ int AbilityManagerService::StartAbilityByCall( HILOG_ERROR("currentMissionListManager_ is Null. curentUserId=%{public}d", GetUserId()); return ERR_INVALID_VALUE; } - + ReportEventToSuspendManager(abilityRequest.abilityInfo); return currentMissionListManager_->ResolveLocked(abilityRequest); }