mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 09:21:28 +00:00
Signed-off-by: zhoushicheng2@huawei.com <zhoushicheng2@huawei.com> Change-Id: I4330da8d1371841ed2aad927caec7fd634f55714
This commit is contained in:
parent
57c1cbff46
commit
bcd23326b6
@ -137,6 +137,7 @@ ohos_shared_library("abilitykit_native") {
|
||||
"${kits_path}/appkit/native/app/src/sys_mgr_client.cpp",
|
||||
"${services_path}/abilitymgr/src/ability_start_setting.cpp",
|
||||
"${services_path}/abilitymgr/src/launch_param.cpp",
|
||||
"${services_path}/common/src/event_report.cpp",
|
||||
"src/ability.cpp",
|
||||
"src/ability_context.cpp",
|
||||
"src/ability_handler.cpp",
|
||||
@ -220,6 +221,7 @@ ohos_shared_library("abilitykit_native") {
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"dataability:native_dataability",
|
||||
"hisysevent_native:libhisysevent",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"ipc:ipc_core",
|
||||
"ipc_js:rpc",
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "context/context.h"
|
||||
#include "context/application_context.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "event_report.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
@ -291,6 +292,10 @@ void JsAbility::OnForeground(const Want &want)
|
||||
applicationContext->DispatchOnAbilityForeground(jsAbilityObj_);
|
||||
}
|
||||
HILOG_INFO("OnForeground end, ability is %{public}s.", GetAbilityName().c_str());
|
||||
AAFWK::EventInfo eventInfo;
|
||||
eventInfo.abilityName = GetAbilityName();
|
||||
AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONFOREGROUND,
|
||||
HiSysEventType::BEHAVIOR, eventInfo);
|
||||
}
|
||||
|
||||
void JsAbility::OnBackground()
|
||||
@ -310,6 +315,10 @@ void JsAbility::OnBackground()
|
||||
if (applicationContext != nullptr) {
|
||||
applicationContext->DispatchOnAbilityBackground(jsAbilityObj_);
|
||||
}
|
||||
AAFWK::EventInfo eventInfo;
|
||||
eventInfo.abilityName = GetAbilityName();
|
||||
AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONBACKGROUND,
|
||||
HiSysEventType::BEHAVIOR, eventInfo);
|
||||
}
|
||||
|
||||
std::unique_ptr<NativeReference> JsAbility::CreateAppWindowStage()
|
||||
|
@ -40,6 +40,8 @@ const std::string DISCONNECT_SERVICE_ERROR = "DISCONNECT_SERVICE_ERROR";
|
||||
const std::string START_ABILITY = "START_ABILITY";
|
||||
const std::string TERMINATE_ABILITY = "TERMINATE_ABILITY";
|
||||
const std::string CLOSE_ABILITY = "CLOSE_ABILITY";
|
||||
const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND";
|
||||
const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND";
|
||||
// serviceExtensionAbility behavior event
|
||||
const std::string START_SERVICE = "START_SERVICE";
|
||||
const std::string STOP_SERVICE = "STOP_SERVICE";
|
||||
|
@ -78,6 +78,12 @@ void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType
|
||||
HiSysEvent::Domain::AAFWK,
|
||||
eventName,
|
||||
type);
|
||||
} else if (eventName == ABILITY_ONFOREGROUND || eventName == ABILITY_ONBACKGROUND) {
|
||||
HiSysEvent::Write(
|
||||
HiSysEvent::Domain::AAFWK,
|
||||
eventName,
|
||||
type,
|
||||
EVENT_KEY_ABILITY_NAME, eventInfo.abilityName);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user