add some resource_schedule_service stub.

Signed-off-by: wangxiaoding <wangxiaoding2@huawei.com>
This commit is contained in:
wangxiaoding 2022-08-01 11:16:02 +08:00
parent 5dabe234ec
commit 000c00c5c6
4 changed files with 39 additions and 0 deletions

View File

@ -44,6 +44,7 @@ init_path = "//base/startup/init"
declare_args() {
background_task_mgr_continuous_task_enable = true
resource_schedule_service_enable = true
distributed_data_object_enable = true
ability_runtime_graphics = true
ability_runtime_power = true
@ -65,6 +66,11 @@ declare_args() {
background_task_mgr_continuous_task_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_resource_schedule_service)) {
resource_schedule_service_enable = false
}
if (defined(global_parts_info) &&
!defined(global_parts_info.resourceschedule_efficiency_manager)) {
efficiency_manager = false

View File

@ -74,6 +74,10 @@ config("abilityms_config") {
defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ]
}
if (resource_schedule_service_enable) {
defines += [ "RESOURCE_SCHEDULE_SERVICE_ENABLE" ]
}
if (efficiency_manager) {
defines += [ "EFFICIENCY_MANAGER_ENABLE" ]
}
@ -131,6 +135,10 @@ ohos_shared_library("abilityms") {
external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
}
if (resource_schedule_service_enable) {
external_deps += [ "resource_schedule_service:ressched_client" ]
}
if (efficiency_manager) {
external_deps += [ "efficiency_manager:suspend_manager_client" ]
}

View File

@ -1012,6 +1012,8 @@ private:
void SubscribeBackgroundTask();
void ReportAbilitStartInfoToRSS(const AppExecFwk::AbilityInfo &abilityInfo);
int CheckCrowdtestForeground(const Want &want, int requestCode, int32_t userId);
int StartAppgallery(int requestCode, int32_t userId, std::string action);

View File

@ -70,6 +70,11 @@
#include "suspend_manager_client.h"
#endif // EFFICIENCY_MANAGER_ENABLE
#ifdef RESOURCE_SCHEDULE_SERVICE_ENABLE
#include "res_sched_client.h"
#include "res_type.h"
#endif // RESOURCE_SCHEDULE_SERVICE_ENABLE
using OHOS::AppExecFwk::ElementName;
using OHOS::Security::AccessToken::AccessTokenKit;
@ -470,6 +475,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
HILOG_ERROR("missionListManager is nullptr. userId=%{public}d", validUserId);
return ERR_INVALID_VALUE;
}
ReportAbilitStartInfoToRSS(abilityInfo);
#ifdef EFFICIENCY_MANAGER_ENABLE
auto bms = AbilityUtil::GetBundleManager();
if (bms) {
@ -854,6 +860,23 @@ void AbilityManagerService::SubscribeBackgroundTask()
#endif
}
void AbilityManagerService::ReportAbilitStartInfoToRSS(const AppExecFwk::AbilityInfo &abilityInfo)
{
#ifdef RESOURCE_SCHEDULE_SERVICE_ENABLE
if (abilityInfo.type == AppExecFwk::AbilityType::PAGE &&
abilityInfo.launchMode != AppExecFwk::LaunchMode::SPECIFIED) {
std::unordered_map<std::string, std::string> eventParams {
{ "name", "ability_start" },
{ "uid", std::to_string(abilityInfo.applicationInfo.uid) },
{ "bundleName", abilityInfo.applicationInfo.bundleName },
{ "abilityName", abilityInfo.name }
};
ResourceSchedule::ResSchedClient::GetInstance().ReportData(
ResourceSchedule::ResType::RES_TYPE_APP_ABILITY_START, 0, eventParams);
}
#endif
}
int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr<IRemoteObject> &callerToken,
int32_t userId, AppExecFwk::ExtensionAbilityType extensionType)
{