From 1d0da2a68116042d2aaca159a0fc6d40a11deb01 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 19 May 2022 10:41:50 +0800 Subject: [PATCH 01/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Iba66fa46a88c68570ac4cfeacd575a508b6dbdd1 --- bundle.json | 1 + hisysevent.yaml | 118 +++++++++++++++++- interfaces/innerkits/ability_manager/BUILD.gn | 5 +- .../abilitymgr/src/ability_manager_client.cpp | 12 ++ services/appmgr/include/event_report.h | 44 +++++++ services/appmgr/src/event_report.cpp | 70 +++++++++++ services/common/BUILD.gn | 7 +- services/common/include/event_report.h | 42 +++++++ services/common/src/event_report.cpp | 89 +++++++++++++ 9 files changed, 385 insertions(+), 3 deletions(-) create mode 100644 services/appmgr/include/event_report.h create mode 100644 services/appmgr/src/event_report.cpp create mode 100644 services/common/include/event_report.h create mode 100644 services/common/src/event_report.cpp diff --git a/bundle.json b/bundle.json index 44f682e4..84dbb0da 100644 --- a/bundle.json +++ b/bundle.json @@ -33,6 +33,7 @@ "distributeddatamgr_appdatamgr", "dsoftbus_standard", "form_runtime", + "hisysevent_native", "hiviewdfx_hilog_native", "ipc", "native_appdatamgr", diff --git a/hisysevent.yaml b/hisysevent.yaml index 17faea65..722a6200 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -44,4 +44,120 @@ THREAD_BLOCK_6S: UID: {type: INT32, desc: uid} PACKAGE_NAME: {type: STRING, desc: package name} PROCESS_NAME: {type: STRING, desc: process name} - MSG: {type: STRING, desc: application event message} \ No newline at end of file + MSG: {type: STRING, desc: application event message} + +ABILITY_START_ERROR: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_START: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_FOREGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_BACKGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_STOP: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONSTART: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONSTOP: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONACTIVE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONINACTIVE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONFOREGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONBACKGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONDISCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONCOMMAND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +EXTENSION_ONSTART: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +EXTENSION_ONSTOP: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +EXTENSION_ONCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +EXTENSION_ONDISCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +EXTENSION_ONCOMMAND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +APP_ATTACH: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + NAME: {type: STRING, desc: application name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PROCESS: {type: STRING, desc: process} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_LAUNCH: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + NAME: {type: STRING, desc: application name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PROCESS: {type: STRING, desc: process} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_FOREGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + NAME: {type: STRING, desc: application name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PROCESS: {type: STRING, desc: process} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_BACKGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + NAME: {type: STRING, desc: application name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PROCESS: {type: STRING, desc: process} + TIME_STAMP: {type: INT32, desc: time stamp} + +APP_TERMINATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + NAME: {type: STRING, desc: application name} + VERSION_NAME: {type: STRING, desc: version name} + VERSION_CODE: {type: INT32, desc: version code} + PROCESS: {type: STRING, desc: process} + TIME_STAMP: {type: INT32, desc: time stamp} \ No newline at end of file diff --git a/interfaces/innerkits/ability_manager/BUILD.gn b/interfaces/innerkits/ability_manager/BUILD.gn index 91b4749f..50e6481d 100644 --- a/interfaces/innerkits/ability_manager/BUILD.gn +++ b/interfaces/innerkits/ability_manager/BUILD.gn @@ -93,7 +93,10 @@ ohos_shared_library("ability_manager") { "${services_path}/abilitymgr:abilityms_config", ] - deps = [ "//third_party/jsoncpp:jsoncpp" ] + deps = [ + "${services_path}/common:perm_verification", + "//third_party/jsoncpp:jsoncpp", + ] external_deps = [ "ability_base:base", diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index a661fa25..a14c2be5 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -23,9 +23,14 @@ #include "iservice_registry.h" #include "string_ex.h" #include "system_ability_definition.h" +#include "event_report.h" namespace OHOS { namespace AAFwk { +namespace { +const std::string START_ABILTIY_ERROR = "START_ABILTIY_ERROR"; +const std::string START_ABILTIY = "START_ABILTIY"; +} std::shared_ptr AbilityManagerClient::instance_ = nullptr; std::recursive_mutex AbilityManagerClient::mutex_; @@ -99,6 +104,13 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY , AAFWK::HiSysEventType::FAULT); + ret = abms->StartAbility(want, userId, requestCode); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY_ERROR , AAFWK::HiSysEventType::FAULT); + } return abms->StartAbility(want, userId, requestCode); } diff --git a/services/appmgr/include/event_report.h b/services/appmgr/include/event_report.h new file mode 100644 index 00000000..408148c2 --- /dev/null +++ b/services/appmgr/include/event_report.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022-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 FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H +#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H + +#include +#include + +#include "ability_info.h" +#include "application_info.h" +#include "want.h" + +namespace OHOS { +namespace AAFWK { +enum HiSysEventType { + FAULT = 1, + STATISTIC = 2, + SECURITY = 3, + BEHAVIOR = 4, +}; +class EventReport { +public: + static void AppEvent(const std::shared_ptr &applicationInfo, + const std::string &pid, const std::string &eventName, HiSysEventType type); + template + static void EventWrite(const std::string &eventName, + HiSysEventType type, Types... keyValues); +}; +} // namespace AAFWK +} // namespace OHOS +#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/services/appmgr/src/event_report.cpp b/services/appmgr/src/event_report.cpp new file mode 100644 index 00000000..d01c1be2 --- /dev/null +++ b/services/appmgr/src/event_report.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2022-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. + */ + +#include "event_report.h" +#include "hisysevent.h" +#include "hilog_wrapper.h" + +#include + +namespace OHOS { +namespace AAFWK { +namespace { +const std::string EVENT_KEY_APP_NAME = "NAME"; +const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; +const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_PID = "PID"; +const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; +const std::string TYPE = "TYPE"; +} +void EventReport::AppEvent(const std::shared_ptr &applicationInfo, + const std::string &pid, const std::string &eventName, HiSysEventType type) +{ + std::string name = applicationInfo->name.c_str(); + std::string versionName = applicationInfo->versionName.c_str(); + uint32_t versionCode = applicationInfo->versionCode; + int32_t timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_APP_NAME, name, + EVENT_KEY_VERSION_NAME, versionName, + EVENT_KEY_VERSION_CODE, std::to_string(versionCode), + EVENT_KEY_PID, pid.c_str(), + EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); + HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," + "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", + name.c_str(), + versionName.c_str(), + versionCode, + pid.c_str(), + timeStamp); +} +template +void EventReport::EventWrite( + const std::string &eventName, + HiSysEventType type, + Types... keyValues) +{ + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + static_cast(type), + keyValues...); +} +} // namespace AAFWK +} // namespace OHOS \ No newline at end of file diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index c8d698ef..b93cec33 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -46,10 +46,15 @@ config("perm_verification_config") { ohos_shared_library("perm_verification") { public_configs = [ ":perm_verification_config" ] - sources = [ "src/permission_verification.cpp" ] + sources = [ + "src/permission_verification.cpp", + "src/event_report.cpp", + ] external_deps = [ "access_token:libaccesstoken_sdk", + "bundle_framework:appexecfwk_base", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "utils_base:utils", diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h new file mode 100644 index 00000000..91681b81 --- /dev/null +++ b/services/common/include/event_report.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022-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 FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H +#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H + +#include +#include + +namespace OHOS { +namespace AAFWK { +enum HiSysEventType { + FAULT = 1, + STATISTIC = 2, + SECURITY = 3, + BEHAVIOR = 4, +}; +class EventReport { +public: + static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, + HiSysEventType type); + // static void AppEvent(const std::shared_ptr &applicationInfo, + // const std::string &pid, const std::string &eventName, HiSysEventType type); + template + static void EventWrite(const std::string &eventName, + HiSysEventType type, Types... keyValues); +}; +} // namespace AAFWK +} // namespace OHOS +#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp new file mode 100644 index 00000000..7f1684d3 --- /dev/null +++ b/services/common/src/event_report.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022-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. + */ + +#include "event_report.h" +#include "hisysevent.h" +#include "hilog_wrapper.h" + +#include + +namespace OHOS { +namespace AAFWK { +namespace { +const std::string EVENT_KEY_PID = "PID"; +const std::string EVENT_KEY_UID = "UID"; +const std::string EVENT_KEY_RID = "RID"; +const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; +const std::string EVENT_KEY_ABILITY_TYPE = "ABILITY_TYPE"; +const std::string EVENT_KEY_MODEL_TYPE = "MODEL_TYPE"; +const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; +const std::string EVENT_KEY_DEVICEID = "DEVICEID"; +const std::string EVENT_KEY_URI = "URI"; +const std::string EVENT_KEY_ACTION = "ACTION"; +const std::string EVENT_KEY_APP_NAME = "NAME"; +const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; +const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; +const std::string TYPE = "TYPE"; +} +void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, + HiSysEventType type) +{ + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_ABILITY_NAME, abilityName); + HILOG_WARN("{eventName}: abilityName: %{public}s", + abilityName.c_str()); +} +// void EventReport::AppEvent(const std::shared_ptr &applicationInfo, +// const std::string &pid, const std::string &eventName, HiSysEventType type) +// { +// std::string name = applicationInfo->name.c_str(); +// std::string versionName = applicationInfo->versionName.c_str(); +// uint32_t versionCode = applicationInfo->versionCode; +// int32_t timeStamp = +// std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) +// .count(); +// EventReport::EventWrite( +// eventName, +// type, +// EVENT_KEY_APP_NAME, name, +// EVENT_KEY_VERSION_NAME, versionName, +// EVENT_KEY_VERSION_CODE, std::to_string(versionCode), +// EVENT_KEY_PID, pid.c_str(), +// EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); +// HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," +// "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", +// name.c_str(), +// versionName.c_str(), +// versionCode, +// pid.c_str(), +// timeStamp); +// } +template +void EventReport::EventWrite( + const std::string &eventName, + HiSysEventType type, + Types... keyValues) +{ + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + static_cast(type), + keyValues...); +} +} // namespace AAFWK +} // namespace OHOS \ No newline at end of file From 5cf399dce99305a59ce767e9e2504bbc89ff2e31 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 19 May 2022 12:13:11 +0800 Subject: [PATCH 02/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Iff07de5fc7bdb4a610a6866f9b9d40d4589666b4 --- services/abilitymgr/src/ability_manager_client.cpp | 4 ++-- services/common/include/event_report.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index a14c2be5..502730d0 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -106,10 +106,10 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY , AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY, AAFWK::HiSysEventType::FAULT); ret = abms->StartAbility(want, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY_ERROR , AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY_ERROR, AAFWK::HiSysEventType::FAULT); } return abms->StartAbility(want, userId, requestCode); } diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 91681b81..8e3e5bdc 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -17,7 +17,6 @@ #define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H #include -#include namespace OHOS { namespace AAFWK { From 66351c79ce1d496330d0d70cf8d5d49d9da70a59 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 19 May 2022 12:14:16 +0800 Subject: [PATCH 03/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id53bcdc05235c8bb15df38fd45fabba8aca134a1 --- services/common/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index b93cec33..648d4394 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -47,8 +47,8 @@ ohos_shared_library("perm_verification") { public_configs = [ ":perm_verification_config" ] sources = [ - "src/permission_verification.cpp", "src/event_report.cpp", + "src/permission_verification.cpp", ] external_deps = [ From ea4426dc6b7725171d401a41944c7926beb91c6a Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 14:43:06 +0800 Subject: [PATCH 04/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I6729d81bfd4c44c4e81d129bba0a9c2a8c9f7249 --- form_runtime/BUILD.gn | 3 + .../interfaces/kits/native/src/form_mgr.cpp | 33 ++++ .../src/ability_context_impl.cpp | 3 + frameworks/kits/ability/native/BUILD.gn | 2 + .../ability/native/include/event_report.h | 41 +++++ .../include/event_report.h:Zone.Identifier | 4 + .../ability/native/src/ability_context.cpp | 2 + .../native/src/ability_runtime/js_ability.cpp | 25 +++ .../ability_runtime/js_ability_context.cpp | 2 + .../ability/native/src/ability_thread.cpp | 2 + .../kits/ability/native/src/event_report.cpp | 89 +++++++++++ .../src/event_report.cpp:Zone.Identifier | 4 + .../src/form_runtime/js_form_extension.cpp | 21 +++ .../native/src/js_service_extension.cpp | 16 ++ .../src/js_service_extension_context.cpp | 2 + .../ability/native/src/page_ability_impl.cpp | 2 + .../service_extension_context.cpp | 3 + .../appkit/native/app/src/main_thread.cpp | 1 + hisysevent.yaml | 146 ++++++++++++++---- .../abilitymgr/src/ability_manager_client.cpp | 98 +++++++++++- .../src/ability_manager_service.cpp | 1 + .../abilitymgr/src/mission_list_manager.cpp | 2 + services/appmgr/BUILD.gn | 1 + services/appmgr/src/app_mgr_service_inner.cpp | 42 +++++ services/appmgr/src/module_running_record.cpp | 2 + services/common/include/event_report.h | 2 - services/common/src/event_report.cpp | 26 +--- 27 files changed, 514 insertions(+), 61 deletions(-) create mode 100644 frameworks/kits/ability/native/include/event_report.h create mode 100644 frameworks/kits/ability/native/include/event_report.h:Zone.Identifier create mode 100644 frameworks/kits/ability/native/src/event_report.cpp create mode 100644 frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier diff --git a/form_runtime/BUILD.gn b/form_runtime/BUILD.gn index c707acdc..3a44db88 100644 --- a/form_runtime/BUILD.gn +++ b/form_runtime/BUILD.gn @@ -132,6 +132,7 @@ config("fmskit_public_config") { include_dirs = [ "interfaces/kits/native/include", "${aafwk_path}/services/common/include", + "${appexecfwk_path}/test/systemtest/common/fms/common/include", "${form_runtime_path}/interfaces/inner_api/include", "${appexecfwk_inner_api_path}/appexecfwk_base/include", "${base_inner_api_path}/want/include", @@ -142,6 +143,7 @@ ohos_shared_library("fmskit_native") { configs = [ ":fmskit_config" ] public_configs = [ ":fmskit_public_config" ] sources = [ + "${services_path}/common/src/event_report.cpp", "interfaces/kits/native/src/form_errors.cpp", "interfaces/kits/native/src/form_host_client.cpp", "interfaces/kits/native/src/form_mgr.cpp", @@ -160,6 +162,7 @@ ohos_shared_library("fmskit_native") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "form_runtime:form_manager", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr_standard:samgr_proxy", diff --git a/form_runtime/interfaces/kits/native/src/form_mgr.cpp b/form_runtime/interfaces/kits/native/src/form_mgr.cpp index 564a94c0..5f17fd14 100644 --- a/form_runtime/interfaces/kits/native/src/form_mgr.cpp +++ b/form_runtime/interfaces/kits/native/src/form_mgr.cpp @@ -26,9 +26,22 @@ #include "iservice_registry.h" #include "string_ex.h" #include "system_ability_definition.h" +#include "event_report.h" namespace OHOS { namespace AppExecFwk { +namespace { +const std::string ADD_FORM = "ADD_FORM"; +const std::string REQUEST_FORM = "REQUEST_FORM"; +const std::string DELETE_FORM = "DELETE_FORM"; +const std::string CASTTEMP_FORM = "CASTTEMP_FORM"; +const std::string ACQUIREFORMSTATE_FORM = "ACQUIREFORMSTATE_FORM"; +const std::string MESSAGE_EVENT_FORM = "MESSAGE_EVENT_FORM"; +const std::string ROUTE_EVENT_FORM = "ROUTE_EVENT_FORM"; +const std::string RELEASE_FORM = "RELEASE_FORM"; +const std::string DELETE_INVALID_FORM = "DELETE_INVALID_FORM"; +const std::string SET_NEXT_REFRESH_TIME_FORM = "SET_NEXT_REFRESH_TIME_FORM"; +} FormMgr::FormMgr(){} FormMgr::~FormMgr() { @@ -70,6 +83,8 @@ int FormMgr::AddForm( HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->AddForm(formId, want, callerToken, formInfo); } @@ -87,6 +102,8 @@ int FormMgr::DeleteForm(const int64_t formId, const sptr &callerT HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = "delete form"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->DeleteForm(formId, callerToken); } @@ -105,6 +122,8 @@ int FormMgr::ReleaseForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = "release form"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->ReleaseForm(formId, callerToken, delCache); } @@ -143,6 +162,8 @@ int FormMgr::RequestForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->RequestForm(formId, callerToken, want); } @@ -181,6 +202,8 @@ int FormMgr::CastTempForm(const int64_t formId, const sptr &calle HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = "cast temp form"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->CastTempForm(formId, callerToken); } @@ -262,6 +285,8 @@ int FormMgr::MessageEvent(const int64_t formId, const Want &want, const sptrMessageEvent(formId, want, callerToken); } @@ -279,6 +304,8 @@ int FormMgr::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->RouterEvent(formId, want); } @@ -296,6 +323,8 @@ int FormMgr::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = "set next refresh form"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->SetNextRefreshTime(formId, nextTime); } @@ -588,6 +617,8 @@ int FormMgr::DeleteInvalidForms(const std::vector &formIds, const sptr< HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = "delete invalid forms"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -606,6 +637,8 @@ int FormMgr::AcquireFormState(const Want &want, const sptr &calle HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->AcquireFormState(want, callerToken, stateInfo); } diff --git a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp index fa2135d1..024b7e63 100644 --- a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp @@ -23,6 +23,7 @@ #include "connection_manager.h" #include "hilog_wrapper.h" #include "permission_list_state.h" +#include "hitrace_meter.h" using OHOS::Security::AccessToken::AccessTokenKit; using OHOS::Security::AccessToken::PermissionListState; @@ -125,6 +126,7 @@ ErrCode AbilityContextImpl::StartAbilityWithAccount(const AAFwk::Want &want, int ErrCode AbilityContextImpl::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("AbilityContextImpl::StartAbility. Start calling StartAbility."); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, requestCode); HILOG_INFO("AbilityContextImpl::StartAbility. End calling StartAbility. ret=%{public}d", err); @@ -219,6 +221,7 @@ void AbilityContextImpl::OnAbilityResult(int requestCode, int resultCode, const bool AbilityContextImpl::ConnectAbility(const AAFwk::Want &want, const sptr &connectCallback) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Connect ability begin, ability:%{public}s.", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str()); ErrCode ret = diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index ef92a015..835451b7 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -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", "hitrace_native:hitrace_meter", + "hisysevent_native:libhisysevent", "ipc:ipc_core", "ipc_js:rpc", "native_appdatamgr:native_appdatafwk", diff --git a/frameworks/kits/ability/native/include/event_report.h b/frameworks/kits/ability/native/include/event_report.h new file mode 100644 index 00000000..8e3e5bdc --- /dev/null +++ b/frameworks/kits/ability/native/include/event_report.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022-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 FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H +#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H + +#include + +namespace OHOS { +namespace AAFWK { +enum HiSysEventType { + FAULT = 1, + STATISTIC = 2, + SECURITY = 3, + BEHAVIOR = 4, +}; +class EventReport { +public: + static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, + HiSysEventType type); + // static void AppEvent(const std::shared_ptr &applicationInfo, + // const std::string &pid, const std::string &eventName, HiSysEventType type); + template + static void EventWrite(const std::string &eventName, + HiSysEventType type, Types... keyValues); +}; +} // namespace AAFWK +} // namespace OHOS +#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier b/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier new file mode 100644 index 00000000..1c8229e8 --- /dev/null +++ b/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier @@ -0,0 +1,4 @@ +[ZoneTransfer] +ZoneId=1 +ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html +HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/include/event_report.h diff --git a/frameworks/kits/ability/native/src/ability_context.cpp b/frameworks/kits/ability/native/src/ability_context.cpp index 89f5c506..58489818 100644 --- a/frameworks/kits/ability/native/src/ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_context.cpp @@ -26,6 +26,7 @@ #include "resource_manager.h" #include "sys_mgr_client.h" #include "system_ability_definition.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -167,6 +168,7 @@ std::shared_ptr AbilityContext::GetCallingAbility() bool AbilityContext::ConnectAbility(const Want &want, const sptr &conn) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); AppExecFwk::AbilityType type = GetAbilityInfoType(); std::shared_ptr abilityInfo = GetAbilityInfo(); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 4f8e7433..226f41c4 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -34,9 +34,19 @@ #include "string_wrapper.h" #include "context/context.h" #include "context/application_context.h" +#include "event_report.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { +namespace { +const std::string ABILITY_ONSTART = "ABILITY_ONSTART"; +const std::string ABILITY_ONSTOP = "ABILITY_ONSTOP"; +const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND"; +const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND"; +const std::string ABILITY_WINDOWSTAGE_CREATE = "ABILITY_WINDOWSTAGE_CREATE"; +const std::string ABILITY_WINDOWSTAGE_DESTORY = "ABILITY_WINDOWSTAGE_DESTORY"; +} #ifdef SUPPORT_GRAPHICS const std::string PAGE_STACK_PROPERTY_NAME = "pageStack"; #endif @@ -122,6 +132,7 @@ void JsAbility::Init(const std::shared_ptr &abilityInfo, void JsAbility::OnStart(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStart begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnStart(want); @@ -162,6 +173,8 @@ void JsAbility::OnStart(const Want &want) delegator->PostPerformStart(CreateADelegatorAbilityProperty()); } HILOG_INFO("OnStart end, ability is %{public}s.", GetAbilityName().c_str()); + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTART, AAFWK::HiSysEventType::BEHAVIOR); } void JsAbility::OnStop() @@ -186,11 +199,14 @@ void JsAbility::OnStop() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityDestroy(jsAbilityObj_); } + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR); } #ifdef SUPPORT_GRAPHICS void JsAbility::OnSceneCreated() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnSceneCreated begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnSceneCreated(); auto jsAppWindowStage = CreateAppWindowStage(); @@ -213,6 +229,8 @@ void JsAbility::OnSceneCreated() } HILOG_INFO("OnSceneCreated end, ability is %{public}s.", GetAbilityName().c_str()); + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_CREATE, AAFWK::HiSysEventType::BEHAVIOR); } void JsAbility::OnSceneRestored() @@ -252,10 +270,13 @@ void JsAbility::onSceneDestroyed() applicationContext->DispatchOnAbilityWindowStageDestroy(jsAbilityObj_); } HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR); } void JsAbility::OnForeground(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnForeground begin, ability is %{public}s.", GetAbilityName().c_str()); Ability::OnForeground(want); @@ -287,6 +308,8 @@ void JsAbility::OnForeground(const Want &want) applicationContext->DispatchOnAbilityForeground(jsAbilityObj_); } HILOG_INFO("OnForeground end, ability is %{public}s.", GetAbilityName().c_str()); + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONFOREGROUND, AAFWK::HiSysEventType::BEHAVIOR); } void JsAbility::OnBackground() @@ -305,6 +328,8 @@ void JsAbility::OnBackground() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityBackground(jsAbilityObj_); } + const std::string abilityName = GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONBACKGROUND, AAFWK::HiSysEventType::BEHAVIOR); } #endif diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp index 10e8b337..0300dd38 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp @@ -30,6 +30,7 @@ #include "start_options.h" #include "want.h" #include "event_handler.h" +#include "hitrace_meter.h" #ifdef SUPPORT_GRAPHICS #include "pixel_map_napi.h" @@ -162,6 +163,7 @@ NativeValue* JsAbilityContext::SetMissionIcon(NativeEngine* engine, NativeCallba NativeValue* JsAbilityContext::OnStartAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStartAbility is called."); if (info.argc == ARGC_ZERO) { diff --git a/frameworks/kits/ability/native/src/ability_thread.cpp b/frameworks/kits/ability/native/src/ability_thread.cpp index e185681f..a2ad1a69 100644 --- a/frameworks/kits/ability/native/src/ability_thread.cpp +++ b/frameworks/kits/ability/native/src/ability_thread.cpp @@ -1176,6 +1176,7 @@ void AbilityThread::AbilityThreadMain(std::shared_ptr &applicat const std::shared_ptr &abilityRecord, const std::shared_ptr &mainRunner, const std::shared_ptr &stageContext) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("AbilityThread main start."); sptr thread = sptr(new (std::nothrow) AbilityThread()); if (thread == nullptr) { @@ -1201,6 +1202,7 @@ void AbilityThread::AbilityThreadMain( std::shared_ptr &application, const std::shared_ptr &abilityRecord, const std::shared_ptr &stageContext) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("AbilityThread main start."); sptr thread = sptr(new (std::nothrow) AbilityThread()); if (thread == nullptr || abilityRecord == nullptr) { diff --git a/frameworks/kits/ability/native/src/event_report.cpp b/frameworks/kits/ability/native/src/event_report.cpp new file mode 100644 index 00000000..7f1684d3 --- /dev/null +++ b/frameworks/kits/ability/native/src/event_report.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022-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. + */ + +#include "event_report.h" +#include "hisysevent.h" +#include "hilog_wrapper.h" + +#include + +namespace OHOS { +namespace AAFWK { +namespace { +const std::string EVENT_KEY_PID = "PID"; +const std::string EVENT_KEY_UID = "UID"; +const std::string EVENT_KEY_RID = "RID"; +const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; +const std::string EVENT_KEY_ABILITY_TYPE = "ABILITY_TYPE"; +const std::string EVENT_KEY_MODEL_TYPE = "MODEL_TYPE"; +const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; +const std::string EVENT_KEY_DEVICEID = "DEVICEID"; +const std::string EVENT_KEY_URI = "URI"; +const std::string EVENT_KEY_ACTION = "ACTION"; +const std::string EVENT_KEY_APP_NAME = "NAME"; +const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; +const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; +const std::string TYPE = "TYPE"; +} +void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, + HiSysEventType type) +{ + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_ABILITY_NAME, abilityName); + HILOG_WARN("{eventName}: abilityName: %{public}s", + abilityName.c_str()); +} +// void EventReport::AppEvent(const std::shared_ptr &applicationInfo, +// const std::string &pid, const std::string &eventName, HiSysEventType type) +// { +// std::string name = applicationInfo->name.c_str(); +// std::string versionName = applicationInfo->versionName.c_str(); +// uint32_t versionCode = applicationInfo->versionCode; +// int32_t timeStamp = +// std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) +// .count(); +// EventReport::EventWrite( +// eventName, +// type, +// EVENT_KEY_APP_NAME, name, +// EVENT_KEY_VERSION_NAME, versionName, +// EVENT_KEY_VERSION_CODE, std::to_string(versionCode), +// EVENT_KEY_PID, pid.c_str(), +// EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); +// HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," +// "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", +// name.c_str(), +// versionName.c_str(), +// versionCode, +// pid.c_str(), +// timeStamp); +// } +template +void EventReport::EventWrite( + const std::string &eventName, + HiSysEventType type, + Types... keyValues) +{ + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + static_cast(type), + keyValues...); +} +} // namespace AAFWK +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier new file mode 100644 index 00000000..52841e24 --- /dev/null +++ b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier @@ -0,0 +1,4 @@ +[ZoneTransfer] +ZoneId=1 +ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html +HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/src/event_report.cpp diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp index 5244cc59..e6a310d8 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp @@ -29,9 +29,18 @@ #include "napi_common_configuration.h" #include "napi_common_util.h" #include "napi_common_want.h" +#include "event_report.h" namespace OHOS { namespace AbilityRuntime { +namespace { +const std::string FORM_LIFECYCLE_ONCREATE = "FORM_LIFECYCLE_ONCREATE"; +const std::string FORM_LIFECYCLE_ONDESTROY = "FORM_LIFECYCLE_ONDESTROY"; +const std::string FORM_LIFECYCLE_ONUPDATE = "FORM_LIFECYCLE_ONUPDATE"; +const std::string FORM_LIFECYCLE_EVENT = "FORM_LIFECYCLE_EVENT"; +const std::string FORM_LIFECYCLE_ONCASTTEMPFORM = "FORM_LIFECYCLE_ONCASTTEMPFORM"; +const std::string FORM_LIFECYCLE_ONACQUIREFORMSTATE = "FORM_LIFECYCLE_ONACQUIREFORMSTATE"; +} using namespace OHOS::AppExecFwk; const int ON_EVENT_PARAMS_SIZE = 2; @@ -150,6 +159,8 @@ OHOS::AppExecFwk::FormProviderInfo JsFormExtension::OnCreate(const OHOS::AAFwk:: } formProviderInfo.SetFormData(formData); HILOG_INFO("%{public}s called end.", __func__); + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); return formProviderInfo; } @@ -167,6 +178,8 @@ void JsFormExtension::OnDestroy(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onDestroy", argv, 1); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); } void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) @@ -187,6 +200,8 @@ void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) NativeValue* nativeMessage = reinterpret_cast(napiMessage); NativeValue* argv[] = {nativeFormId, nativeMessage}; CallObjectMethod("onEvent", argv, ON_EVENT_PARAMS_SIZE); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); } void JsFormExtension::OnUpdate(const int64_t formId) @@ -203,6 +218,8 @@ void JsFormExtension::OnUpdate(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onUpdate", argv, 1); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); } void JsFormExtension::OnCastToNormal(const int64_t formId) @@ -219,6 +236,8 @@ void JsFormExtension::OnCastToNormal(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onCastToNormal", argv, 1); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); } void JsFormExtension::OnVisibilityChange(const std::map& formEventsMap) @@ -349,6 +368,8 @@ FormState JsFormExtension::OnAcquireFormState(const Want &want) } else { return (AppExecFwk::FormState) state; } + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONACQUIREFORMSTATE, AAFWK::HiSysEventType::BEHAVIOR); } } // namespace AbilityRuntime } // namespace OHOS diff --git a/frameworks/kits/ability/native/src/js_service_extension.cpp b/frameworks/kits/ability/native/src/js_service_extension.cpp index 24b261e5..e8132610 100644 --- a/frameworks/kits/ability/native/src/js_service_extension.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension.cpp @@ -27,12 +27,18 @@ #include "napi_common_configuration.h" #include "napi_common_want.h" #include "napi_remote_object.h" +#include "event_report.h" namespace OHOS { namespace AbilityRuntime { namespace { constexpr size_t ARGC_ONE = 1; constexpr size_t ARGC_TWO = 2; +const std::string SERVICE_EXTENSION_ONSTART = "SERVICE_EXTENSION_ONSTART"; +const std::string SERVICE_EXTENSION_ONSTOP = "SERVICE_EXTENSION_ONSTOP"; +const std::string SERVICE_EXTENSION_ONCONNECT = "SERVICE_EXTENSION_ONCONNECT"; +const std::string SERVICE_EXTENSION_ONDISCONNECT = "SERVICE_EXTENSION_ONDISCONNECT"; +const std::string SERVICE_EXTENSION_ONREQUEST = "SERVICE_EXTENSION_ONREQUEST"; } using namespace OHOS::AppExecFwk; @@ -116,6 +122,8 @@ void JsServiceExtension::OnStart(const AAFwk::Want &want) NativeValue* argv[] = {nativeWant}; CallObjectMethod("onCreate", argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR); } void JsServiceExtension::OnStop() @@ -129,6 +137,8 @@ void JsServiceExtension::OnStop() HILOG_INFO("The service extension connection is not disconnected."); } HILOG_INFO("%{public}s end.", __func__); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR); } sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) @@ -168,6 +178,8 @@ sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) if (remoteObj == nullptr) { HILOG_ERROR("remoteObj nullptr."); } + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR); return remoteObj; } @@ -200,6 +212,8 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want) } nativeEngine->CallFunction(value, method, argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR); } void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId) @@ -221,6 +235,8 @@ void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int st NativeValue* argv[] = {nativeWant, nativeStartId}; CallObjectMethod("onRequest", argv, ARGC_TWO); HILOG_INFO("%{public}s end.", __func__); + const std::string abilityName = abilityInfo_->name.c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR); } NativeValue* JsServiceExtension::CallObjectMethod(const char* name, NativeValue* const* argv, size_t argc) diff --git a/frameworks/kits/ability/native/src/js_service_extension_context.cpp b/frameworks/kits/ability/native/src/js_service_extension_context.cpp index a4ca6139..45edf667 100644 --- a/frameworks/kits/ability/native/src/js_service_extension_context.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension_context.cpp @@ -28,6 +28,7 @@ #include "napi_remote_object.h" #include "napi_common_start_options.h" #include "start_options.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -105,6 +106,7 @@ private: std::weak_ptr context_; NativeValue* OnStartAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStartAbility is called"); // only support one or two or three params if (info.argc != ARGC_ONE && info.argc != ARGC_TWO && info.argc != ARGC_THREE) { diff --git a/frameworks/kits/ability/native/src/page_ability_impl.cpp b/frameworks/kits/ability/native/src/page_ability_impl.cpp index 436ff06d..855e6d8e 100644 --- a/frameworks/kits/ability/native/src/page_ability_impl.cpp +++ b/frameworks/kits/ability/native/src/page_ability_impl.cpp @@ -15,6 +15,7 @@ #include "page_ability_impl.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -28,6 +29,7 @@ using AbilityManagerClient = OHOS::AAFwk::AbilityManagerClient; */ void PageAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::LifeCycleStateInfo &targetState) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Handle ability transaction start, sourceState:%{public}d, targetState:%{public}d, " "isNewWant:%{public}d, sceneFlag:%{public}d.", lifecycleState_, diff --git a/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp b/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp index fc6a959c..fc08b0e6 100644 --- a/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp +++ b/frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp @@ -18,6 +18,7 @@ #include "ability_connection.h" #include "ability_manager_client.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -26,6 +27,7 @@ int ServiceExtensionContext::ILLEGAL_REQUEST_CODE(-1); ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str()); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, token_, ILLEGAL_REQUEST_CODE); if (err != ERR_OK) { @@ -36,6 +38,7 @@ ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want) const ErrCode ServiceExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str()); ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, ILLEGAL_REQUEST_CODE); diff --git a/frameworks/kits/appkit/native/app/src/main_thread.cpp b/frameworks/kits/appkit/native/app/src/main_thread.cpp index ba8aed58..c767e021 100644 --- a/frameworks/kits/appkit/native/app/src/main_thread.cpp +++ b/frameworks/kits/appkit/native/app/src/main_thread.cpp @@ -448,6 +448,7 @@ void MainThread::ScheduleAbilityStage(const HapModuleInfo &abilityStage) void MainThread::ScheduleLaunchAbility(const AbilityInfo &info, const sptr &token, const std::shared_ptr &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("MainThread schedule launch ability, name is %{public}s, type is %{public}d.", info.name.c_str(), info.type); diff --git a/hisysevent.yaml b/hisysevent.yaml index 722a6200..2d2be800 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -46,23 +46,27 @@ THREAD_BLOCK_6S: PROCESS_NAME: {type: STRING, desc: process name} MSG: {type: STRING, desc: application event message} -ABILITY_START_ERROR: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} +START_ABILITY_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_START: +TERMINATE_ABILITY_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +START_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_FOREGROUND: +DO_FOREGROUND_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_BACKGROUND: +DO_BACKGROUND_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_STOP: +TERMINATE_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} ABILITY_NAME: {type: STRING, desc: ability name} @@ -74,14 +78,6 @@ ABILITY_ONSTOP: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_ONACTIVE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONINACTIVE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - ABILITY_ONFOREGROUND: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} ABILITY_NAME: {type: STRING, desc: ability name} @@ -90,36 +86,128 @@ ABILITY_ONBACKGROUND: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_ONCONNECT: +ABILITY_WINDOWSTAGE_CREATE: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_ONDISCONNECT: +ABILITY_WINDOWSTAGE_DESTORY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONCOMMAND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + +START_EXTENSION_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +STOP_EXTENSION_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for extensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +CONNECT_SERVICE_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for serviceExtensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +DISCONNECT_SERVICE_ERROR: + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for serviceExtensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +START_SERVICE_EXTENSION: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +STOP_SERVICE_EXTENSION: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +CONNECT_SERVICE_EXTENSION: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + ABILITY_NAME: {type: STRING, desc: ability name} + +DISCONNECT_SERVICE_EXTENSION: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} ABILITY_NAME: {type: STRING, desc: ability name} -EXTENSION_ONSTART: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} +SERVICE_EXTENSION_ONSTART: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} ABILITY_NAME: {type: STRING, desc: ability name} -EXTENSION_ONSTOP: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} +SERVICE_EXTENSION_ONSTOP: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} ABILITY_NAME: {type: STRING, desc: ability name} -EXTENSION_ONCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} +SERVICE_EXTENSION_ONCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} ABILITY_NAME: {type: STRING, desc: ability name} -EXTENSION_ONDISCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} +SERVICE_EXTENSION_ONDISCONNECT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} ABILITY_NAME: {type: STRING, desc: ability name} -EXTENSION_ONCOMMAND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for extensionAbility} +SERVICE_EXTENSION_ONREQUEST: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} + ABILITY_NAME: {type: STRING, desc: ability name} + +ADD_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +REQUEST_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +DELETE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +CASTTEMP_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +ACQUIREFORMSTATE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +MESSAGE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +ROUTE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +RELEASE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +DELETE_INVALID_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +SET_NEXT_REFRESH_TIME_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONCREATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONDESTROY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONUPDATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_EVENT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONCASTTEMPFORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONACQUIREFORMSTATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} ABILITY_NAME: {type: STRING, desc: ability name} APP_ATTACH: diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 502730d0..cfad6d42 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -24,12 +24,25 @@ #include "string_ex.h" #include "system_ability_definition.h" #include "event_report.h" +#include "hitrace_meter.h" namespace OHOS { namespace AAFwk { namespace { -const std::string START_ABILTIY_ERROR = "START_ABILTIY_ERROR"; -const std::string START_ABILTIY = "START_ABILTIY"; +const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; +const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; +const std::string START_EXTENSION_ERROR = "START_EXTENSION_ERROR"; +const std::string STOP_EXTENSION_ERROR = "STOP_EXTENSION_ERROR"; +const std::string CONNECT_SERVICE_ERROR = "CONNECT_SERVICE_ERROR"; +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 DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; +const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; +const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; +const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; +const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; +const std::string DISCONNECT_SERVICE_EXTENSION = "DISCONNECT_SERVICE_EXTENSION"; } std::shared_ptr AbilityManagerClient::instance_ = nullptr; std::recursive_mutex AbilityManagerClient::mutex_; @@ -102,14 +115,15 @@ ErrCode AbilityManagerClient::ScheduleCommandAbilityDone(const sptrStartAbility(want, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILTIY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); } return abms->StartAbility(want, userId, requestCode); } @@ -117,28 +131,52 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in ErrCode AbilityManagerClient::StartAbility( const Want &want, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", want.GetElement().GetAbilityName().c_str(), userId); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->StartAbility(want, callerToken, userId, requestCode); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->StartAbility(want, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartSetting &abilityStartSetting, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions &startOptions, const sptr &callerToken, int requestCode, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), userId); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->StartAbility(want, startOptions, callerToken, userId, requestCode); } @@ -149,6 +187,13 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, bundleName=%{public}s, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), want.GetElement().GetBundleName().c_str(), userId); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, START_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, START_EXTENSION_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->StartExtensionAbility(want, callerToken, userId, extensionType); } @@ -157,6 +202,13 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Terminate ability come."); + int32_t ret = ERR_OK; + const std::string abilityName = resultWant->GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->TerminateAbility(token, resultCode, resultWant); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->TerminateAbility(token, resultCode, resultWant); } @@ -164,6 +216,15 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + // int32_t ret = ERR_OK; + // auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); + // auto abilityInfo = abilityRecord->GetAbilityInfo(); + // const std::string abilityName = abilityInfo.name.c_str(); + // AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + // ret = abms->TerminateAbilityByCaller(callerToken, requestCode); + // if (ret != ERR_OK) { + // AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + // } return abms->TerminateAbilityByCaller(callerToken, requestCode); } @@ -196,6 +257,13 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->ConnectAbility(want, connect, nullptr, userId); } @@ -206,6 +274,13 @@ ErrCode AbilityManagerClient::ConnectAbility( CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), userId); + int32_t ret = ERR_OK; + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->ConnectAbility(want, connect, callerToken, userId); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->ConnectAbility(want, connect, callerToken, userId); } @@ -214,6 +289,13 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); + int32_t ret = ERR_OK; + const std::string abilityName = "disconnect ability"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->DisconnectAbility(connect); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->DisconnectAbility(connect); } @@ -288,6 +370,8 @@ ErrCode AbilityManagerClient::StopServiceAbility(const Want &want) { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendHiSysEvent(abilityName, STOP_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); return abms->StopServiceAbility(want); } @@ -777,6 +861,8 @@ ErrCode AbilityManagerClient::DoAbilityForeground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + const std::string abilityName = "do ability foreground"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); return abms->DoAbilityForeground(token, flag); } @@ -784,6 +870,8 @@ ErrCode AbilityManagerClient::DoAbilityBackground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); + const std::string abilityName = "do ability background"; + AAFWK::EventReport::SendHiSysEvent(abilityName, DO_BACKGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); return abms->DoAbilityBackground(token, flag); } diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 50eeb281..58005900 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -266,6 +266,7 @@ ServiceRunningState AbilityManagerService::QueryServiceState() const int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("%{public}s coldStart:%{public}d", __func__, want.GetBoolParam("coldStart", false)); return StartAbilityInner(want, nullptr, requestCode, -1, userId); } diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index fd2a2a1a..b8e89b88 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -242,6 +242,7 @@ void MissionListManager::StartWaittingAbility() int MissionListManager::StartAbilityLocked(const std::shared_ptr ¤tTopAbility, const std::shared_ptr &callerAbility, const AbilityRequest &abilityRequest) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability locked."); // 1. choose target mission list auto targetList = GetTargetMissionList(callerAbility, abilityRequest); @@ -619,6 +620,7 @@ std::shared_ptr MissionListManager::GetCurrentTopAbilityLocked() int MissionListManager::AttachAbilityThread(const sptr &scheduler, const sptr &token) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::lock_guard guard(managerLock_); auto abilityRecord = GetAbilityRecordByToken(token); CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE); diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index c74490df..e7fe3cf5 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -47,6 +47,7 @@ ohos_shared_library("libappms") { "src/module_running_record.cpp", "src/remote_client_manager.cpp", "src/system_environment_information.cpp", + "src/event_report.cpp", ] defines = [ diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 253cb001..5116be67 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -49,6 +49,7 @@ #include "locale_config.h" #endif #include "uri_permission_manager_client.h" +#include "event_report.h" namespace OHOS { namespace AppExecFwk { @@ -94,6 +95,12 @@ const std::string EVENT_MESSAGE_DEFAULT = "AppMgrServiceInner HandleTimeOut!"; const std::string SYSTEM_BASIC = "system_basic"; const std::string SYSTEM_CORE = "system_core"; +const std::string APP_ATTACH = "APP_ATTACH"; +const std::string APP_LAUNCH = "APP_LAUNCH"; +const std::string APP_FOREGROUND = "APP_FOREGROUND"; +const std::string APP_BACKGROUND = "APP_BACKGROUND"; +const std::string APP_TERMINATE = "APP_TERMINATE"; + int32_t GetUserIdByUid(int32_t uid) { return uid / BASE_USER_RANGE; @@ -268,6 +275,13 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrRegisterAppDeathRecipient(); + const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + auto applicationInfo = appRecord->GetApplicationInfo(); + AAFWK::EventReport::AppEvent( + applicationInfo, + pidStr, + APP_ATTACH, + AAFWK::HiSysEventType::BEHAVIOR); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -303,6 +317,13 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrLaunchPendingAbilities(); + const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + auto applicationInfo = appRecord->GetApplicationInfo(); + AAFWK::EventReport::AppEvent( + applicationInfo, + pidStr, + APP_LAUNCH, + AAFWK::HiSysEventType::BEHAVIOR); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -337,6 +358,13 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) // push the foregrounded app front of RecentAppList. PushAppFront(recordId); HILOG_INFO("application is foregrounded"); + const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + auto applicationInfo = appRecord->GetApplicationInfo(); + AAFWK::EventReport::AppEvent( + applicationInfo, + pidStr, + APP_FOREGROUND, + AAFWK::HiSysEventType::BEHAVIOR); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -357,6 +385,13 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) } HILOG_INFO("application is backgrounded"); + const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + auto applicationInfo = appRecord->GetApplicationInfo(); + AAFWK::EventReport::AppEvent( + applicationInfo, + pidStr, + APP_BACKGROUND, + AAFWK::HiSysEventType::BEHAVIOR); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -389,6 +424,13 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) DelayedSingleton::GetInstance()->OnProcessDied(appRecord); HILOG_INFO("application is terminated"); + const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + auto applicationInfo = appRecord->GetApplicationInfo(); + AAFWK::EventReport::AppEvent( + applicationInfo, + pidStr, + APP_TERMINATE, + AAFWK::HiSysEventType::BEHAVIOR); } int32_t AppMgrServiceInner::KillApplication(const std::string &bundleName) diff --git a/services/appmgr/src/module_running_record.cpp b/services/appmgr/src/module_running_record.cpp index e4c42863..48821723 100644 --- a/services/appmgr/src/module_running_record.cpp +++ b/services/appmgr/src/module_running_record.cpp @@ -17,6 +17,7 @@ #include "app_mgr_service_inner.h" #include "app_running_record.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AppExecFwk { @@ -167,6 +168,7 @@ void ModuleRunningRecord::OnAbilityStateChanged( void ModuleRunningRecord::LaunchAbility(const std::shared_ptr &ability) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Launch ability."); if (!ability || !ability->GetToken()) { HILOG_ERROR("null abilityRecord or abilityToken"); diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 8e3e5bdc..4266072b 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -30,8 +30,6 @@ class EventReport { public: static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, HiSysEventType type); - // static void AppEvent(const std::shared_ptr &applicationInfo, - // const std::string &pid, const std::string &eventName, HiSysEventType type); template static void EventWrite(const std::string &eventName, HiSysEventType type, Types... keyValues); diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 7f1684d3..b95c2d27 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -36,6 +36,7 @@ const std::string EVENT_KEY_APP_NAME = "NAME"; const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; +const std::string EVENT_KEY_FORM_ID = "FORM_ID"; const std::string TYPE = "TYPE"; } void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, @@ -48,31 +49,6 @@ void EventReport::SendHiSysEvent(const std::string &abilityName, const std::stri HILOG_WARN("{eventName}: abilityName: %{public}s", abilityName.c_str()); } -// void EventReport::AppEvent(const std::shared_ptr &applicationInfo, -// const std::string &pid, const std::string &eventName, HiSysEventType type) -// { -// std::string name = applicationInfo->name.c_str(); -// std::string versionName = applicationInfo->versionName.c_str(); -// uint32_t versionCode = applicationInfo->versionCode; -// int32_t timeStamp = -// std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) -// .count(); -// EventReport::EventWrite( -// eventName, -// type, -// EVENT_KEY_APP_NAME, name, -// EVENT_KEY_VERSION_NAME, versionName, -// EVENT_KEY_VERSION_CODE, std::to_string(versionCode), -// EVENT_KEY_PID, pid.c_str(), -// EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); -// HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," -// "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", -// name.c_str(), -// versionName.c_str(), -// versionCode, -// pid.c_str(), -// timeStamp); -// } template void EventReport::EventWrite( const std::string &eventName, From f41ba4c9c71e248b48e1fb527691ac642262b3df Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 14:55:41 +0800 Subject: [PATCH 05/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I38fc3a44c87a40120b118d1bf52263066790d0fe --- .../ability/native/include/event_report.h | 41 --------- .../include/event_report.h:Zone.Identifier | 4 - .../kits/ability/native/src/event_report.cpp | 89 ------------------- .../src/event_report.cpp:Zone.Identifier | 4 - 4 files changed, 138 deletions(-) delete mode 100644 frameworks/kits/ability/native/include/event_report.h delete mode 100644 frameworks/kits/ability/native/include/event_report.h:Zone.Identifier delete mode 100644 frameworks/kits/ability/native/src/event_report.cpp delete mode 100644 frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier diff --git a/frameworks/kits/ability/native/include/event_report.h b/frameworks/kits/ability/native/include/event_report.h deleted file mode 100644 index 8e3e5bdc..00000000 --- a/frameworks/kits/ability/native/include/event_report.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2022-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 FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H -#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H - -#include - -namespace OHOS { -namespace AAFWK { -enum HiSysEventType { - FAULT = 1, - STATISTIC = 2, - SECURITY = 3, - BEHAVIOR = 4, -}; -class EventReport { -public: - static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, - HiSysEventType type); - // static void AppEvent(const std::shared_ptr &applicationInfo, - // const std::string &pid, const std::string &eventName, HiSysEventType type); - template - static void EventWrite(const std::string &eventName, - HiSysEventType type, Types... keyValues); -}; -} // namespace AAFWK -} // namespace OHOS -#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier b/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier deleted file mode 100644 index 1c8229e8..00000000 --- a/frameworks/kits/ability/native/include/event_report.h:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=1 -ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html -HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/include/event_report.h diff --git a/frameworks/kits/ability/native/src/event_report.cpp b/frameworks/kits/ability/native/src/event_report.cpp deleted file mode 100644 index 7f1684d3..00000000 --- a/frameworks/kits/ability/native/src/event_report.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2022-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. - */ - -#include "event_report.h" -#include "hisysevent.h" -#include "hilog_wrapper.h" - -#include - -namespace OHOS { -namespace AAFWK { -namespace { -const std::string EVENT_KEY_PID = "PID"; -const std::string EVENT_KEY_UID = "UID"; -const std::string EVENT_KEY_RID = "RID"; -const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; -const std::string EVENT_KEY_ABILITY_TYPE = "ABILITY_TYPE"; -const std::string EVENT_KEY_MODEL_TYPE = "MODEL_TYPE"; -const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; -const std::string EVENT_KEY_DEVICEID = "DEVICEID"; -const std::string EVENT_KEY_URI = "URI"; -const std::string EVENT_KEY_ACTION = "ACTION"; -const std::string EVENT_KEY_APP_NAME = "NAME"; -const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; -const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; -const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; -const std::string TYPE = "TYPE"; -} -void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, - HiSysEventType type) -{ - EventReport::EventWrite( - eventName, - type, - EVENT_KEY_ABILITY_NAME, abilityName); - HILOG_WARN("{eventName}: abilityName: %{public}s", - abilityName.c_str()); -} -// void EventReport::AppEvent(const std::shared_ptr &applicationInfo, -// const std::string &pid, const std::string &eventName, HiSysEventType type) -// { -// std::string name = applicationInfo->name.c_str(); -// std::string versionName = applicationInfo->versionName.c_str(); -// uint32_t versionCode = applicationInfo->versionCode; -// int32_t timeStamp = -// std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) -// .count(); -// EventReport::EventWrite( -// eventName, -// type, -// EVENT_KEY_APP_NAME, name, -// EVENT_KEY_VERSION_NAME, versionName, -// EVENT_KEY_VERSION_CODE, std::to_string(versionCode), -// EVENT_KEY_PID, pid.c_str(), -// EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); -// HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," -// "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", -// name.c_str(), -// versionName.c_str(), -// versionCode, -// pid.c_str(), -// timeStamp); -// } -template -void EventReport::EventWrite( - const std::string &eventName, - HiSysEventType type, - Types... keyValues) -{ - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - keyValues...); -} -} // namespace AAFWK -} // namespace OHOS \ No newline at end of file diff --git a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier deleted file mode 100644 index 52841e24..00000000 --- a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=1 -ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html -HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/src/event_report.cpp From 2fb80be248dd1dd64940e9a732c53a144969d8da Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 14:57:11 +0800 Subject: [PATCH 06/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I1646777947997f41703d9aece064fb7ec4421dd7 --- frameworks/kits/ability/native/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index 835451b7..b1a3baa0 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -220,8 +220,8 @@ ohos_shared_library("abilitykit_native") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_innerkits", - "hitrace_native:hitrace_meter", "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", "ipc_js:rpc", "native_appdatamgr:native_appdatafwk", From 608f07884d39c2842dc800642a0edd50da1438e9 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 15:36:24 +0800 Subject: [PATCH 07/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Iaf696a3a26c8d3b5b724e3d6a2e631649417ef2f --- frameworks/kits/ability/native/test/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/kits/ability/native/test/BUILD.gn b/frameworks/kits/ability/native/test/BUILD.gn index 95b430ba..fe53e368 100644 --- a/frameworks/kits/ability/native/test/BUILD.gn +++ b/frameworks/kits/ability/native/test/BUILD.gn @@ -303,6 +303,7 @@ ohos_unittest("page_ability_impl_test") { external_deps = [ "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "input:libmmi-client", "ipc:ipc_core", ] @@ -336,6 +337,7 @@ ohos_unittest("service_ability_impl_test") { external_deps = [ "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] From de9988a5e156439601fb4212730c2fa67b90dfaa Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 15:43:01 +0800 Subject: [PATCH 08/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I03480732f7e2a9294c03e9b0f5cc277bf167a05d --- .../abilitymgr/src/ability_manager_client.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index cfad6d42..93afe93d 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -216,15 +216,13 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - // int32_t ret = ERR_OK; - // auto abilityRecord = Token::GetAbilityRecordByToken(callerToken); - // auto abilityInfo = abilityRecord->GetAbilityInfo(); - // const std::string abilityName = abilityInfo.name.c_str(); - // AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); - // ret = abms->TerminateAbilityByCaller(callerToken, requestCode); - // if (ret != ERR_OK) { - // AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); - // } + int32_t ret = ERR_OK; + const std::string abilityName = "terminate ability"; + AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + ret = abms->TerminateAbilityByCaller(callerToken, requestCode); + if (ret != ERR_OK) { + AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + } return abms->TerminateAbilityByCaller(callerToken, requestCode); } From 8b938160dbb594e851ea868ad1feeb83ad06a1d0 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 16:04:48 +0800 Subject: [PATCH 09/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I4d10afc309b6e6b13ee08f38819bef2d550adaae --- .../test/unittest/ams_app_death_recipient_test/BUILD.gn | 1 + .../appmgr/test/unittest/ams_app_workflow_test/BUILD.gn | 3 +++ .../test/unittest/ams_recent_app_list_test/BUILD.gn | 3 +++ .../unittest/ams_service_app_spawn_client_test/BUILD.gn | 2 ++ .../test/unittest/ams_service_event_drive_test/BUILD.gn | 1 + .../ams_service_load_ability_process_test/BUILD.gn | 1 + .../test/unittest/ams_service_startup_test/BUILD.gn | 1 + .../unittest/app_mgr_service_event_handler_test/BUILD.gn | 1 + .../unittest/app_running_processes_info_test/BUILD.gn | 2 ++ .../moduletest/common/ams/app_life_cycle_test/BUILD.gn | 1 + .../moduletest/common/ams/app_mgr_service_test/BUILD.gn | 1 + .../moduletest/common/ams/app_recent_list_test/BUILD.gn | 5 +++++ .../ams/app_running_processes_info_module_test/BUILD.gn | 9 ++++++++- .../moduletest/common/ams/app_service_flow_test/BUILD.gn | 5 +++++ .../test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn | 1 + .../common/ams/service_app_spawn_client_test/BUILD.gn | 1 + .../common/ams/service_event_drive_test/BUILD.gn | 1 + .../common/ams/service_start_process_test/BUILD.gn | 1 + 18 files changed, 39 insertions(+), 1 deletion(-) diff --git a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn index db1f967c..9f147c8a 100644 --- a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn @@ -59,6 +59,7 @@ ohos_unittest("AppDeathRecipientTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", diff --git a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn index 456f9528..c1ec26f0 100644 --- a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn @@ -46,6 +46,8 @@ ohos_unittest("AmsWorkFlowTest") { sources += [ "ams_workflow_test.cpp" ] + configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] + deps = [ "${aafwk_path}/interfaces/innerkits/app_manager:app_manager", "${appexecfwk_inner_api_path}/appexecfwk_base:appexecfwk_base", @@ -55,6 +57,7 @@ ohos_unittest("AmsWorkFlowTest") { "${base_path}:want", "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn index 2ab630ef..8941ada6 100644 --- a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn @@ -43,6 +43,8 @@ ohos_unittest("AmsRecentAppListTest") { ] sources += [ "ams_recent_app_list_test.cpp" ] + + configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -56,6 +58,7 @@ ohos_unittest("AmsRecentAppListTest") { "${base_path}:want", "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn index 31d38eda..ab04b9c9 100644 --- a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn @@ -44,6 +44,8 @@ ohos_unittest("AmsServiceAppSpawnClientTest") { ] sources += [ "ams_service_app_spawn_client_test.cpp" ] + + configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn index b2791a47..2d978405 100644 --- a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("AmsServiceEventDriveTest") { sources += [ "ams_service_event_drive_test.cpp" ] + configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 809d0a66..9622eb78 100644 --- a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("AmsServiceLoadAbilityProcessTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn index 27a6cc72..651c1a0f 100644 --- a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn @@ -44,6 +44,7 @@ ohos_unittest("AmsServiceStartupTest") { sources += [ "ams_service_startup_test.cpp" ] configs = [ "${appexecfwk_path}/libs/libeventhandler:libeventhandler_config" ] + configs += [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn index 2350af30..1689c77c 100644 --- a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn +++ b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("AMSEventHandlerTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", diff --git a/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn b/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn index 0454cc86..151ddf97 100644 --- a/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn +++ b/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn @@ -42,6 +42,8 @@ ohos_unittest("AppRunningProcessesInfoTest") { sources += [ "app_running_processes_info_test.cpp" ] + configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] + cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn b/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn index 804b343f..1ec69ca1 100644 --- a/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn @@ -27,6 +27,7 @@ ohos_moduletest("AmsAppLifeCycleModuleTest") { deps = [ "${aafwk_path}/frameworks/kits/ability/native:abilitykit_native", + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn b/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn index 7687c668..b0bff1d4 100644 --- a/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn @@ -28,6 +28,7 @@ ohos_moduletest("AmsAppMgrServiceModuleTest") { ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn b/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn index aa31b6e8..b7f95a7f 100644 --- a/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn @@ -25,10 +25,15 @@ ohos_moduletest("AmsAppRecentListModuleTest") { sources = [ "ams_app_recent_list_module_test.cpp" ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] + if (ability_runtime_graphics) { + deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] + } + external_deps = [ "hicollie_native:libhicollie", "ipc:ipc_core", diff --git a/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn b/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn index fed7f850..e1b7f459 100644 --- a/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn @@ -25,7 +25,14 @@ ohos_moduletest("AppRunningProcessesInfoModuleTest") { ] sources = [ "app_running_processes_info_module_test.cpp" ] - deps = [ "${services_path}/test/moduletest/common/ams:appmgr_mst_source" ] + deps = [ + "${services_path}/appmgr:libappms", + "${services_path}/test/moduletest/common/ams:appmgr_mst_source", + ] + + if (ability_runtime_graphics) { + deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] + } external_deps = [ "ipc:ipc_core" ] } diff --git a/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn b/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn index 445b6132..d401d74c 100644 --- a/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn @@ -24,10 +24,15 @@ ohos_moduletest("AmsAppServiceFlowModuleTest") { sources = [ "ams_app_service_flow_module_test.cpp" ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] + if (ability_runtime_graphics) { + deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] + } + external_deps = [ "hicollie_native:libhicollie", "ipc:ipc_core", diff --git a/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn b/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn index 24f8ae5e..ccfa049a 100644 --- a/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn +++ b/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn @@ -30,6 +30,7 @@ ohos_moduletest("AmsIpcAmsmgrModuleTest") { sources = [ "ams_ipc_ams_mgr_module_test.cpp" ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", diff --git a/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn b/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn index 3ff24581..2c99ca76 100644 --- a/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn @@ -29,6 +29,7 @@ ohos_moduletest("AmsServiceAppSpawnClientModuleTest") { ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn b/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn index a7993776..a40421e4 100644 --- a/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn @@ -30,6 +30,7 @@ ohos_moduletest("AmsServiceEventDriveModuleTest") { ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn b/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn index bfa02be0..384606e1 100644 --- a/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn @@ -27,6 +27,7 @@ ohos_moduletest("AmsServiceStartModuleTest") { ] deps = [ + "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] From 80c7c4ee9daa1922c5440330efc0bbfecc288096 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 16:24:48 +0800 Subject: [PATCH 10/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id48c3fdf38d08dcbb0648a4e7f1c1e5750f4b2a0 --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index a41aa4a7..37f4bece 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("ability_manager_client_test") { "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } From 7831b71dd321414b481e5f7b9b8179c52f21f186 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 17:45:45 +0800 Subject: [PATCH 11/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I62fc4f6909c689fb5f0a9584cbe2a303d5e052a9 --- .../ability/ability_runtime/src/ability_context_impl.cpp | 3 ++- frameworks/kits/ability/native/src/ability.cpp | 1 + frameworks/kits/ability/native/src/ability_context.cpp | 1 + .../kits/ability/native/src/ability_runtime/js_ability.cpp | 2 ++ .../native/src/ability_runtime/js_ability_context.cpp | 2 ++ frameworks/kits/ability/native/src/ability_thread.cpp | 1 + frameworks/kits/ability/native/src/extension.cpp | 4 ++++ interfaces/kits/napi/aafwk/featureAbility/BUILD.gn | 1 + .../kits/napi/aafwk/featureAbility/feature_ability.cpp | 3 +++ services/abilitymgr/include/ability_util.h | 2 ++ services/abilitymgr/src/ability_manager_client.cpp | 5 +++++ services/abilitymgr/src/ability_manager_service.cpp | 1 + services/abilitymgr/src/ability_record.cpp | 5 +++++ services/abilitymgr/src/app_scheduler.cpp | 1 + services/abilitymgr/src/mission_list_manager.cpp | 3 +++ 15 files changed, 34 insertions(+), 1 deletion(-) diff --git a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp index 024b7e63..2682f24d 100644 --- a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp @@ -23,7 +23,6 @@ #include "connection_manager.h" #include "hilog_wrapper.h" #include "permission_list_state.h" -#include "hitrace_meter.h" using OHOS::Security::AccessToken::AccessTokenKit; using OHOS::Security::AccessToken::PermissionListState; @@ -243,6 +242,7 @@ bool AbilityContextImpl::ConnectAbilityWithAccount(const AAFwk::Want &want, int void AbilityContextImpl::DisconnectAbility(const AAFwk::Want &want, const sptr &connectCallback) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Disconnect ability begin, caller:%{public}s.", abilityInfo_ == nullptr ? "" : abilityInfo_->name.c_str()); ErrCode ret = @@ -329,6 +329,7 @@ ErrCode AbilityContextImpl::TerminateSelf() ErrCode AbilityContextImpl::CloseAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("%{public}s begin.", __func__); AAFwk::Want resultWant; ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->CloseAbility(token_, -1, &resultWant); diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index 0725e0b8..52fec11c 100644 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -1626,6 +1626,7 @@ ErrCode Ability::StartAbility(const Want &want) */ ErrCode Ability::TerminateAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("%{public}s begin.", __func__); return AbilityContext::TerminateAbility(); } diff --git a/frameworks/kits/ability/native/src/ability_context.cpp b/frameworks/kits/ability/native/src/ability_context.cpp index 58489818..e1a6141e 100644 --- a/frameworks/kits/ability/native/src/ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_context.cpp @@ -196,6 +196,7 @@ bool AbilityContext::ConnectAbility(const Want &want, const sptr &conn) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::shared_ptr info = GetAbilityInfo(); HILOG_INFO("Disconnect ability begin, caller:%{public}s.", info == nullptr ? "" : info->name.c_str()); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 226f41c4..b41c3a02 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -179,6 +179,7 @@ void JsAbility::OnStart(const Want &want) void JsAbility::OnStop() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); Ability::OnStop(); CallObjectMethod("onDestroy"); @@ -314,6 +315,7 @@ void JsAbility::OnForeground(const Want &want) void JsAbility::OnBackground() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); Ability::OnBackground(); CallObjectMethod("onBackground"); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp index 0300dd38..18d9cf87 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp @@ -119,6 +119,7 @@ NativeValue* JsAbilityContext::ConnectAbilityWithAccount(NativeEngine* engine, N NativeValue* JsAbilityContext::DisconnectAbility(NativeEngine* engine, NativeCallbackInfo* info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); JsAbilityContext* me = CheckParamsAndGetThis(engine, info); return (me != nullptr) ? me->OnDisconnectAbility(*engine, *info) : nullptr; } @@ -591,6 +592,7 @@ NativeValue* JsAbilityContext::OnTerminateSelfWithResult(NativeEngine& engine, N NativeValue* JsAbilityContext::OnConnectAbility(NativeEngine& engine, NativeCallbackInfo& info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Connect ability called."); // only support two params if (info.argc != ARGC_TWO) { diff --git a/frameworks/kits/ability/native/src/ability_thread.cpp b/frameworks/kits/ability/native/src/ability_thread.cpp index a2ad1a69..d29463a6 100644 --- a/frameworks/kits/ability/native/src/ability_thread.cpp +++ b/frameworks/kits/ability/native/src/ability_thread.cpp @@ -791,6 +791,7 @@ void AbilityThread::ScheduleConnectAbility(const Want &want) */ void AbilityThread::ScheduleDisconnectAbility(const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Schedule disconnect ability begin, isExtension:%{public}d.", isExtension_); wptr weak = this; auto task = [weak, want]() { diff --git a/frameworks/kits/ability/native/src/extension.cpp b/frameworks/kits/ability/native/src/extension.cpp index e4531ae8..359b895a 100644 --- a/frameworks/kits/ability/native/src/extension.cpp +++ b/frameworks/kits/ability/native/src/extension.cpp @@ -19,6 +19,7 @@ #include "configuration.h" #include "extension_context.h" #include "hilog_wrapper.h" +#include "hitrace_meter.h" namespace OHOS { namespace AbilityRuntime { @@ -40,6 +41,7 @@ void Extension::Init(const std::shared_ptr &reco void Extension::OnStart(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnStart begin, extension:%{public}s.", abilityInfo_->name.c_str()); SetLaunchWant(want); SetLastRequestWant(want); @@ -54,6 +56,7 @@ void Extension::OnStop() sptr Extension::OnConnect(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnConnect begin, extension:%{public}s.", abilityInfo_->name.c_str()); HILOG_INFO("OnConnect end, extension:%{public}s.", abilityInfo_->name.c_str()); return nullptr; @@ -61,6 +64,7 @@ sptr Extension::OnConnect(const AAFwk::Want &want) void Extension::OnDisconnect(const AAFwk::Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("OnDisconnect begin, extension:%{public}s.", abilityInfo_->name.c_str()); HILOG_INFO("OnDisconnect end, extension:%{public}s.", abilityInfo_->name.c_str()); } diff --git a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn index 34da59f7..ae0951a4 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn +++ b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn @@ -52,6 +52,7 @@ ohos_shared_library("featureability") { "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", "napi:ace_napi", "native_appdatamgr:native_appdatafwk", diff --git a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp index c0b4a4b7..c2644c8d 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/feature_ability.cpp @@ -25,6 +25,7 @@ #include "napi_context.h" #include "napi_data_ability_helper.h" #include "securec.h" +#include "hitrace_meter.h" using namespace OHOS::AAFwk; using namespace OHOS::AppExecFwk; @@ -1387,6 +1388,7 @@ napi_value NAPI_AcquireDataAbilityHelper(napi_env env, napi_callback_info info) */ napi_value NAPI_FAConnectAbility(napi_env env, napi_callback_info info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("FA connect ability called."); return NAPI_ConnectAbilityCommon(env, info, AbilityType::PAGE); } @@ -1401,6 +1403,7 @@ napi_value NAPI_FAConnectAbility(napi_env env, napi_callback_info info) */ napi_value NAPI_FADisConnectAbility(napi_env env, napi_callback_info info) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("FA disconnect ability called."); return NAPI_DisConnectAbilityCommon(env, info, AbilityType::PAGE); } diff --git a/services/abilitymgr/include/ability_util.h b/services/abilitymgr/include/ability_util.h index bbab8552..e448762c 100644 --- a/services/abilitymgr/include/ability_util.h +++ b/services/abilitymgr/include/ability_util.h @@ -26,6 +26,7 @@ #include "permission_verification.h" #include "sa_mgr_client.h" #include "system_ability_definition.h" +#include "hitrace_meter.h" namespace OHOS { namespace AAFwk { @@ -148,6 +149,7 @@ static sptr GetBundleManager() [[maybe_unused]] static int JudgeAbilityVisibleControl(const AppExecFwk::AbilityInfo &abilityInfo, int callerUid = -1) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Judge ability visible begin."); if (!abilityInfo.visible) { HILOG_INFO("Ability visible is false."); diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 93afe93d..b5cc5336 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -214,6 +214,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, ErrCode AbilityManagerClient::TerminateAbility(const sptr &callerToken, int requestCode) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; @@ -243,6 +244,7 @@ ErrCode AbilityManagerClient::CloseAbility(const sptr &token, int ErrCode AbilityManagerClient::MinimizeAbility(const sptr &token, bool fromUser) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Minimize ability, fromUser:%{public}d.", fromUser); @@ -251,6 +253,7 @@ ErrCode AbilityManagerClient::MinimizeAbility(const sptr &token, ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr &connect, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", @@ -268,6 +271,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr &connect, const sptr &callerToken, int32_t userId) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", @@ -284,6 +288,7 @@ ErrCode AbilityManagerClient::ConnectAbility( ErrCode AbilityManagerClient::DisconnectAbility(const sptr &connect) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 58005900..1734050f 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -864,6 +864,7 @@ int AbilityManagerService::TerminateAbilityByCaller(const sptr &c int AbilityManagerService::MinimizeAbility(const sptr &token, bool fromUser) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Minimize ability, fromUser:%{public}d.", fromUser); if (!VerificationAllToken(token)) { return ERR_INVALID_VALUE; diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index f6326153..f57e3371 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -245,6 +245,7 @@ void AbilityRecord::ProcessForegroundAbility(uint32_t sceneFlag) void AbilityRecord::BackgroundAbility(const Closure &task) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Move the ability to background, ability:%{public}s.", abilityInfo_.name.c_str()); if (lifecycleDeal_ == nullptr) { HILOG_ERROR("Move the ability to background fail, lifecycleDeal_ is null."); @@ -275,6 +276,7 @@ void AbilityRecord::BackgroundAbility(const Closure &task) int AbilityRecord::TerminateAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Schedule terminate ability to AppMs, ability:%{public}s.", abilityInfo_.name.c_str()); return DelayedSingleton::GetInstance()->TerminateAbility(token_); } @@ -450,6 +452,7 @@ void AbilityRecord::Activate() void AbilityRecord::Inactivate() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Inactivate ability start, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); @@ -463,6 +466,7 @@ void AbilityRecord::Inactivate() void AbilityRecord::Terminate(const Closure &task) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Begin to terminate ability, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); auto handler = DelayedSingleton::GetInstance()->GetEventHandler(); @@ -491,6 +495,7 @@ void AbilityRecord::ConnectAbility() void AbilityRecord::DisconnectAbility() { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("Disconnect ability, ability:%{public}s.", abilityInfo_.name.c_str()); CHECK_POINTER(lifecycleDeal_); lifecycleDeal_->DisconnectAbility(want_); diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index 294036b9..7fd6b614 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -76,6 +76,7 @@ bool AppScheduler::Init(const std::weak_ptr &callback) int AppScheduler::LoadAbility(const sptr &token, const sptr &preToken, const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Send load ability to AppMgrService."); CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR); /* because the errcode type of AppMgr Client API will be changed to int, diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index b8e89b88..b8f8edf5 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -775,6 +775,7 @@ std::shared_ptr MissionListManager::GetMissionById(int missionId) const int MissionListManager::AbilityTransactionDone(const sptr &token, int state, const PacMap &saveData) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); int targetState = AbilityRecord::ConvertLifeCycleToAbilityState(static_cast(state)); std::string abilityState = AbilityRecord::ConvertAbilityState(static_cast(targetState)); HILOG_INFO("AbilityTransactionDone, state: %{public}s.", abilityState.c_str()); @@ -960,6 +961,7 @@ void MissionListManager::CompleteBackground(const std::shared_ptr int MissionListManager::TerminateAbility(const std::shared_ptr &abilityRecord, int resultCode, const Want *resultWant, bool flag) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); std::string element = abilityRecord->GetWant().GetElement().GetURI(); HILOG_DEBUG("Terminate ability, ability is %{public}s.", element.c_str()); std::lock_guard guard(managerLock_); @@ -1324,6 +1326,7 @@ int MissionListManager::SetMissionLockedState(int missionId, bool lockedState) void MissionListManager::MoveToBackgroundTask(const std::shared_ptr &abilityRecord) { + HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); if (abilityRecord == nullptr) { HILOG_ERROR("Move the ability to background fail, ability record is null."); return; From 6dafcacb4608217250521745cb09c620e1177ce1 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Fri, 20 May 2022 18:36:24 +0800 Subject: [PATCH 12/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I4602e415d41deb083dd1d2e19ecd99b5cd70f91e --- .../unittest/phone/ability_connect_callback_proxy_test/BUILD.gn | 1 + .../unittest/phone/ability_connect_callback_stub_test/BUILD.gn | 1 + .../test/unittest/phone/ability_connect_manage_test/BUILD.gn | 1 + .../test/unittest/phone/ability_manager_proxy_test/BUILD.gn | 1 + .../phone/ability_manager_service_account_test/BUILD.gn | 1 + .../test/unittest/phone/ability_manager_stub_test/BUILD.gn | 1 + .../abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn | 1 + .../test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn | 1 + .../test/unittest/phone/ability_scheduler_stub_test/BUILD.gn | 1 + .../test/unittest/phone/ability_service_start_test/BUILD.gn | 1 + .../test/unittest/phone/ability_timeout_test/BUILD.gn | 1 + .../test/unittest/phone/ability_token_proxy_test/BUILD.gn | 1 + .../test/unittest/phone/ability_token_stub_test/BUILD.gn | 1 + .../abilitymgr/test/unittest/phone/call_container_test/BUILD.gn | 1 + .../abilitymgr/test/unittest/phone/configuration_test/BUILD.gn | 1 + .../test/unittest/phone/connection_record_test/BUILD.gn | 1 + .../test/unittest/phone/data_ability_record_test/BUILD.gn | 2 ++ .../abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn | 1 + services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn | 1 + .../test/unittest/phone/mission_list_manager_test/BUILD.gn | 1 + .../test/unittest/phone/pending_want_key_test/BUILD.gn | 1 + .../abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn | 1 + 22 files changed, 23 insertions(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn index 507eb5f8..c6a7bf3f 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("ability_connect_callback_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", "native_appdatamgr:native_appdatafwk", "native_appdatamgr:native_dataability", diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn index 21b322e9..e94ea769 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn @@ -60,6 +60,7 @@ ohos_unittest("ability_connect_callback_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", "native_appdatamgr:native_appdatafwk", "native_appdatamgr:native_dataability", diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn index 00a9f973..6aacf4e5 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn @@ -53,6 +53,7 @@ ohos_unittest("ability_connect_manage_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn index 48ffd2d1..1c3f01d2 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn @@ -61,6 +61,7 @@ ohos_unittest("ability_manager_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn index ed6794c1..a678051b 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn @@ -67,6 +67,7 @@ ohos_unittest("ability_manager_service_account_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn index 94595c58..6d8ca76a 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn @@ -60,6 +60,7 @@ ohos_unittest("ability_manager_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn index b5049fa7..65109392 100644 --- a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("ability_record_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] diff --git a/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn index 5533aa12..33b85f62 100644 --- a/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn @@ -60,6 +60,7 @@ ohos_unittest("ability_scheduler_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn index 2c573630..b5e3666a 100644 --- a/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_scheduler_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn index cdf4e25b..86c3c238 100644 --- a/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn @@ -60,6 +60,7 @@ ohos_unittest("ability_service_start_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn index 55e28511..4068d7a1 100644 --- a/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn @@ -62,6 +62,7 @@ ohos_unittest("ability_timeout_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn index 5e58f161..640e77fe 100644 --- a/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_token_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn index e966d0e5..aae43fdb 100644 --- a/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_token_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn index 49417843..9d926e11 100644 --- a/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn @@ -54,6 +54,7 @@ ohos_unittest("call_container_test") { "ability_base:zuri", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn index ec16f588..fb8a4d69 100644 --- a/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn @@ -62,6 +62,7 @@ ohos_unittest("configuration_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn index 158b533f..754b7571 100644 --- a/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("connection_record_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn index 1fb7cd8f..89f9d36a 100644 --- a/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn @@ -64,7 +64,9 @@ ohos_unittest("data_ability_record_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn index 767728da..00a91d20 100644 --- a/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn @@ -61,6 +61,7 @@ ohos_unittest("lifecycle_deal_test") { "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_core", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn index bcaedcac..4acc5ce8 100644 --- a/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn @@ -60,6 +60,7 @@ ohos_unittest("lifecycle_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn index a33425c7..3cf7c922 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("mission_list_manager_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn index 8044ceee..6811d46d 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn @@ -51,6 +51,7 @@ ohos_unittest("pending_want_key_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn index 769203dc..bca33341 100644 --- a/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn @@ -56,6 +56,7 @@ ohos_unittest("sender_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } From b2f5416c863f8ecf02cb2c44dc8e91431c686d5f Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sat, 21 May 2022 10:11:39 +0800 Subject: [PATCH 13/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I95d58a2cabcac0bb39c6efa6677daabf97f6e550 --- .../abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn | 2 ++ .../abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn | 1 + services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn | 1 + .../test/unittest/phone/pending_want_manager_test/BUILD.gn | 2 ++ .../test/unittest/phone/pending_want_record_test/BUILD.gn | 2 ++ .../abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn | 2 ++ .../test/unittest/phone/screenshot_handler_test/BUILD.gn | 2 ++ .../test/unittest/phone/specified_mission_list_test/BUILD.gn | 2 ++ .../test/unittest/phone/start_option_display_id_test/BUILD.gn | 2 ++ .../test/unittest/phone/want_receiver_proxy_test/BUILD.gn | 2 ++ .../test/unittest/phone/want_receiver_stub_test/BUILD.gn | 2 ++ .../test/unittest/phone/want_sender_info_test/BUILD.gn | 2 ++ .../test/unittest/phone/want_sender_proxy_test/BUILD.gn | 2 ++ .../test/unittest/phone/want_sender_stub_test/BUILD.gn | 2 ++ .../abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn | 2 ++ services/test/moduletest/call_module_test/BUILD.gn | 2 ++ services/test/moduletest/mission_dump_test/BUILD.gn | 1 + 17 files changed, 31 insertions(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn index 65109392..a40e1c06 100644 --- a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn @@ -111,6 +111,8 @@ ohos_unittest("ability_record_test_call") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn index e5f0ea9c..9d488c6d 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("mission_list_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn index 66cd4de9..e96c2631 100644 --- a/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("mission_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn index c6b2d68c..fe72ccdf 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("pending_want_manager_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn index 6ad3d60b..fc7893d1 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("pending_want_record_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn index 2268cf1f..d3167eb9 100644 --- a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn @@ -61,6 +61,8 @@ ohos_unittest("running_infos_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn index 9af85253..630273b5 100644 --- a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn @@ -63,6 +63,8 @@ ohos_unittest("ability_screenshot_handler_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn index d76e9dca..72bfd22c 100644 --- a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("specified_mission_list_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn index eece431e..6a9f56bf 100644 --- a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn @@ -63,6 +63,8 @@ ohos_unittest("start_option_display_id_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn index a8a4a4c6..0d9b5b3d 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("want_receiver_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn index 61c93748..9bb1c42a 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn @@ -58,6 +58,8 @@ ohos_unittest("want_receiver_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn index 9d1400bc..20d03e79 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn @@ -56,6 +56,8 @@ ohos_unittest("want_sender_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn index ff146383..7fc51c9c 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("want_sender_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn index 3dcf511a..a4cb3a8f 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn @@ -58,6 +58,8 @@ ohos_unittest("want_sender_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn index 73ccbfc6..f35b25b6 100644 --- a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn @@ -57,6 +57,8 @@ ohos_unittest("wants_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/test/moduletest/call_module_test/BUILD.gn b/services/test/moduletest/call_module_test/BUILD.gn index 2e6cb942..38dd1698 100644 --- a/services/test/moduletest/call_module_test/BUILD.gn +++ b/services/test/moduletest/call_module_test/BUILD.gn @@ -61,6 +61,8 @@ ohos_moduletest("call_ability_service_module_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hisysevent_native:libhisysevent", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 9b8a4237..d5acf26e 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -62,6 +62,7 @@ ohos_moduletest("mission_dump_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } From 8d4f5c607e540003e2fec7c05be1f05e9be371be Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 11:13:28 +0800 Subject: [PATCH 14/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Idbfd32fe531bf7f354e78a6d373763db8c2cf455 --- form_runtime/BUILD.gn | 1 - .../interfaces/kits/native/src/form_mgr.cpp | 10 +++++----- .../src/form_runtime/js_form_extension.cpp | 4 ++-- .../abilitymgr/src/ability_manager_client.cpp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/form_runtime/BUILD.gn b/form_runtime/BUILD.gn index 3a44db88..14aa08de 100644 --- a/form_runtime/BUILD.gn +++ b/form_runtime/BUILD.gn @@ -132,7 +132,6 @@ config("fmskit_public_config") { include_dirs = [ "interfaces/kits/native/include", "${aafwk_path}/services/common/include", - "${appexecfwk_path}/test/systemtest/common/fms/common/include", "${form_runtime_path}/interfaces/inner_api/include", "${appexecfwk_inner_api_path}/appexecfwk_base/include", "${base_inner_api_path}/want/include", diff --git a/form_runtime/interfaces/kits/native/src/form_mgr.cpp b/form_runtime/interfaces/kits/native/src/form_mgr.cpp index 5f17fd14..8589c06e 100644 --- a/form_runtime/interfaces/kits/native/src/form_mgr.cpp +++ b/form_runtime/interfaces/kits/native/src/form_mgr.cpp @@ -83,7 +83,7 @@ int FormMgr::AddForm( HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->AddForm(formId, want, callerToken, formInfo); } @@ -162,7 +162,7 @@ int FormMgr::RequestForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->RequestForm(formId, callerToken, want); } @@ -285,7 +285,7 @@ int FormMgr::MessageEvent(const int64_t formId, const Want &want, const sptrMessageEvent(formId, want, callerToken); } @@ -304,7 +304,7 @@ int FormMgr::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->RouterEvent(formId, want); } @@ -637,7 +637,7 @@ int FormMgr::AcquireFormState(const Want &want, const sptr &calle HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR); return remoteProxy_->AcquireFormState(want, callerToken, stateInfo); } diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp index e6a310d8..bbc0d33b 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp @@ -159,7 +159,7 @@ OHOS::AppExecFwk::FormProviderInfo JsFormExtension::OnCreate(const OHOS::AAFwk:: } formProviderInfo.SetFormData(formData); HILOG_INFO("%{public}s called end.", __func__); - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); return formProviderInfo; } @@ -368,7 +368,7 @@ FormState JsFormExtension::OnAcquireFormState(const Want &want) } else { return (AppExecFwk::FormState) state; } - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONACQUIREFORMSTATE, AAFWK::HiSysEventType::BEHAVIOR); } } // namespace AbilityRuntime diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index b5cc5336..dcc65595 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -119,7 +119,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->StartAbility(want, userId, requestCode); if (ret != ERR_OK) { @@ -137,7 +137,7 @@ ErrCode AbilityManagerClient::StartAbility( HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->StartAbility(want, callerToken, userId, requestCode); if (ret != ERR_OK) { @@ -153,7 +153,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); if (ret != ERR_OK) { @@ -171,7 +171,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); if (ret != ERR_OK) { @@ -188,7 +188,7 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr HILOG_INFO("%{public}s come, bundleName=%{public}s, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), want.GetElement().GetBundleName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, START_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); if (ret != ERR_OK) { @@ -259,7 +259,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); if (ret != ERR_OK) { @@ -277,7 +277,7 @@ ErrCode AbilityManagerClient::ConnectAbility( HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); ret = abms->ConnectAbility(want, connect, callerToken, userId); if (ret != ERR_OK) { @@ -373,7 +373,7 @@ ErrCode AbilityManagerClient::StopServiceAbility(const Want &want) { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - const std::string abilityName = want.GetElement().GetAbilityName().c_str(); + const std::string abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, STOP_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); return abms->StopServiceAbility(want); } From 5ef336f9679cdbda9ff08bcbafbcdad6d588d6be Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 13:59:40 +0800 Subject: [PATCH 15/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ic688c2d636cbe6cd6a2a3b0f4bd48930c5b159d2 --- .../native/src/ability_runtime/js_ability.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index b41c3a02..0d1089e3 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -173,7 +173,7 @@ void JsAbility::OnStart(const Want &want) delegator->PostPerformStart(CreateADelegatorAbilityProperty()); } HILOG_INFO("OnStart end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTART, AAFWK::HiSysEventType::BEHAVIOR); } @@ -200,7 +200,7 @@ void JsAbility::OnStop() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityDestroy(jsAbilityObj_); } - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR); } @@ -230,7 +230,7 @@ void JsAbility::OnSceneCreated() } HILOG_INFO("OnSceneCreated end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_CREATE, AAFWK::HiSysEventType::BEHAVIOR); } @@ -271,7 +271,7 @@ void JsAbility::onSceneDestroyed() applicationContext->DispatchOnAbilityWindowStageDestroy(jsAbilityObj_); } HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR); } @@ -309,7 +309,7 @@ void JsAbility::OnForeground(const Want &want) applicationContext->DispatchOnAbilityForeground(jsAbilityObj_); } HILOG_INFO("OnForeground end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONFOREGROUND, AAFWK::HiSysEventType::BEHAVIOR); } @@ -330,7 +330,7 @@ void JsAbility::OnBackground() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityBackground(jsAbilityObj_); } - const std::string abilityName = GetAbilityName().c_str(); + const std::string abilityName = GetAbilityName(); AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONBACKGROUND, AAFWK::HiSysEventType::BEHAVIOR); } #endif From ad87cf5106b8ed76a0144cc2e0a27d5432227bd6 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 19:25:03 +0800 Subject: [PATCH 16/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I6278f9f63d00f2c99dbbbb8c99d9bc30fe3be7d3 --- FORMAT_RESULT.gn | 0 form_runtime/hisysevent.yaml | 78 ++++++++ .../src/event_report.cpp:Zone.Identifier | 4 + hisysevent.yaml | 188 ++++++------------ services/abilitymgr/include/ability_util.h | 2 - .../BUILD.gn | 1 - .../BUILD.gn | 1 - .../ability_connect_manage_test/BUILD.gn | 1 - .../phone/ability_manager_proxy_test/BUILD.gn | 1 - .../BUILD.gn | 1 - .../phone/ability_manager_stub_test/BUILD.gn | 1 - .../phone/ability_record_test/BUILD.gn | 2 - .../ability_scheduler_proxy_test/BUILD.gn | 1 - .../ability_scheduler_stub_test/BUILD.gn | 1 - .../phone/ability_service_start_test/BUILD.gn | 1 - .../phone/ability_timeout_test/BUILD.gn | 1 - .../phone/ability_token_proxy_test/BUILD.gn | 1 - .../phone/ability_token_stub_test/BUILD.gn | 1 - .../phone/call_container_test/BUILD.gn | 1 - .../phone/configuration_test/BUILD.gn | 1 - .../phone/connection_record_test/BUILD.gn | 1 - .../phone/data_ability_record_test/BUILD.gn | 2 - .../phone/lifecycle_deal_test/BUILD.gn | 1 - .../unittest/phone/lifecycle_test/BUILD.gn | 1 - .../phone/mission_list_manager_test/BUILD.gn | 1 - .../unittest/phone/mission_list_test/BUILD.gn | 1 - .../test/unittest/phone/mission_test/BUILD.gn | 1 - .../phone/pending_want_key_test/BUILD.gn | 1 - .../phone/pending_want_manager_test/BUILD.gn | 1 - .../phone/pending_want_record_test/BUILD.gn | 1 - .../phone/running_infos_test/BUILD.gn | 1 - .../phone/screenshot_handler_test/BUILD.gn | 1 - .../unittest/phone/sender_info_test/BUILD.gn | 1 - .../specified_mission_list_test/BUILD.gn | 1 - .../start_option_display_id_test/BUILD.gn | 1 - .../phone/want_receiver_proxy_test/BUILD.gn | 1 - .../phone/want_receiver_stub_test/BUILD.gn | 1 - .../phone/want_sender_info_test/BUILD.gn | 1 - .../phone/want_sender_proxy_test/BUILD.gn | 1 - .../phone/want_sender_stub_test/BUILD.gn | 1 - .../unittest/phone/wants_info_test/BUILD.gn | 1 - services/appmgr/include/event_report.h | 2 +- services/appmgr/src/event_report.cpp | 2 +- services/common/include/event_report.h | 2 +- services/common/src/event_report.cpp | 2 +- .../test/moduletest/call_module_test/BUILD.gn | 1 - services/test/moduletest/common/ams/BUILD.gn | 1 + .../common/ams/app_life_cycle_test/BUILD.gn | 1 - .../common/ams/app_mgr_service_test/BUILD.gn | 1 - .../common/ams/app_recent_list_test/BUILD.gn | 5 - .../BUILD.gn | 9 +- .../common/ams/app_service_flow_test/BUILD.gn | 5 - .../common/ams/ipc_ams_mgr_test/BUILD.gn | 1 - .../service_app_spawn_client_test/BUILD.gn | 1 - .../ams/service_event_drive_test/BUILD.gn | 1 - .../ams/service_start_process_test/BUILD.gn | 1 - .../moduletest/mission_dump_test/BUILD.gn | 1 - 57 files changed, 150 insertions(+), 196 deletions(-) create mode 100644 FORMAT_RESULT.gn create mode 100644 form_runtime/hisysevent.yaml create mode 100644 frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier diff --git a/FORMAT_RESULT.gn b/FORMAT_RESULT.gn new file mode 100644 index 00000000..e69de29b diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml new file mode 100644 index 00000000..c91909a7 --- /dev/null +++ b/form_runtime/hisysevent.yaml @@ -0,0 +1,78 @@ +# Copyright (c) 2021-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. + +domain: ABILITY + +ADD_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +REQUEST_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +DELETE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +CASTTEMP_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +ACQUIREFORMSTATE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +MESSAGE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +ROUTE_EVENT_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +RELEASE_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +DELETE_INVALID_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +SET_NEXT_REFRESH_TIME_FORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONCREATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONDESTROY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONUPDATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_EVENT: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONCASTTEMPFORM: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} + +FORM_ONACQUIREFORMSTATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + ABILITY_NAME: {type: STRING, desc: ability name} \ No newline at end of file diff --git a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier new file mode 100644 index 00000000..52841e24 --- /dev/null +++ b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier @@ -0,0 +1,4 @@ +[ZoneTransfer] +ZoneId=1 +ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html +HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/src/event_report.cpp diff --git a/hisysevent.yaml b/hisysevent.yaml index 2d2be800..5af1bb3f 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -domain: AAFWK +domain: ABILITY LIFECYCLE_TIMEOUT: __BASE: {type: FAULT, level: CRITICAL, tag: STABILITY, desc: application freeze} @@ -47,171 +47,107 @@ THREAD_BLOCK_6S: MSG: {type: STRING, desc: application event message} START_ABILITY_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for ability} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start ability error} ABILITY_NAME: {type: STRING, desc: ability name} TERMINATE_ABILITY_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -START_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -DO_FOREGROUND_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -DO_BACKGROUND_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -TERMINATE_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONSTART: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONSTOP: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONFOREGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONBACKGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_WINDOWSTAGE_CREATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_WINDOWSTAGE_DESTORY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: callback for ability} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: terminate ability error} ABILITY_NAME: {type: STRING, desc: ability name} START_EXTENSION_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for extensionAbility} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start extensionAbility error} ABILITY_NAME: {type: STRING, desc: ability name} STOP_EXTENSION_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for extensionAbility} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: stop extensionAbility error} ABILITY_NAME: {type: STRING, desc: ability name} CONNECT_SERVICE_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for serviceExtensionAbility} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: connnect serviceExtensionAbility error} ABILITY_NAME: {type: STRING, desc: ability name} DISCONNECT_SERVICE_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: entrance error for serviceExtensionAbility} + __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility error} + ABILITY_NAME: {type: STRING, desc: ability name} + +START_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +DO_FOREGROUND_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: foreground ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +DO_BACKGROUND_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: background ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +TERMINATE_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: terminate ability} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONSTART: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onstart} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONSTOP: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onstop} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONFOREGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onforeground} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_ONBACKGROUND: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onbackground} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_WINDOWSTAGE_CREATE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle windowstage create} + ABILITY_NAME: {type: STRING, desc: ability name} + +ABILITY_WINDOWSTAGE_DESTORY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle windwostage destory} ABILITY_NAME: {type: STRING, desc: ability name} START_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start serviceExtensionAbility} ABILITY_NAME: {type: STRING, desc: ability name} STOP_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: stop serviceExtensionAbility} ABILITY_NAME: {type: STRING, desc: ability name} CONNECT_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: connect serviceExtensionAbility} ABILITY_NAME: {type: STRING, desc: ability name} DISCONNECT_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: entrance for serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility} ABILITY_NAME: {type: STRING, desc: ability name} SERVICE_EXTENSION_ONSTART: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onstart} ABILITY_NAME: {type: STRING, desc: ability name} SERVICE_EXTENSION_ONSTOP: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onstop} ABILITY_NAME: {type: STRING, desc: ability name} SERVICE_EXTENSION_ONCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onconnect} ABILITY_NAME: {type: STRING, desc: ability name} SERVICE_EXTENSION_ONDISCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle ondisconnect} ABILITY_NAME: {type: STRING, desc: ability name} SERVICE_EXTENSION_ONREQUEST: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle callback} - ABILITY_NAME: {type: STRING, desc: ability name} - -ADD_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -REQUEST_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -DELETE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -CASTTEMP_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -ACQUIREFORMSTATE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -MESSAGE_EVENT_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -ROUTE_EVENT_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -RELEASE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -DELETE_INVALID_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -SET_NEXT_REFRESH_TIME_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONCREATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONDESTROY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONUPDATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_EVENT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONCASTTEMPFORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONACQUIREFORMSTATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onrequest} ABILITY_NAME: {type: STRING, desc: ability name} APP_ATTACH: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: attach app} NAME: {type: STRING, desc: application name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} @@ -219,7 +155,7 @@ APP_ATTACH: TIME_STAMP: {type: INT32, desc: time stamp} APP_LAUNCH: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: launch app} NAME: {type: STRING, desc: application name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} @@ -227,7 +163,7 @@ APP_LAUNCH: TIME_STAMP: {type: INT32, desc: time stamp} APP_FOREGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: foreground app} NAME: {type: STRING, desc: application name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} @@ -235,7 +171,7 @@ APP_FOREGROUND: TIME_STAMP: {type: INT32, desc: time stamp} APP_BACKGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: background app} NAME: {type: STRING, desc: application name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} @@ -243,7 +179,7 @@ APP_BACKGROUND: TIME_STAMP: {type: INT32, desc: time stamp} APP_TERMINATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: application event} + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: terminate app} NAME: {type: STRING, desc: application name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} diff --git a/services/abilitymgr/include/ability_util.h b/services/abilitymgr/include/ability_util.h index e448762c..bbab8552 100644 --- a/services/abilitymgr/include/ability_util.h +++ b/services/abilitymgr/include/ability_util.h @@ -26,7 +26,6 @@ #include "permission_verification.h" #include "sa_mgr_client.h" #include "system_ability_definition.h" -#include "hitrace_meter.h" namespace OHOS { namespace AAFwk { @@ -149,7 +148,6 @@ static sptr GetBundleManager() [[maybe_unused]] static int JudgeAbilityVisibleControl(const AppExecFwk::AbilityInfo &abilityInfo, int callerUid = -1) { - HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Judge ability visible begin."); if (!abilityInfo.visible) { HILOG_INFO("Ability visible is false."); diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn index 68f5b7e6..a12b187a 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_callback_proxy_test/BUILD.gn @@ -59,7 +59,6 @@ ohos_unittest("ability_connect_callback_proxy_test") { "access_token:libaccesstoken_sdk", "dataability:native_dataability", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", "relational_store:native_appdatafwk", "relational_store:native_rdb", diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn index ca22ae0e..b8377a82 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_callback_stub_test/BUILD.gn @@ -61,7 +61,6 @@ ohos_unittest("ability_connect_callback_stub_test") { "access_token:libaccesstoken_sdk", "dataability:native_dataability", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", "relational_store:native_appdatafwk", "relational_store:native_rdb", diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn index 6aacf4e5..00a9f973 100644 --- a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn @@ -53,7 +53,6 @@ ohos_unittest("ability_connect_manage_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", - "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn index 1c3f01d2..48ffd2d1 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/BUILD.gn @@ -61,7 +61,6 @@ ohos_unittest("ability_manager_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn index a678051b..ed6794c1 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn @@ -67,7 +67,6 @@ ohos_unittest("ability_manager_service_account_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn index 6d8ca76a..94595c58 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("ability_manager_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn index a40e1c06..e7e660fe 100644 --- a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("ability_record_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] @@ -112,7 +111,6 @@ ohos_unittest("ability_record_test_call") { "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn index 33b85f62..5533aa12 100644 --- a/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_scheduler_proxy_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("ability_scheduler_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn index b5e3666a..2c573630 100644 --- a/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_scheduler_stub_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("ability_scheduler_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn index 86c3c238..cdf4e25b 100644 --- a/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_service_start_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("ability_service_start_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn index 4068d7a1..55e28511 100644 --- a/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_timeout_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_unittest("ability_timeout_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn index 640e77fe..5e58f161 100644 --- a/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_token_proxy_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("ability_token_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn index aae43fdb..e966d0e5 100644 --- a/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_token_stub_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("ability_token_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn index 9d926e11..49417843 100644 --- a/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/call_container_test/BUILD.gn @@ -54,7 +54,6 @@ ohos_unittest("call_container_test") { "ability_base:zuri", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn index fb8a4d69..ec16f588 100644 --- a/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/configuration_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_unittest("configuration_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn index 754b7571..158b533f 100644 --- a/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/connection_record_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("connection_record_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn index 89f9d36a..1fb7cd8f 100644 --- a/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/data_ability_record_test/BUILD.gn @@ -64,9 +64,7 @@ ohos_unittest("data_ability_record_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", - "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn index 00a91d20..767728da 100644 --- a/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/lifecycle_deal_test/BUILD.gn @@ -61,7 +61,6 @@ ohos_unittest("lifecycle_deal_test") { "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_core", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn index 4acc5ce8..bcaedcac 100644 --- a/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/lifecycle_test/BUILD.gn @@ -60,7 +60,6 @@ ohos_unittest("lifecycle_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn index 3cf7c922..a33425c7 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("mission_list_manager_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn index 9d488c6d..e5f0ea9c 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("mission_list_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn index e96c2631..66cd4de9 100644 --- a/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("mission_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn index 6811d46d..8044ceee 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_key_test/BUILD.gn @@ -51,7 +51,6 @@ ohos_unittest("pending_want_key_test") { "ability_base:want", "ability_base:zuri", "access_token:libaccesstoken_sdk", - "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn index fe72ccdf..67928d71 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("pending_want_manager_test") { "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn index fc7893d1..1c3865dd 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("pending_want_record_test") { "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn index d3167eb9..807daf0a 100644 --- a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_unittest("running_infos_test") { "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn index 630273b5..d66b011d 100644 --- a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn @@ -64,7 +64,6 @@ ohos_unittest("ability_screenshot_handler_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn index bca33341..769203dc 100644 --- a/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/sender_info_test/BUILD.gn @@ -56,7 +56,6 @@ ohos_unittest("sender_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn index 72bfd22c..b2167954 100644 --- a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("specified_mission_list_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn index 6a9f56bf..1259f03e 100644 --- a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn @@ -64,7 +64,6 @@ ohos_unittest("start_option_display_id_test") { "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn index 0d9b5b3d..f6d7edfd 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("want_receiver_proxy_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn index 9bb1c42a..d71081e5 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn @@ -59,7 +59,6 @@ ohos_unittest("want_receiver_stub_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn index 20d03e79..d044c229 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("want_sender_info_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn index 7fc51c9c..839fd8b1 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("want_sender_proxy_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn index a4cb3a8f..e5171138 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn @@ -59,7 +59,6 @@ ohos_unittest("want_sender_stub_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn index f35b25b6..558af202 100644 --- a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("wants_info_test") { "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/appmgr/include/event_report.h b/services/appmgr/include/event_report.h index 408148c2..5d4732c4 100644 --- a/services/appmgr/include/event_report.h +++ b/services/appmgr/include/event_report.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * 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 diff --git a/services/appmgr/src/event_report.cpp b/services/appmgr/src/event_report.cpp index d01c1be2..ae6d2867 100644 --- a/services/appmgr/src/event_report.cpp +++ b/services/appmgr/src/event_report.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * 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 diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 4266072b..ef6469d9 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * 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 diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index b95c2d27..e03abeac 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * 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 diff --git a/services/test/moduletest/call_module_test/BUILD.gn b/services/test/moduletest/call_module_test/BUILD.gn index 38dd1698..498cc78e 100644 --- a/services/test/moduletest/call_module_test/BUILD.gn +++ b/services/test/moduletest/call_module_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_moduletest("call_ability_service_module_test") { "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", "hisysevent_native:libhisysevent", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 10f80d8f..367959df 100644 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -40,6 +40,7 @@ ohos_source_set("appmgr_mst_source") { "${services_path}/appmgr/src/app_spawn_msg_wrapper.cpp", "${services_path}/appmgr/src/app_spawn_socket.cpp", "${services_path}/appmgr/src/app_state_observer_manager.cpp", + "${services_path}/appmgr/src/event_report.cpp", "${services_path}/appmgr/src/module_running_record.cpp", "${services_path}/appmgr/src/remote_client_manager.cpp", "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp", diff --git a/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn b/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn index 1ec69ca1..804b343f 100644 --- a/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_life_cycle_test/BUILD.gn @@ -27,7 +27,6 @@ ohos_moduletest("AmsAppLifeCycleModuleTest") { deps = [ "${aafwk_path}/frameworks/kits/ability/native:abilitykit_native", - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn b/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn index b0bff1d4..7687c668 100644 --- a/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_mgr_service_test/BUILD.gn @@ -28,7 +28,6 @@ ohos_moduletest("AmsAppMgrServiceModuleTest") { ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn b/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn index b7f95a7f..aa31b6e8 100644 --- a/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_recent_list_test/BUILD.gn @@ -25,15 +25,10 @@ ohos_moduletest("AmsAppRecentListModuleTest") { sources = [ "ams_app_recent_list_module_test.cpp" ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] - if (ability_runtime_graphics) { - deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] - } - external_deps = [ "hicollie_native:libhicollie", "ipc:ipc_core", diff --git a/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn b/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn index e1b7f459..fed7f850 100644 --- a/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_running_processes_info_module_test/BUILD.gn @@ -25,14 +25,7 @@ ohos_moduletest("AppRunningProcessesInfoModuleTest") { ] sources = [ "app_running_processes_info_module_test.cpp" ] - deps = [ - "${services_path}/appmgr:libappms", - "${services_path}/test/moduletest/common/ams:appmgr_mst_source", - ] - - if (ability_runtime_graphics) { - deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] - } + deps = [ "${services_path}/test/moduletest/common/ams:appmgr_mst_source" ] external_deps = [ "ipc:ipc_core" ] } diff --git a/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn b/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn index d401d74c..445b6132 100644 --- a/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_service_flow_test/BUILD.gn @@ -24,15 +24,10 @@ ohos_moduletest("AmsAppServiceFlowModuleTest") { sources = [ "ams_app_service_flow_module_test.cpp" ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] - if (ability_runtime_graphics) { - deps += [ "${global_path}/i18n/frameworks/intl:intl_util" ] - } - external_deps = [ "hicollie_native:libhicollie", "ipc:ipc_core", diff --git a/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn b/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn index ccfa049a..24f8ae5e 100644 --- a/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn +++ b/services/test/moduletest/common/ams/ipc_ams_mgr_test/BUILD.gn @@ -30,7 +30,6 @@ ohos_moduletest("AmsIpcAmsmgrModuleTest") { sources = [ "ams_ipc_ams_mgr_module_test.cpp" ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", diff --git a/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn b/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn index 2c99ca76..3ff24581 100644 --- a/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_app_spawn_client_test/BUILD.gn @@ -29,7 +29,6 @@ ohos_moduletest("AmsServiceAppSpawnClientModuleTest") { ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn b/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn index a40421e4..a7993776 100644 --- a/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_event_drive_test/BUILD.gn @@ -30,7 +30,6 @@ ohos_moduletest("AmsServiceEventDriveModuleTest") { ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn b/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn index 384606e1..bfa02be0 100644 --- a/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn +++ b/services/test/moduletest/common/ams/service_start_process_test/BUILD.gn @@ -27,7 +27,6 @@ ohos_moduletest("AmsServiceStartModuleTest") { ] deps = [ - "${services_path}/appmgr:libappms", "${services_path}/common:perm_verification", "${services_path}/test/moduletest/common/ams:appmgr_mst_source", ] diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index d5acf26e..9b8a4237 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -62,7 +62,6 @@ ohos_moduletest("mission_dump_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } From c67d7761db053556caf4f1d109ed1c62199b86a3 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 20:15:03 +0800 Subject: [PATCH 17/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I592e4e5fcdb6ec7b91e2f5885796e1c45b52bdf4 --- form_runtime/hisysevent.yaml | 2 +- hisysevent.yaml | 2 +- services/appmgr/include/event_report.h | 44 ------------ services/appmgr/src/event_report.cpp | 70 -------------------- services/common/include/event_report.h | 6 ++ services/common/src/event_report.cpp | 25 +++++++ services/test/moduletest/common/ams/BUILD.gn | 2 +- 7 files changed, 34 insertions(+), 117 deletions(-) delete mode 100644 services/appmgr/include/event_report.h delete mode 100644 services/appmgr/src/event_report.cpp diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml index c91909a7..3665ef5e 100644 --- a/form_runtime/hisysevent.yaml +++ b/form_runtime/hisysevent.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -domain: ABILITY +domain: AAFWK ADD_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} diff --git a/hisysevent.yaml b/hisysevent.yaml index 5af1bb3f..55945ca1 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -domain: ABILITY +domain: AAFWK LIFECYCLE_TIMEOUT: __BASE: {type: FAULT, level: CRITICAL, tag: STABILITY, desc: application freeze} diff --git a/services/appmgr/include/event_report.h b/services/appmgr/include/event_report.h deleted file mode 100644 index 5d4732c4..00000000 --- a/services/appmgr/include/event_report.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H -#define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H - -#include -#include - -#include "ability_info.h" -#include "application_info.h" -#include "want.h" - -namespace OHOS { -namespace AAFWK { -enum HiSysEventType { - FAULT = 1, - STATISTIC = 2, - SECURITY = 3, - BEHAVIOR = 4, -}; -class EventReport { -public: - static void AppEvent(const std::shared_ptr &applicationInfo, - const std::string &pid, const std::string &eventName, HiSysEventType type); - template - static void EventWrite(const std::string &eventName, - HiSysEventType type, Types... keyValues); -}; -} // namespace AAFWK -} // namespace OHOS -#endif // FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H diff --git a/services/appmgr/src/event_report.cpp b/services/appmgr/src/event_report.cpp deleted file mode 100644 index ae6d2867..00000000 --- a/services/appmgr/src/event_report.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "event_report.h" -#include "hisysevent.h" -#include "hilog_wrapper.h" - -#include - -namespace OHOS { -namespace AAFWK { -namespace { -const std::string EVENT_KEY_APP_NAME = "NAME"; -const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; -const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; -const std::string EVENT_KEY_PID = "PID"; -const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; -const std::string TYPE = "TYPE"; -} -void EventReport::AppEvent(const std::shared_ptr &applicationInfo, - const std::string &pid, const std::string &eventName, HiSysEventType type) -{ - std::string name = applicationInfo->name.c_str(); - std::string versionName = applicationInfo->versionName.c_str(); - uint32_t versionCode = applicationInfo->versionCode; - int32_t timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); - EventReport::EventWrite( - eventName, - type, - EVENT_KEY_APP_NAME, name, - EVENT_KEY_VERSION_NAME, versionName, - EVENT_KEY_VERSION_CODE, std::to_string(versionCode), - EVENT_KEY_PID, pid.c_str(), - EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); - HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," - "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", - name.c_str(), - versionName.c_str(), - versionCode, - pid.c_str(), - timeStamp); -} -template -void EventReport::EventWrite( - const std::string &eventName, - HiSysEventType type, - Types... keyValues) -{ - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - keyValues...); -} -} // namespace AAFWK -} // namespace OHOS \ No newline at end of file diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index ef6469d9..ab541e08 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -17,6 +17,10 @@ #define FOUNDATION_AAFWK_SERVICES_ABILITYMGR_INCLUDE_INNER_EVENT_REPORT_H #include +#include + +#include "application_info.h" +#include "want.h" namespace OHOS { namespace AAFWK { @@ -28,6 +32,8 @@ enum HiSysEventType { }; class EventReport { public: + static void AppEvent(const std::shared_ptr &applicationInfo, + const std::string &pid, const std::string &eventName, HiSysEventType type); static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, HiSysEventType type); template diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index e03abeac..f671493a 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -39,6 +39,31 @@ const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; const std::string EVENT_KEY_FORM_ID = "FORM_ID"; const std::string TYPE = "TYPE"; } +void EventReport::AppEvent(const std::shared_ptr &applicationInfo, + const std::string &pid, const std::string &eventName, HiSysEventType type) +{ + std::string name = applicationInfo->name.c_str(); + std::string versionName = applicationInfo->versionName.c_str(); + uint32_t versionCode = applicationInfo->versionCode; + int32_t timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_APP_NAME, name, + EVENT_KEY_VERSION_NAME, versionName, + EVENT_KEY_VERSION_CODE, std::to_string(versionCode), + EVENT_KEY_PID, pid.c_str(), + EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); + HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," + "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", + name.c_str(), + versionName.c_str(), + versionCode, + pid.c_str(), + timeStamp); +} void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, HiSysEventType type) { diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 367959df..7a819b35 100644 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -40,10 +40,10 @@ ohos_source_set("appmgr_mst_source") { "${services_path}/appmgr/src/app_spawn_msg_wrapper.cpp", "${services_path}/appmgr/src/app_spawn_socket.cpp", "${services_path}/appmgr/src/app_state_observer_manager.cpp", - "${services_path}/appmgr/src/event_report.cpp", "${services_path}/appmgr/src/module_running_record.cpp", "${services_path}/appmgr/src/remote_client_manager.cpp", "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp", + "${services_path}/common/src/event_report.cpp", ] defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] From 1e563f13e67fd60d9a5ec8901c44f939b3da3a3b Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 20:23:55 +0800 Subject: [PATCH 18/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ia6603499b5d892348a5126b24a7be2df1a4bb8b2 --- FORMAT_RESULT.gn | 0 .../kits/ability/native/src/event_report.cpp:Zone.Identifier | 4 ---- services/appmgr/BUILD.gn | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 FORMAT_RESULT.gn delete mode 100644 frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier diff --git a/FORMAT_RESULT.gn b/FORMAT_RESULT.gn deleted file mode 100644 index e69de29b..00000000 diff --git a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier b/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier deleted file mode 100644 index 52841e24..00000000 --- a/frameworks/kits/ability/native/src/event_report.cpp:Zone.Identifier +++ /dev/null @@ -1,4 +0,0 @@ -[ZoneTransfer] -ZoneId=1 -ReferrerUrl=vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html -HostUrl=file:///z%3A/home/zhoushicheng/text/foundation/aafwk/standard/services/common/src/event_report.cpp diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index e7fe3cf5..4ec3670c 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -30,6 +30,7 @@ group("appms_target") { ohos_shared_library("libappms") { sources = [ + "${services_path}/common/src/event_report.cpp", "src/ability_running_record.cpp", "src/ams_mgr_scheduler.cpp", "src/app_death_recipient.cpp", @@ -47,7 +48,6 @@ ohos_shared_library("libappms") { "src/module_running_record.cpp", "src/remote_client_manager.cpp", "src/system_environment_information.cpp", - "src/event_report.cpp", ] defines = [ From a52632d58db03f4bd6adac0690824af3f9432c8f Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 20:31:31 +0800 Subject: [PATCH 19/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id9738164a0b3c06f5cf9ef967743f83513a5bdca --- frameworks/kits/ability/native/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index 1368021e..79eb5b80 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -220,8 +220,8 @@ ohos_shared_library("abilitykit_native") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "common_event_service:cesfwk_innerkits", - "hisysevent_native:libhisysevent", "dataability:native_dataability", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "ipc:ipc_core", "ipc_js:rpc", From b7545ba6ef16e5f99ad08f42cd48d55300c6d5d8 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Sun, 22 May 2022 20:45:34 +0800 Subject: [PATCH 20/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I7dffd6aa2ce7d2a54e6ae8a85839a018c52a4895 --- services/common/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 648d4394..3a182fc0 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -52,6 +52,7 @@ ohos_shared_library("perm_verification") { ] external_deps = [ + "ability_base:want", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", "hisysevent_native:libhisysevent", From 024d5b8513c166104d7fb30650cbadf355cb436d Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Mon, 23 May 2022 08:53:11 +0800 Subject: [PATCH 21/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: If46283a824a242bc4262c088559d66ca26a8a30a --- frameworks/kits/ability/native/test/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/kits/ability/native/test/BUILD.gn b/frameworks/kits/ability/native/test/BUILD.gn index 9d487e5c..74bbc6fa 100644 --- a/frameworks/kits/ability/native/test/BUILD.gn +++ b/frameworks/kits/ability/native/test/BUILD.gn @@ -298,8 +298,8 @@ ohos_unittest("page_ability_impl_test") { ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", "input:libmmi-client", "ipc:ipc_core", ] @@ -331,8 +331,8 @@ ohos_unittest("service_ability_impl_test") { ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] From fdb67d430899f3c7fed23de339e887d6eb1f71a6 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Mon, 23 May 2022 09:38:29 +0800 Subject: [PATCH 22/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I770082c9c1c980414f3d805ab250f1e00a41aa5d --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 - .../abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn | 1 - .../test/unittest/phone/pending_want_manager_test/BUILD.gn | 1 - .../test/unittest/phone/pending_want_record_test/BUILD.gn | 1 - .../abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn | 1 - .../test/unittest/phone/screenshot_handler_test/BUILD.gn | 1 - .../test/unittest/phone/specified_mission_list_test/BUILD.gn | 1 - .../test/unittest/phone/start_option_display_id_test/BUILD.gn | 1 - .../test/unittest/phone/want_receiver_proxy_test/BUILD.gn | 1 - .../test/unittest/phone/want_receiver_stub_test/BUILD.gn | 1 - .../test/unittest/phone/want_sender_info_test/BUILD.gn | 1 - .../test/unittest/phone/want_sender_proxy_test/BUILD.gn | 1 - .../test/unittest/phone/want_sender_stub_test/BUILD.gn | 1 - services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn | 1 - 14 files changed, 14 deletions(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index 37f4bece..a41aa4a7 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("ability_manager_client_test") { "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn index e7e660fe..b5049fa7 100644 --- a/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_record_test/BUILD.gn @@ -110,7 +110,6 @@ ohos_unittest("ability_record_test_call") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn index 67928d71..c6b2d68c 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("pending_want_manager_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn index 1c3865dd..6ad3d60b 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/pending_want_record_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("pending_want_record_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn index 807daf0a..2268cf1f 100644 --- a/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/running_infos_test/BUILD.gn @@ -61,7 +61,6 @@ ohos_unittest("running_infos_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn index d66b011d..9af85253 100644 --- a/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/screenshot_handler_test/BUILD.gn @@ -63,7 +63,6 @@ ohos_unittest("ability_screenshot_handler_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn index b2167954..d76e9dca 100644 --- a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("specified_mission_list_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn index 1259f03e..eece431e 100644 --- a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn @@ -63,7 +63,6 @@ ohos_unittest("start_option_display_id_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn index f6d7edfd..a8a4a4c6 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_proxy_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("want_receiver_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn index d71081e5..61c93748 100644 --- a/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_receiver_stub_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("want_receiver_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn index d044c229..9d1400bc 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_info_test/BUILD.gn @@ -56,7 +56,6 @@ ohos_unittest("want_sender_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn index 839fd8b1..ff146383 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_proxy_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("want_sender_proxy_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn index e5171138..3dcf511a 100644 --- a/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/want_sender_stub_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("want_sender_stub_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } diff --git a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn index 558af202..73ccbfc6 100644 --- a/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/wants_info_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("wants_info_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } From 7d8b1ee3c372b973036887085206e0cdd3b4e8fa Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Mon, 23 May 2022 09:57:16 +0800 Subject: [PATCH 23/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ieb59a55496d6d57b0350fc9fae521b6db54a02a8 --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index a41aa4a7..37f4bece 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -58,6 +58,7 @@ ohos_unittest("ability_manager_client_test") { "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", + "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } From b6648268c2542b050328f31cf4a910ad1de90ae9 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Mon, 23 May 2022 18:54:11 +0800 Subject: [PATCH 24/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I1ab978ab4ad986ed0d034bf146b641e1be67bcd6 --- form_runtime/hisysevent.yaml | 2 +- .../interfaces/kits/native/src/form_mgr.cpp | 62 ++++---- .../native/src/ability_runtime/js_ability.cpp | 38 +++-- .../src/form_runtime/js_form_extension.cpp | 39 +++-- .../native/src/js_service_extension.cpp | 30 ++-- .../abilitymgr/src/ability_manager_client.cpp | 101 ++++++------- services/appmgr/src/app_mgr_service_inner.cpp | 81 +++++----- services/common/include/event_report.h | 140 +++++++++++++++++- services/common/src/event_report.cpp | 65 ++++---- 9 files changed, 347 insertions(+), 211 deletions(-) diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml index 3665ef5e..b3c1aa0c 100644 --- a/form_runtime/hisysevent.yaml +++ b/form_runtime/hisysevent.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# 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 diff --git a/form_runtime/interfaces/kits/native/src/form_mgr.cpp b/form_runtime/interfaces/kits/native/src/form_mgr.cpp index 8589c06e..b659be85 100644 --- a/form_runtime/interfaces/kits/native/src/form_mgr.cpp +++ b/form_runtime/interfaces/kits/native/src/form_mgr.cpp @@ -30,18 +30,6 @@ namespace OHOS { namespace AppExecFwk { -namespace { -const std::string ADD_FORM = "ADD_FORM"; -const std::string REQUEST_FORM = "REQUEST_FORM"; -const std::string DELETE_FORM = "DELETE_FORM"; -const std::string CASTTEMP_FORM = "CASTTEMP_FORM"; -const std::string ACQUIREFORMSTATE_FORM = "ACQUIREFORMSTATE_FORM"; -const std::string MESSAGE_EVENT_FORM = "MESSAGE_EVENT_FORM"; -const std::string ROUTE_EVENT_FORM = "ROUTE_EVENT_FORM"; -const std::string RELEASE_FORM = "RELEASE_FORM"; -const std::string DELETE_INVALID_FORM = "DELETE_INVALID_FORM"; -const std::string SET_NEXT_REFRESH_TIME_FORM = "SET_NEXT_REFRESH_TIME_FORM"; -} FormMgr::FormMgr(){} FormMgr::~FormMgr() { @@ -83,8 +71,9 @@ int FormMgr::AddForm( HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->AddForm(formId, want, callerToken, formInfo); } @@ -102,8 +91,9 @@ int FormMgr::DeleteForm(const int64_t formId, const sptr &callerT HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = "delete form"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->DeleteForm(formId, callerToken); } @@ -122,8 +112,9 @@ int FormMgr::ReleaseForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = "release form"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->ReleaseForm(formId, callerToken, delCache); } @@ -162,8 +153,9 @@ int FormMgr::RequestForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->RequestForm(formId, callerToken, want); } @@ -202,8 +194,9 @@ int FormMgr::CastTempForm(const int64_t formId, const sptr &calle HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = "cast temp form"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->CastTempForm(formId, callerToken); } @@ -285,8 +278,9 @@ int FormMgr::MessageEvent(const int64_t formId, const Want &want, const sptrMessageEvent(formId, want, callerToken); } @@ -304,8 +298,9 @@ int FormMgr::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->RouterEvent(formId, want); } @@ -323,8 +318,9 @@ int FormMgr::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = "set next refresh form"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->SetNextRefreshTime(formId, nextTime); } @@ -617,8 +613,9 @@ int FormMgr::DeleteInvalidForms(const std::vector &formIds, const sptr< HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = "delete invalid forms"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = 0; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -637,8 +634,9 @@ int FormMgr::AcquireFormState(const Want &want, const sptr &calle HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = 0; + AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->AcquireFormState(want, callerToken, stateInfo); } diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 0d1089e3..b3db29c6 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -39,14 +39,6 @@ namespace OHOS { namespace AbilityRuntime { -namespace { -const std::string ABILITY_ONSTART = "ABILITY_ONSTART"; -const std::string ABILITY_ONSTOP = "ABILITY_ONSTOP"; -const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND"; -const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND"; -const std::string ABILITY_WINDOWSTAGE_CREATE = "ABILITY_WINDOWSTAGE_CREATE"; -const std::string ABILITY_WINDOWSTAGE_DESTORY = "ABILITY_WINDOWSTAGE_DESTORY"; -} #ifdef SUPPORT_GRAPHICS const std::string PAGE_STACK_PROPERTY_NAME = "pageStack"; #endif @@ -173,8 +165,9 @@ void JsAbility::OnStart(const Want &want) delegator->PostPerformStart(CreateADelegatorAbilityProperty()); } HILOG_INFO("OnStart end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTART, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnStop() @@ -200,8 +193,9 @@ void JsAbility::OnStop() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityDestroy(jsAbilityObj_); } - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } #ifdef SUPPORT_GRAPHICS @@ -230,8 +224,9 @@ void JsAbility::OnSceneCreated() } HILOG_INFO("OnSceneCreated end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_CREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_CREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnSceneRestored() @@ -271,8 +266,9 @@ void JsAbility::onSceneDestroyed() applicationContext->DispatchOnAbilityWindowStageDestroy(jsAbilityObj_); } HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnForeground(const Want &want) @@ -309,8 +305,9 @@ void JsAbility::OnForeground(const Want &want) applicationContext->DispatchOnAbilityForeground(jsAbilityObj_); } HILOG_INFO("OnForeground end, ability is %{public}s.", GetAbilityName().c_str()); - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONFOREGROUND, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONFOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnBackground() @@ -330,8 +327,9 @@ void JsAbility::OnBackground() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityBackground(jsAbilityObj_); } - const std::string abilityName = GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, ABILITY_ONBACKGROUND, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONBACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } #endif diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp index bbc0d33b..dda8b9c5 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp @@ -33,14 +33,6 @@ namespace OHOS { namespace AbilityRuntime { -namespace { -const std::string FORM_LIFECYCLE_ONCREATE = "FORM_LIFECYCLE_ONCREATE"; -const std::string FORM_LIFECYCLE_ONDESTROY = "FORM_LIFECYCLE_ONDESTROY"; -const std::string FORM_LIFECYCLE_ONUPDATE = "FORM_LIFECYCLE_ONUPDATE"; -const std::string FORM_LIFECYCLE_EVENT = "FORM_LIFECYCLE_EVENT"; -const std::string FORM_LIFECYCLE_ONCASTTEMPFORM = "FORM_LIFECYCLE_ONCASTTEMPFORM"; -const std::string FORM_LIFECYCLE_ONACQUIREFORMSTATE = "FORM_LIFECYCLE_ONACQUIREFORMSTATE"; -} using namespace OHOS::AppExecFwk; const int ON_EVENT_PARAMS_SIZE = 2; @@ -159,8 +151,9 @@ OHOS::AppExecFwk::FormProviderInfo JsFormExtension::OnCreate(const OHOS::AAFwk:: } formProviderInfo.SetFormData(formData); HILOG_INFO("%{public}s called end.", __func__); - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = 0; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return formProviderInfo; } @@ -178,8 +171,9 @@ void JsFormExtension::OnDestroy(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onDestroy", argv, 1); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) @@ -200,8 +194,9 @@ void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) NativeValue* nativeMessage = reinterpret_cast(napiMessage); NativeValue* argv[] = {nativeFormId, nativeMessage}; CallObjectMethod("onEvent", argv, ON_EVENT_PARAMS_SIZE); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnUpdate(const int64_t formId) @@ -218,8 +213,9 @@ void JsFormExtension::OnUpdate(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onUpdate", argv, 1); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnCastToNormal(const int64_t formId) @@ -236,8 +232,9 @@ void JsFormExtension::OnCastToNormal(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onCastToNormal", argv, 1); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnVisibilityChange(const std::map& formEventsMap) @@ -368,8 +365,10 @@ FormState JsFormExtension::OnAcquireFormState(const Want &want) } else { return (AppExecFwk::FormState) state; } - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, FORM_LIFECYCLE_ONACQUIREFORMSTATE, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.formId = 0; + AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONACQUIREFORMSTATE, + AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } } // namespace AbilityRuntime } // namespace OHOS diff --git a/frameworks/kits/ability/native/src/js_service_extension.cpp b/frameworks/kits/ability/native/src/js_service_extension.cpp index e8132610..430a9b8d 100644 --- a/frameworks/kits/ability/native/src/js_service_extension.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension.cpp @@ -34,11 +34,6 @@ namespace AbilityRuntime { namespace { constexpr size_t ARGC_ONE = 1; constexpr size_t ARGC_TWO = 2; -const std::string SERVICE_EXTENSION_ONSTART = "SERVICE_EXTENSION_ONSTART"; -const std::string SERVICE_EXTENSION_ONSTOP = "SERVICE_EXTENSION_ONSTOP"; -const std::string SERVICE_EXTENSION_ONCONNECT = "SERVICE_EXTENSION_ONCONNECT"; -const std::string SERVICE_EXTENSION_ONDISCONNECT = "SERVICE_EXTENSION_ONDISCONNECT"; -const std::string SERVICE_EXTENSION_ONREQUEST = "SERVICE_EXTENSION_ONREQUEST"; } using namespace OHOS::AppExecFwk; @@ -122,8 +117,9 @@ void JsServiceExtension::OnStart(const AAFwk::Want &want) NativeValue* argv[] = {nativeWant}; CallObjectMethod("onCreate", argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = abilityInfo_->name; + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsServiceExtension::OnStop() @@ -137,8 +133,9 @@ void JsServiceExtension::OnStop() HILOG_INFO("The service extension connection is not disconnected."); } HILOG_INFO("%{public}s end.", __func__); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = abilityInfo_->name; + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) @@ -178,8 +175,9 @@ sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) if (remoteObj == nullptr) { HILOG_ERROR("remoteObj nullptr."); } - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = abilityInfo_->name; + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteObj; } @@ -212,8 +210,9 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want) } nativeEngine->CallFunction(value, method, argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = abilityInfo_->name; + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId) @@ -235,8 +234,9 @@ void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int st NativeValue* argv[] = {nativeWant, nativeStartId}; CallObjectMethod("onRequest", argv, ARGC_TWO); HILOG_INFO("%{public}s end.", __func__); - const std::string abilityName = abilityInfo_->name.c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = abilityInfo_->name; + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } NativeValue* JsServiceExtension::CallObjectMethod(const char* name, NativeValue* const* argv, size_t argc) diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 8bfb07c3..8f3578ba 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -28,22 +28,6 @@ namespace OHOS { namespace AAFwk { -namespace { -const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; -const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; -const std::string START_EXTENSION_ERROR = "START_EXTENSION_ERROR"; -const std::string STOP_EXTENSION_ERROR = "STOP_EXTENSION_ERROR"; -const std::string CONNECT_SERVICE_ERROR = "CONNECT_SERVICE_ERROR"; -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 DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; -const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; -const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; -const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; -const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; -const std::string DISCONNECT_SERVICE_EXTENSION = "DISCONNECT_SERVICE_EXTENSION"; -} std::shared_ptr AbilityManagerClient::instance_ = nullptr; std::recursive_mutex AbilityManagerClient::mutex_; @@ -119,11 +103,12 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->StartAbility(want, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->StartAbility(want, userId, requestCode); } @@ -137,11 +122,12 @@ ErrCode AbilityManagerClient::StartAbility( HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->StartAbility(want, callerToken, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->StartAbility(want, callerToken, userId, requestCode); } @@ -153,11 +139,12 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); } @@ -171,11 +158,12 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->StartAbility(want, startOptions, callerToken, userId, requestCode); } @@ -188,11 +176,12 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr HILOG_INFO("%{public}s come, bundleName=%{public}s, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), want.GetElement().GetBundleName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, START_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, START_EXTENSION_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->StartExtensionAbility(want, callerToken, userId, extensionType); } @@ -213,11 +202,12 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Terminate ability come."); int32_t ret = ERR_OK; - const std::string abilityName = resultWant->GetElement().GetAbilityName().c_str(); - AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = resultWant->GetElement().GetAbilityName().c_str(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->TerminateAbility(token, resultCode, resultWant); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->TerminateAbility(token, resultCode, resultWant); } @@ -228,11 +218,12 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); int32_t ret = ERR_OK; - const std::string abilityName = "terminate ability"; - AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = "terminate ability"; + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->TerminateAbilityByCaller(callerToken, requestCode); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->TerminateAbilityByCaller(callerToken, requestCode); } @@ -269,11 +260,12 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->ConnectAbility(want, connect, nullptr, userId); } @@ -287,11 +279,12 @@ ErrCode AbilityManagerClient::ConnectAbility( HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), userId); int32_t ret = ERR_OK; - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->ConnectAbility(want, connect, callerToken, userId); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->ConnectAbility(want, connect, callerToken, userId); } @@ -303,11 +296,12 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); int32_t ret = ERR_OK; - const std::string abilityName = "disconnect ability"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = "disconnect ability"; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); ret = abms->DisconnectAbility(connect); if (ret != ERR_OK) { - AAFWK::EventReport::SendHiSysEvent(abilityName, DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } return abms->DisconnectAbility(connect); } @@ -383,8 +377,9 @@ ErrCode AbilityManagerClient::StopServiceAbility(const Want &want) { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - const std::string abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendHiSysEvent(abilityName, STOP_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->StopServiceAbility(want); } @@ -874,8 +869,9 @@ ErrCode AbilityManagerClient::DoAbilityForeground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - const std::string abilityName = "do ability foreground"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = "do ability foreground"; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->DoAbilityForeground(token, flag); } @@ -883,8 +879,9 @@ ErrCode AbilityManagerClient::DoAbilityBackground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - const std::string abilityName = "do ability background"; - AAFWK::EventReport::SendHiSysEvent(abilityName, DO_BACKGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR); + AAFWK::EventInfo eventInfo; + eventInfo.abilityName = "do ability background"; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_BACKGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->DoAbilityBackground(token, flag); } diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 5116be67..48b62c9f 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -95,12 +95,6 @@ const std::string EVENT_MESSAGE_DEFAULT = "AppMgrServiceInner HandleTimeOut!"; const std::string SYSTEM_BASIC = "system_basic"; const std::string SYSTEM_CORE = "system_core"; -const std::string APP_ATTACH = "APP_ATTACH"; -const std::string APP_LAUNCH = "APP_LAUNCH"; -const std::string APP_FOREGROUND = "APP_FOREGROUND"; -const std::string APP_BACKGROUND = "APP_BACKGROUND"; -const std::string APP_TERMINATE = "APP_TERMINATE"; - int32_t GetUserIdByUid(int32_t uid) { return uid / BASE_USER_RANGE; @@ -275,13 +269,16 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrRegisterAppDeathRecipient(); - const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - AAFWK::EventReport::AppEvent( - applicationInfo, - pidStr, - APP_ATTACH, - AAFWK::HiSysEventType::BEHAVIOR); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.appName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + AAFWK::EventReport::AppEvent(AAFWK::APP_ATTACH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -317,13 +314,16 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrLaunchPendingAbilities(); - const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - AAFWK::EventReport::AppEvent( - applicationInfo, - pidStr, - APP_LAUNCH, - AAFWK::HiSysEventType::BEHAVIOR); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.appName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + AAFWK::EventReport::AppEvent(AAFWK::APP_LAUNCH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -358,13 +358,16 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) // push the foregrounded app front of RecentAppList. PushAppFront(recordId); HILOG_INFO("application is foregrounded"); - const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - AAFWK::EventReport::AppEvent( - applicationInfo, - pidStr, - APP_FOREGROUND, - AAFWK::HiSysEventType::BEHAVIOR); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.appName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + AAFWK::EventReport::AppEvent(AAFWK::APP_FOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -385,13 +388,16 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) } HILOG_INFO("application is backgrounded"); - const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - AAFWK::EventReport::AppEvent( - applicationInfo, - pidStr, - APP_BACKGROUND, - AAFWK::HiSysEventType::BEHAVIOR); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.appName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + AAFWK::EventReport::AppEvent(AAFWK::APP_BACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -424,13 +430,16 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) DelayedSingleton::GetInstance()->OnProcessDied(appRecord); HILOG_INFO("application is terminated"); - const std::string pidStr = std::to_string(appRecord->GetPriorityObject()->GetPid()); + AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - AAFWK::EventReport::AppEvent( - applicationInfo, - pidStr, - APP_TERMINATE, - AAFWK::HiSysEventType::BEHAVIOR); + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.appName = applicationInfo->name; + eventInfo.versionName = applicationInfo->versionName; + eventInfo.versionCode = applicationInfo->versionCode; + eventInfo.timeStamp = + std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) + .count(); + AAFWK::EventReport::AppEvent(AAFWK::APP_TERMINATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } int32_t AppMgrServiceInner::KillApplication(const std::string &bundleName) diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index ab541e08..7939e6d6 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -21,21 +21,153 @@ #include "application_info.h" #include "want.h" +#include "errors.h" namespace OHOS { namespace AAFWK { +namespace { +// event type +const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; +const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; +const std::string START_EXTENSION_ERROR = "START_EXTENSION_ERROR"; +const std::string STOP_EXTENSION_ERROR = "STOP_EXTENSION_ERROR"; +const std::string CONNECT_SERVICE_ERROR = "CONNECT_SERVICE_ERROR"; +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 DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; +const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; +const std::string ABILITY_ONSTART = "ABILITY_ONSTART"; +const std::string ABILITY_ONSTOP = "ABILITY_ONSTOP"; +const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND"; +const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND"; +const std::string ABILITY_WINDOWSTAGE_CREATE = "ABILITY_WINDOWSTAGE_CREATE"; +const std::string ABILITY_WINDOWSTAGE_DESTORY = "ABILITY_WINDOWSTAGE_DESTORY"; +const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; +const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; +const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; +const std::string DISCONNECT_SERVICE_EXTENSION = "DISCONNECT_SERVICE_EXTENSION"; +const std::string SERVICE_EXTENSION_ONSTART = "SERVICE_EXTENSION_ONSTART"; +const std::string SERVICE_EXTENSION_ONSTOP = "SERVICE_EXTENSION_ONSTOP"; +const std::string SERVICE_EXTENSION_ONCONNECT = "SERVICE_EXTENSION_ONCONNECT"; +const std::string SERVICE_EXTENSION_ONDISCONNECT = "SERVICE_EXTENSION_ONDISCONNECT"; +const std::string SERVICE_EXTENSION_ONREQUEST = "SERVICE_EXTENSION_ONREQUEST"; +const std::string ADD_FORM = "ADD_FORM"; +const std::string REQUEST_FORM = "REQUEST_FORM"; +const std::string DELETE_FORM = "DELETE_FORM"; +const std::string CASTTEMP_FORM = "CASTTEMP_FORM"; +const std::string ACQUIREFORMSTATE_FORM = "ACQUIREFORMSTATE_FORM"; +const std::string MESSAGE_EVENT_FORM = "MESSAGE_EVENT_FORM"; +const std::string ROUTE_EVENT_FORM = "ROUTE_EVENT_FORM"; +const std::string RELEASE_FORM = "RELEASE_FORM"; +const std::string DELETE_INVALID_FORM = "DELETE_INVALID_FORM"; +const std::string SET_NEXT_REFRESH_TIME_FORM = "SET_NEXT_REFRESH_TIME_FORM"; +const std::string FORM_LIFECYCLE_ONCREATE = "FORM_LIFECYCLE_ONCREATE"; +const std::string FORM_LIFECYCLE_ONDESTROY = "FORM_LIFECYCLE_ONDESTROY"; +const std::string FORM_LIFECYCLE_ONUPDATE = "FORM_LIFECYCLE_ONUPDATE"; +const std::string FORM_LIFECYCLE_EVENT = "FORM_LIFECYCLE_EVENT"; +const std::string FORM_LIFECYCLE_ONCASTTEMPFORM = "FORM_LIFECYCLE_ONCASTTEMPFORM"; +const std::string FORM_LIFECYCLE_ONACQUIREFORMSTATE = "FORM_LIFECYCLE_ONACQUIREFORMSTATE"; +const std::string APP_ATTACH = "APP_ATTACH"; +const std::string APP_LAUNCH = "APP_LAUNCH"; +const std::string APP_FOREGROUND = "APP_FOREGROUND"; +const std::string APP_BACKGROUND = "APP_BACKGROUND"; +const std::string APP_TERMINATE = "APP_TERMINATE"; +} +// enum class AMSEventType { +// UNKNOW = 0, +// /***********FAULT EVENT**************/ +// START_ABILITY_ERROR, +// TERMINATE_ABILITY_ERROR, +// START_EXTENSION_ERROR, +// STOP_EXTENSION_ERROR, +// CONNECT_SERVICE_ERROR, +// DISCONNECT_SERVICE_ERROR, +// /***********BEHAVIOR EVENT***********/ +// START_ABILITY, +// DO_FOREGROUND_ABILITY, +// DO_BACKGROUND_ABILITY, +// TERMINATE_ABILITY, +// ABILITY_ONSTART, +// ABILITY_ONSTOP, +// ABILITY_ONFOREGROUND, +// ABILITY_ONBACKGROUND, +// ABILITY_WINDOWSTAGE_CREATE, +// ABILITY_WINDOWSTAGE_DESTORY, +// START_SERVICE_EXTENSION, +// STOP_SERVICE_EXTENSION, +// CONNECT_SERVICE_EXTENSION, +// DISCONNECT_SERVICE_EXTENSION, +// SERVICE_EXTENSION_ONSTART, +// SERVICE_EXTENSION_ONSTOP, +// SERVICE_EXTENSION_ONCONNECT, +// SERVICE_EXTENSION_ONDISCONNECT, +// SERVICE_EXTENSION_ONREQUEST, +// ADD_FORM, +// REQUEST_FORM, +// DELETE_FORM, +// CASTTEMP_FORM, +// ACQUIREFORMSTATE_FORM, +// MESSAGE_EVENT_FORM, +// ROUTE_EVENT_FORM, +// RELEASE_FORM, +// DELETE_INVALID_FORM, +// SET_NEXT_REFRESH_TIME_FORM, +// FORM_ONCREATE, +// FORM_ONDESTROY, +// FORM_ONUPDATE, +// FORM_EVENT, +// FORM_ONCASTTEMPFORM, +// FORM_ONACQUIREFORMSTATE, +// APP_ATTACH, +// APP_LAUNCH, +// APP_FOREGROUND, +// APP_BACKGROUND, +// APP_TERMINATE, +// }; + enum HiSysEventType { FAULT = 1, STATISTIC = 2, SECURITY = 3, BEHAVIOR = 4, }; + +struct EventInfo { + int32_t pid = -1; + int32_t userId = -1; + int64_t timeStamp = 0; + int64_t formId =-1; + uint32_t versionCode = 0; + std::string versionName; + std::string moduleName; + std::string abilityName; + std::string appName; + + // olny used in fault event + ErrCode errCode = ERR_OK; + + void Reset() + { + pid =-1; + userId = -1; + timeStamp = 0; + formId =-1; + versionCode = 0; + versionName.clear(); + moduleName.clear(); + abilityName.clear(); + appName.clear(); + errCode = ERR_OK; + } +}; class EventReport { public: - static void AppEvent(const std::shared_ptr &applicationInfo, - const std::string &pid, const std::string &eventName, HiSysEventType type); - static void SendHiSysEvent(const std::string &abilityName, const std::string &eventName, - HiSysEventType type); + static void AppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); + static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); + static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); + static void SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); template static void EventWrite(const std::string &eventName, HiSysEventType type, Types... keyValues); diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index f671493a..fb536e93 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -22,6 +22,7 @@ namespace OHOS { namespace AAFWK { namespace { +// event params const std::string EVENT_KEY_PID = "PID"; const std::string EVENT_KEY_UID = "UID"; const std::string EVENT_KEY_RID = "RID"; @@ -32,48 +33,50 @@ const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; const std::string EVENT_KEY_DEVICEID = "DEVICEID"; const std::string EVENT_KEY_URI = "URI"; const std::string EVENT_KEY_ACTION = "ACTION"; -const std::string EVENT_KEY_APP_NAME = "NAME"; +const std::string EVENT_KEY_APP_NAME = "APP_NAME"; const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; const std::string EVENT_KEY_FORM_ID = "FORM_ID"; const std::string TYPE = "TYPE"; } -void EventReport::AppEvent(const std::shared_ptr &applicationInfo, - const std::string &pid, const std::string &eventName, HiSysEventType type) -{ - std::string name = applicationInfo->name.c_str(); - std::string versionName = applicationInfo->versionName.c_str(); - uint32_t versionCode = applicationInfo->versionCode; - int32_t timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); - EventReport::EventWrite( - eventName, - type, - EVENT_KEY_APP_NAME, name, - EVENT_KEY_VERSION_NAME, versionName, - EVENT_KEY_VERSION_CODE, std::to_string(versionCode), - EVENT_KEY_PID, pid.c_str(), - EVENT_KEY_TIME_STAMP, std::to_string(timeStamp)); - HILOG_WARN("{eventName}: name: %{public}s, versionName: %{public}s," - "versionCode: %{public}d, pid: %{public}s, timeStamp: %{public}d", - name.c_str(), - versionName.c_str(), - versionCode, - pid.c_str(), - timeStamp); -} -void EventReport::SendHiSysEvent(const std::string &abilityName, const std::string &eventName, - HiSysEventType type) + +void EventReport::AppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { EventReport::EventWrite( eventName, type, - EVENT_KEY_ABILITY_NAME, abilityName); - HILOG_WARN("{eventName}: abilityName: %{public}s", - abilityName.c_str()); + EVENT_KEY_APP_NAME, eventInfo.appName, + EVENT_KEY_VERSION_NAME, eventInfo.versionName, + EVENT_KEY_VERSION_CODE, eventInfo.versionCode, + EVENT_KEY_PID, eventInfo.pid, + EVENT_KEY_TIME_STAMP, eventInfo.timeStamp); } + +void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +{ + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); +} + +void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +{ + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); +} + +void EventReport::SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +{ + EventReport::EventWrite( + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.formId); +} + template void EventReport::EventWrite( const std::string &eventName, From e42544cc69205383ec2039a01b6c935e2ac0b67e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Tue, 24 May 2022 10:22:55 +0800 Subject: [PATCH 25/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Iffdbf755cfcd93a4ee53db632b65de6017e0bc23 --- .../native/src/ability_runtime/js_ability.cpp | 3 +- .../native/src/js_service_extension.cpp | 15 ++++-- .../kits/napi/aafwk/featureAbility/BUILD.gn | 2 +- .../abilitymgr/src/ability_manager_client.cpp | 3 +- .../ability_manager_client_test/BUILD.gn | 1 - services/appmgr/src/app_mgr_service_inner.cpp | 10 ++-- services/common/include/event_report.h | 53 +------------------ .../test/moduletest/call_module_test/BUILD.gn | 1 - 8 files changed, 21 insertions(+), 67 deletions(-) diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index b3db29c6..3e7f67a9 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -268,7 +268,8 @@ void JsAbility::onSceneDestroyed() HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); AAFWK::EventInfo eventInfo; eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); } void JsAbility::OnForeground(const Want &want) diff --git a/frameworks/kits/ability/native/src/js_service_extension.cpp b/frameworks/kits/ability/native/src/js_service_extension.cpp index 430a9b8d..44dd964c 100644 --- a/frameworks/kits/ability/native/src/js_service_extension.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension.cpp @@ -119,7 +119,8 @@ void JsServiceExtension::OnStart(const AAFwk::Want &want) HILOG_INFO("%{public}s end.", __func__); AAFWK::EventInfo eventInfo; eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); } void JsServiceExtension::OnStop() @@ -135,7 +136,8 @@ void JsServiceExtension::OnStop() HILOG_INFO("%{public}s end.", __func__); AAFWK::EventInfo eventInfo; eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); } sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) @@ -177,7 +179,8 @@ sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) } AAFWK::EventInfo eventInfo; eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); return remoteObj; } @@ -212,7 +215,8 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want) HILOG_INFO("%{public}s end.", __func__); AAFWK::EventInfo eventInfo; eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); } void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId) @@ -236,7 +240,8 @@ void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int st HILOG_INFO("%{public}s end.", __func__); AAFWK::EventInfo eventInfo; eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); } NativeValue* JsServiceExtension::CallObjectMethod(const char* name, NativeValue* const* argv, size_t argc) diff --git a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn index edf0431c..3bf8836c 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn +++ b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn @@ -52,8 +52,8 @@ ohos_shared_library("featureability") { "bundle_framework:appexecfwk_core", "dataability:native_dataability", "eventhandler:libeventhandler", - "hiviewdfx_hilog_native:libhilog", "hitrace_native:hitrace_meter", + "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "napi:ace_napi", "relational_store:native_appdatafwk", diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 5b62a313..b7460407 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -298,7 +298,8 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & int32_t ret = ERR_OK; AAFWK::EventInfo eventInfo; eventInfo.abilityName = "disconnect ability"; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); ret = abms->DisconnectAbility(connect); if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index effbb5f1..e575c67e 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("ability_manager_client_test") { "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hitrace_native:hitrace_meter", "ipc:ipc_core", ] } diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 92fa04bb..b8b47a7e 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -275,7 +275,7 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrname; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = + eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::AppEvent(AAFWK::APP_ATTACH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); @@ -320,7 +320,7 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrname; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = + eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::AppEvent(AAFWK::APP_LAUNCH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); @@ -364,7 +364,7 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) eventInfo.appName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = + eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::AppEvent(AAFWK::APP_FOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); @@ -394,7 +394,7 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) eventInfo.appName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = + eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::AppEvent(AAFWK::APP_BACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); @@ -436,7 +436,7 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) eventInfo.appName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = + eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::AppEvent(AAFWK::APP_TERMINATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 7939e6d6..d5db0303 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -75,57 +75,6 @@ const std::string APP_FOREGROUND = "APP_FOREGROUND"; const std::string APP_BACKGROUND = "APP_BACKGROUND"; const std::string APP_TERMINATE = "APP_TERMINATE"; } -// enum class AMSEventType { -// UNKNOW = 0, -// /***********FAULT EVENT**************/ -// START_ABILITY_ERROR, -// TERMINATE_ABILITY_ERROR, -// START_EXTENSION_ERROR, -// STOP_EXTENSION_ERROR, -// CONNECT_SERVICE_ERROR, -// DISCONNECT_SERVICE_ERROR, -// /***********BEHAVIOR EVENT***********/ -// START_ABILITY, -// DO_FOREGROUND_ABILITY, -// DO_BACKGROUND_ABILITY, -// TERMINATE_ABILITY, -// ABILITY_ONSTART, -// ABILITY_ONSTOP, -// ABILITY_ONFOREGROUND, -// ABILITY_ONBACKGROUND, -// ABILITY_WINDOWSTAGE_CREATE, -// ABILITY_WINDOWSTAGE_DESTORY, -// START_SERVICE_EXTENSION, -// STOP_SERVICE_EXTENSION, -// CONNECT_SERVICE_EXTENSION, -// DISCONNECT_SERVICE_EXTENSION, -// SERVICE_EXTENSION_ONSTART, -// SERVICE_EXTENSION_ONSTOP, -// SERVICE_EXTENSION_ONCONNECT, -// SERVICE_EXTENSION_ONDISCONNECT, -// SERVICE_EXTENSION_ONREQUEST, -// ADD_FORM, -// REQUEST_FORM, -// DELETE_FORM, -// CASTTEMP_FORM, -// ACQUIREFORMSTATE_FORM, -// MESSAGE_EVENT_FORM, -// ROUTE_EVENT_FORM, -// RELEASE_FORM, -// DELETE_INVALID_FORM, -// SET_NEXT_REFRESH_TIME_FORM, -// FORM_ONCREATE, -// FORM_ONDESTROY, -// FORM_ONUPDATE, -// FORM_EVENT, -// FORM_ONCASTTEMPFORM, -// FORM_ONACQUIREFORMSTATE, -// APP_ATTACH, -// APP_LAUNCH, -// APP_FOREGROUND, -// APP_BACKGROUND, -// APP_TERMINATE, -// }; enum HiSysEventType { FAULT = 1, @@ -138,7 +87,7 @@ struct EventInfo { int32_t pid = -1; int32_t userId = -1; int64_t timeStamp = 0; - int64_t formId =-1; + int64_t formId = -1; uint32_t versionCode = 0; std::string versionName; std::string moduleName; diff --git a/services/test/moduletest/call_module_test/BUILD.gn b/services/test/moduletest/call_module_test/BUILD.gn index 135febec..8ae7978d 100644 --- a/services/test/moduletest/call_module_test/BUILD.gn +++ b/services/test/moduletest/call_module_test/BUILD.gn @@ -61,7 +61,6 @@ ohos_moduletest("call_ability_service_module_test") { "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", - "hisysevent_native:libhisysevent", "ipc:ipc_core", ] } From ca74903bdf1fd1eb3373d6c6dad61cca8eb54d61 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Tue, 24 May 2022 10:51:33 +0800 Subject: [PATCH 26/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id2290c40829339ad92a64a560f6f82051968289e --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 + services/test/moduletest/call_module_test/BUILD.gn | 4 ++-- services/test/moduletest/common/ams/BUILD.gn | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index e575c67e..815779f2 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/test/moduletest/call_module_test/BUILD.gn b/services/test/moduletest/call_module_test/BUILD.gn index 8ae7978d..2e6cb942 100644 --- a/services/test/moduletest/call_module_test/BUILD.gn +++ b/services/test/moduletest/call_module_test/BUILD.gn @@ -41,8 +41,8 @@ ohos_moduletest("call_ability_service_module_test") { "${aafwk_path}/frameworks/kits/ability/native:abilitykit_native", "${aafwk_path}/interfaces/innerkits/app_manager:app_manager", "${aafwk_path}/services/abilitymgr:abilityms", - "${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base", - "${bundlefwk_innerkits_path}/libeventhandler:libeventhandler", + "${appexecfwk_inner_api_path}/appexecfwk_base:appexecfwk_base", + "${appexecfwk_innerkits_path}/libeventhandler:libeventhandler", "${services_path}/abilitymgr/test:abilityms_test_source", "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 1c4eab18..1d045986 100644 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -40,10 +40,10 @@ ohos_source_set("appmgr_mst_source") { "${services_path}/appmgr/src/app_spawn_msg_wrapper.cpp", "${services_path}/appmgr/src/app_spawn_socket.cpp", "${services_path}/appmgr/src/app_state_observer_manager.cpp", + "${services_path}/common/src/event_report.cpp", "${services_path}/appmgr/src/module_running_record.cpp", "${services_path}/appmgr/src/remote_client_manager.cpp", "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp", - "${services_path}/common/src/event_report.cpp", ] defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] From 5313bbf3a1ea50b72d0ef8c72282123f8b149e26 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Tue, 24 May 2022 11:00:05 +0800 Subject: [PATCH 27/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I67d9a952b8a92e97c23d8706d7edc12c964c458d --- services/test/moduletest/call_module_test/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/test/moduletest/call_module_test/BUILD.gn b/services/test/moduletest/call_module_test/BUILD.gn index 2e6cb942..8ae7978d 100644 --- a/services/test/moduletest/call_module_test/BUILD.gn +++ b/services/test/moduletest/call_module_test/BUILD.gn @@ -41,8 +41,8 @@ ohos_moduletest("call_ability_service_module_test") { "${aafwk_path}/frameworks/kits/ability/native:abilitykit_native", "${aafwk_path}/interfaces/innerkits/app_manager:app_manager", "${aafwk_path}/services/abilitymgr:abilityms", - "${appexecfwk_inner_api_path}/appexecfwk_base:appexecfwk_base", - "${appexecfwk_innerkits_path}/libeventhandler:libeventhandler", + "${bundlefwk_inner_api_path}/appexecfwk_base:appexecfwk_base", + "${bundlefwk_innerkits_path}/libeventhandler:libeventhandler", "${services_path}/abilitymgr/test:abilityms_test_source", "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", From 8f9a8b797af774180aeb6b9d565109977e759b9e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Tue, 24 May 2022 11:20:23 +0800 Subject: [PATCH 28/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I6e90bc76cec90624ca5117c0a5daaef59b9d0378 --- services/test/moduletest/common/ams/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/test/moduletest/common/ams/BUILD.gn b/services/test/moduletest/common/ams/BUILD.gn index 1d045986..1c4eab18 100644 --- a/services/test/moduletest/common/ams/BUILD.gn +++ b/services/test/moduletest/common/ams/BUILD.gn @@ -40,10 +40,10 @@ ohos_source_set("appmgr_mst_source") { "${services_path}/appmgr/src/app_spawn_msg_wrapper.cpp", "${services_path}/appmgr/src/app_spawn_socket.cpp", "${services_path}/appmgr/src/app_state_observer_manager.cpp", - "${services_path}/common/src/event_report.cpp", "${services_path}/appmgr/src/module_running_record.cpp", "${services_path}/appmgr/src/remote_client_manager.cpp", "${services_path}/appmgr/test/mock/src/mock_bundle_manager.cpp", + "${services_path}/common/src/event_report.cpp", ] defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ] From 71c9a75476dc6f4fd71831c1f455416f5aa1d5ba Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Tue, 24 May 2022 17:18:22 +0800 Subject: [PATCH 29/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Icbc34ae8b57b9cc90614a3837031ca5b20066430 --- .../abilitymgr/src/ability_manager_client.cpp | 20 +++++++++---------- services/appmgr/src/app_mgr_service_inner.cpp | 20 +++++++++---------- .../ams_app_death_recipient_test/BUILD.gn | 1 - .../unittest/ams_app_workflow_test/BUILD.gn | 3 --- .../ams_recent_app_list_test/BUILD.gn | 3 --- .../BUILD.gn | 2 -- .../ams_service_event_drive_test/BUILD.gn | 1 - .../BUILD.gn | 1 - .../ams_service_startup_test/BUILD.gn | 1 - .../BUILD.gn | 1 - .../app_running_processes_info_test/BUILD.gn | 2 -- services/common/include/event_report.h | 14 +++++++------ services/common/src/event_report.cpp | 4 ++-- 13 files changed, 30 insertions(+), 43 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index b7460407..417b8854 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -110,7 +110,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->StartAbility(want, userId, requestCode); + return ret; } ErrCode AbilityManagerClient::StartAbility( @@ -129,7 +129,7 @@ ErrCode AbilityManagerClient::StartAbility( if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->StartAbility(want, callerToken, userId, requestCode); + return ret; } ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartSetting &abilityStartSetting, @@ -146,7 +146,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); + return ret; } ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions &startOptions, @@ -165,7 +165,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->StartAbility(want, startOptions, callerToken, userId, requestCode); + return ret; } ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr &callerToken, @@ -183,7 +183,7 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->StartExtensionAbility(want, callerToken, userId, extensionType); + return ret; } ErrCode AbilityManagerClient::StopExtensionAbility(const Want &want, const sptr &callerToken, @@ -209,7 +209,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->TerminateAbility(token, resultCode, resultWant); + return ret; } ErrCode AbilityManagerClient::TerminateAbility(const sptr &callerToken, int requestCode) @@ -225,7 +225,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->TerminateAbilityByCaller(callerToken, requestCode); + return ret; } ErrCode AbilityManagerClient::TerminateAbilityResult(const sptr &token, int startId) @@ -267,7 +267,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); + return ret; } ErrCode AbilityManagerClient::ConnectAbility( @@ -286,7 +286,7 @@ ErrCode AbilityManagerClient::ConnectAbility( if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->ConnectAbility(want, connect, callerToken, userId); + return ret; } ErrCode AbilityManagerClient::DisconnectAbility(const sptr &connect) @@ -304,7 +304,7 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & if (ret != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); } - return abms->DisconnectAbility(connect); + return ret; } sptr AbilityManagerClient::AcquireDataAbility( diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index b8b47a7e..a308ec1d 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -272,13 +272,13 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrGetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); - eventInfo.appName = applicationInfo->name; + eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::AppEvent(AAFWK::APP_ATTACH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -317,13 +317,13 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrGetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); - eventInfo.appName = applicationInfo->name; + eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::AppEvent(AAFWK::APP_LAUNCH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -361,13 +361,13 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); - eventInfo.appName = applicationInfo->name; + eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::AppEvent(AAFWK::APP_FOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -391,13 +391,13 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); - eventInfo.appName = applicationInfo->name; + eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::AppEvent(AAFWK::APP_BACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -433,13 +433,13 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); - eventInfo.appName = applicationInfo->name; + eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::AppEvent(AAFWK::APP_TERMINATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } int32_t AppMgrServiceInner::KillApplication(const std::string &bundleName) diff --git a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn index d4756b83..370df4b9 100644 --- a/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_death_recipient_test/BUILD.gn @@ -59,7 +59,6 @@ ohos_unittest("AppDeathRecipientTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", diff --git a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn index 1df0de24..6b6f0081 100644 --- a/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_app_workflow_test/BUILD.gn @@ -46,8 +46,6 @@ ohos_unittest("AmsWorkFlowTest") { sources += [ "ams_workflow_test.cpp" ] - configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] - deps = [ "${aafwk_path}/interfaces/innerkits/app_manager:app_manager", "${ability_base_path}:base", @@ -57,7 +55,6 @@ ohos_unittest("AmsWorkFlowTest") { "${bundlefwk_innerkits_path}/libeventhandler:libeventhandler", "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn index 9722323d..d5e416ea 100644 --- a/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_recent_app_list_test/BUILD.gn @@ -43,8 +43,6 @@ ohos_unittest("AmsRecentAppListTest") { ] sources += [ "ams_recent_app_list_test.cpp" ] - - configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -58,7 +56,6 @@ ohos_unittest("AmsRecentAppListTest") { "${bundlefwk_innerkits_path}/libeventhandler:libeventhandler", "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn index a5037e14..e9c70728 100644 --- a/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_app_spawn_client_test/BUILD.gn @@ -44,8 +44,6 @@ ohos_unittest("AmsServiceAppSpawnClientTest") { ] sources += [ "ams_service_app_spawn_client_test.cpp" ] - - configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn index a4c4e9f7..b9fc512e 100644 --- a/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_event_drive_test/BUILD.gn @@ -47,7 +47,6 @@ ohos_unittest("AmsServiceEventDriveTest") { sources += [ "ams_service_event_drive_test.cpp" ] - configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 58366f45..3f7895e6 100644 --- a/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_load_ability_process_test/BUILD.gn @@ -58,7 +58,6 @@ ohos_unittest("AmsServiceLoadAbilityProcessTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", ] diff --git a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn index bfb23c89..a560c6ea 100644 --- a/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn +++ b/services/appmgr/test/unittest/ams_service_startup_test/BUILD.gn @@ -44,7 +44,6 @@ ohos_unittest("AmsServiceStartupTest") { sources += [ "ams_service_startup_test.cpp" ] configs = [ "${bundlefwk_path}/libs/libeventhandler:libeventhandler_config" ] - configs += [ "${services_path}/appmgr/test:appmgr_test_config" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn index 6d0266f7..5cc7f34b 100644 --- a/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn +++ b/services/appmgr/test/unittest/app_mgr_service_event_handler_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("AMSEventHandlerTest") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/appmgr:libappms", "${services_path}/appmgr/test:appmgr_test_source", "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", diff --git a/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn b/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn index 16552e86..70eea446 100644 --- a/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn +++ b/services/appmgr/test/unittest/app_running_processes_info_test/BUILD.gn @@ -42,8 +42,6 @@ ohos_unittest("AppRunningProcessesInfoTest") { sources += [ "app_running_processes_info_test.cpp" ] - configs = [ "${services_path}/appmgr/test:appmgr_test_config" ] - cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index d5db0303..032e2bd2 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -27,13 +27,14 @@ namespace OHOS { namespace AAFWK { namespace { // event type +// fault event const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; const std::string START_EXTENSION_ERROR = "START_EXTENSION_ERROR"; const std::string STOP_EXTENSION_ERROR = "STOP_EXTENSION_ERROR"; const std::string CONNECT_SERVICE_ERROR = "CONNECT_SERVICE_ERROR"; const std::string DISCONNECT_SERVICE_ERROR = "DISCONNECT_SERVICE_ERROR"; - +// ability behavior event const std::string START_ABILITY = "START_ABILITY"; const std::string TERMINATE_ABILITY = "TERMINATE_ABILITY"; const std::string DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; @@ -44,6 +45,7 @@ const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND"; const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND"; const std::string ABILITY_WINDOWSTAGE_CREATE = "ABILITY_WINDOWSTAGE_CREATE"; const std::string ABILITY_WINDOWSTAGE_DESTORY = "ABILITY_WINDOWSTAGE_DESTORY"; +// serviceExtensionAbility behavior event const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; @@ -53,6 +55,7 @@ const std::string SERVICE_EXTENSION_ONSTOP = "SERVICE_EXTENSION_ONSTOP"; const std::string SERVICE_EXTENSION_ONCONNECT = "SERVICE_EXTENSION_ONCONNECT"; const std::string SERVICE_EXTENSION_ONDISCONNECT = "SERVICE_EXTENSION_ONDISCONNECT"; const std::string SERVICE_EXTENSION_ONREQUEST = "SERVICE_EXTENSION_ONREQUEST"; +// form behavior event const std::string ADD_FORM = "ADD_FORM"; const std::string REQUEST_FORM = "REQUEST_FORM"; const std::string DELETE_FORM = "DELETE_FORM"; @@ -69,6 +72,7 @@ const std::string FORM_LIFECYCLE_ONUPDATE = "FORM_LIFECYCLE_ONUPDATE"; const std::string FORM_LIFECYCLE_EVENT = "FORM_LIFECYCLE_EVENT"; const std::string FORM_LIFECYCLE_ONCASTTEMPFORM = "FORM_LIFECYCLE_ONCASTTEMPFORM"; const std::string FORM_LIFECYCLE_ONACQUIREFORMSTATE = "FORM_LIFECYCLE_ONACQUIREFORMSTATE"; +// app behavior event const std::string APP_ATTACH = "APP_ATTACH"; const std::string APP_LAUNCH = "APP_LAUNCH"; const std::string APP_FOREGROUND = "APP_FOREGROUND"; @@ -90,9 +94,8 @@ struct EventInfo { int64_t formId = -1; uint32_t versionCode = 0; std::string versionName; - std::string moduleName; + std::string bundleName; std::string abilityName; - std::string appName; // olny used in fault event ErrCode errCode = ERR_OK; @@ -105,15 +108,14 @@ struct EventInfo { formId =-1; versionCode = 0; versionName.clear(); - moduleName.clear(); + bundleName.clear(); abilityName.clear(); - appName.clear(); errCode = ERR_OK; } }; class EventReport { public: - static void AppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); + static void SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); static void SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index fb536e93..ea285d42 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -41,12 +41,12 @@ const std::string EVENT_KEY_FORM_ID = "FORM_ID"; const std::string TYPE = "TYPE"; } -void EventReport::AppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { EventReport::EventWrite( eventName, type, - EVENT_KEY_APP_NAME, eventInfo.appName, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_VERSION_NAME, eventInfo.versionName, EVENT_KEY_VERSION_CODE, eventInfo.versionCode, EVENT_KEY_PID, eventInfo.pid, From 89e935980e0f9f486167a632f534c38e397ce204 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 16:46:16 +0800 Subject: [PATCH 30/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I802e57bbca21791886385923bb97efb27cad24ab --- form_runtime/BUILD.gn | 3 +- form_runtime/hisysevent.yaml | 48 +++--- .../interfaces/kits/native/src/form_mgr.cpp | 31 ---- .../services/src/form_mgr_service.cpp | 42 ++++++ frameworks/kits/ability/native/BUILD.gn | 2 - .../native/src/ability_runtime/js_ability.cpp | 19 --- .../src/form_runtime/js_form_extension.cpp | 20 --- .../native/src/js_service_extension.cpp | 21 --- hisysevent.yaml | 95 ++++++------ interfaces/innerkits/ability_manager/BUILD.gn | 5 +- .../abilitymgr/src/ability_manager_client.cpp | 111 ++------------ .../src/ability_manager_service.cpp | 142 +++++++++++++++++- services/appmgr/BUILD.gn | 1 - services/common/include/event_report.h | 25 +-- services/common/src/event_report.cpp | 73 ++++----- 15 files changed, 301 insertions(+), 337 deletions(-) diff --git a/form_runtime/BUILD.gn b/form_runtime/BUILD.gn index 575c9631..0d152c00 100644 --- a/form_runtime/BUILD.gn +++ b/form_runtime/BUILD.gn @@ -98,6 +98,7 @@ ohos_shared_library("libfms") { "distributeddatamgr:distributeddata_inner", "eventhandler:libeventhandler", "form_runtime:form_manager", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "power_manager_native:powermgr_client", @@ -141,7 +142,6 @@ ohos_shared_library("fmskit_native") { configs = [ ":fmskit_config" ] public_configs = [ ":fmskit_public_config" ] sources = [ - "${services_path}/common/src/event_report.cpp", "interfaces/kits/native/src/form_errors.cpp", "interfaces/kits/native/src/form_host_client.cpp", "interfaces/kits/native/src/form_mgr.cpp", @@ -161,7 +161,6 @@ ohos_shared_library("fmskit_native") { "bundle_framework:appexecfwk_core", "form_runtime:form_manager", "hisysevent_native:libhisysevent", - "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr_standard:samgr_proxy", "utils_base:utils", diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml index b3c1aa0c..99ca33f8 100644 --- a/form_runtime/hisysevent.yaml +++ b/form_runtime/hisysevent.yaml @@ -13,66 +13,56 @@ domain: AAFWK +# form behavior event + ADD_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} REQUEST_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DELETE_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} + FORM_ID: {type: INT64, desc: formId} CASTTEMP_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} + FORM_ID: {type: INT64, desc: formId} ACQUIREFORMSTATE_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} MESSAGE_EVENT_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} ROUTE_EVENT_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + FORM_ID: {type: INT64, desc: formId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} RELEASE_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} + FORM_ID: {type: INT64, desc: formId} DELETE_INVALID_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} SET_NEXT_REFRESH_TIME_FORM: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONCREATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONDESTROY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONUPDATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_EVENT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONCASTTEMPFORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} - -FORM_ONACQUIREFORMSTATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form lifecycle event} - ABILITY_NAME: {type: STRING, desc: ability name} \ No newline at end of file + FORM_ID: {type: INT64, desc: formId} \ No newline at end of file diff --git a/form_runtime/interfaces/kits/native/src/form_mgr.cpp b/form_runtime/interfaces/kits/native/src/form_mgr.cpp index 2316f505..6b631189 100644 --- a/form_runtime/interfaces/kits/native/src/form_mgr.cpp +++ b/form_runtime/interfaces/kits/native/src/form_mgr.cpp @@ -26,7 +26,6 @@ #include "iservice_registry.h" #include "string_ex.h" #include "system_ability_definition.h" -#include "event_report.h" namespace OHOS { namespace AppExecFwk { @@ -71,9 +70,6 @@ int FormMgr::AddForm( HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->AddForm(formId, want, callerToken, formInfo); } @@ -91,9 +87,6 @@ int FormMgr::DeleteForm(const int64_t formId, const sptr &callerT HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->DeleteForm(formId, callerToken); } @@ -112,9 +105,6 @@ int FormMgr::ReleaseForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->ReleaseForm(formId, callerToken, delCache); } @@ -153,9 +143,6 @@ int FormMgr::RequestForm(const int64_t formId, const sptr &caller HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->RequestForm(formId, callerToken, want); } @@ -194,9 +181,6 @@ int FormMgr::CastTempForm(const int64_t formId, const sptr &calle HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->CastTempForm(formId, callerToken); } @@ -278,9 +262,6 @@ int FormMgr::MessageEvent(const int64_t formId, const Want &want, const sptrMessageEvent(formId, want, callerToken); } @@ -298,9 +279,6 @@ int FormMgr::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->RouterEvent(formId, want); } @@ -318,9 +296,6 @@ int FormMgr::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) HILOG_ERROR("%{public}s failed errCode:%{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->SetNextRefreshTime(formId, nextTime); } @@ -613,9 +588,6 @@ int FormMgr::DeleteInvalidForms(const std::vector &formIds, const sptr< HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = 0; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -634,9 +606,6 @@ int FormMgr::AcquireFormState(const Want &want, const sptr &calle HILOG_ERROR("%{public}s failed, errCode: %{public}d.", __func__, errCode); return errCode; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = 0; - AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return remoteProxy_->AcquireFormState(want, callerToken, stateInfo); } diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index aec7cc3d..1bc1d608 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -91,6 +91,12 @@ int FormMgrService::AddForm(const int64_t formId, const Want &want, const sptr &callerToken, FormJsInfo &formInfo) { ErrCode ret = CheckFormPermission(); + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); if (ret != ERR_OK) { HILOG_ERROR("%{public}s fail, add form permission denied", __func__); return ret; @@ -111,6 +117,9 @@ int FormMgrService::DeleteForm(const int64_t formId, const sptr & HILOG_ERROR("%{public}s fail, delete form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteForm(formId, callerToken); } @@ -129,6 +138,9 @@ int FormMgrService::ReleaseForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, release form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().ReleaseForm(formId, callerToken, delCache); } @@ -173,6 +185,12 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RequestForm(formId, callerToken, want); } @@ -187,6 +205,9 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr int FormMgrService::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) { HILOG_INFO("%{public}s called.", __func__); + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().SetNextRefreshTime(formId, nextTime); } @@ -224,6 +245,9 @@ int FormMgrService::CastTempForm(const int64_t formId, const sptr HILOG_ERROR("%{public}s fail, cast temp form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().CastTempForm(formId, callerToken); } @@ -306,6 +330,11 @@ int FormMgrService::MessageEvent(const int64_t formId, const Want &want, const s HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().MessageEvent(formId, want, callerToken); } @@ -323,6 +352,12 @@ int FormMgrService::RouterEvent(const int64_t formId, Want &want) HILOG_ERROR("%{public}s fail, request form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.userId = formId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RouterEvent(formId, want); } @@ -494,6 +529,8 @@ int FormMgrService::DeleteInvalidForms(const std::vector &formIds, cons HILOG_ERROR("%{public}s fail, delete form permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -512,6 +549,11 @@ int FormMgrService::AcquireFormState(const Want &want, const sptr HILOG_ERROR("%{public}s fail, acquire form state permission denied", __func__); return ret; } + AAFWK::EventInfo eventInfo; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().AcquireFormState(want, callerToken, stateInfo); } diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index cbf7aa6a..670602ac 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -137,7 +137,6 @@ 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", @@ -221,7 +220,6 @@ 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", diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index 3e7f67a9..1393cc92 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -34,7 +34,6 @@ #include "string_wrapper.h" #include "context/context.h" #include "context/application_context.h" -#include "event_report.h" #include "hitrace_meter.h" namespace OHOS { @@ -165,9 +164,6 @@ void JsAbility::OnStart(const Want &want) delegator->PostPerformStart(CreateADelegatorAbilityProperty()); } HILOG_INFO("OnStart end, ability is %{public}s.", GetAbilityName().c_str()); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnStop() @@ -193,9 +189,6 @@ void JsAbility::OnStop() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityDestroy(jsAbilityObj_); } - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } #ifdef SUPPORT_GRAPHICS @@ -224,9 +217,6 @@ void JsAbility::OnSceneCreated() } HILOG_INFO("OnSceneCreated end, ability is %{public}s.", GetAbilityName().c_str()); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_CREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnSceneRestored() @@ -266,9 +256,6 @@ void JsAbility::onSceneDestroyed() applicationContext->DispatchOnAbilityWindowStageDestroy(jsAbilityObj_); } HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_WINDOWSTAGE_DESTORY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } @@ -306,9 +293,6 @@ 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, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsAbility::OnBackground() @@ -328,9 +312,6 @@ void JsAbility::OnBackground() if (applicationContext != nullptr) { applicationContext->DispatchOnAbilityBackground(jsAbilityObj_); } - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::ABILITY_ONBACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } #endif diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp index dda8b9c5..5244cc59 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension.cpp @@ -29,7 +29,6 @@ #include "napi_common_configuration.h" #include "napi_common_util.h" #include "napi_common_want.h" -#include "event_report.h" namespace OHOS { namespace AbilityRuntime { @@ -151,9 +150,6 @@ OHOS::AppExecFwk::FormProviderInfo JsFormExtension::OnCreate(const OHOS::AAFwk:: } formProviderInfo.SetFormData(formData); HILOG_INFO("%{public}s called end.", __func__); - AAFWK::EventInfo eventInfo; - eventInfo.formId = 0; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return formProviderInfo; } @@ -171,9 +167,6 @@ void JsFormExtension::OnDestroy(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onDestroy", argv, 1); - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) @@ -194,9 +187,6 @@ void JsFormExtension::OnEvent(const int64_t formId, const std::string& message) NativeValue* nativeMessage = reinterpret_cast(napiMessage); NativeValue* argv[] = {nativeFormId, nativeMessage}; CallObjectMethod("onEvent", argv, ON_EVENT_PARAMS_SIZE); - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnUpdate(const int64_t formId) @@ -213,9 +203,6 @@ void JsFormExtension::OnUpdate(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onUpdate", argv, 1); - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnCastToNormal(const int64_t formId) @@ -232,9 +219,6 @@ void JsFormExtension::OnCastToNormal(const int64_t formId) NativeValue* nativeFormId = reinterpret_cast(napiFormId); NativeValue* argv[] = {nativeFormId}; CallObjectMethod("onCastToNormal", argv, 1); - AAFWK::EventInfo eventInfo; - eventInfo.formId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONCREATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } void JsFormExtension::OnVisibilityChange(const std::map& formEventsMap) @@ -365,10 +349,6 @@ FormState JsFormExtension::OnAcquireFormState(const Want &want) } else { return (AppExecFwk::FormState) state; } - AAFWK::EventInfo eventInfo; - eventInfo.formId = 0; - AAFWK::EventReport::SendFormEvent(AAFWK::FORM_LIFECYCLE_ONACQUIREFORMSTATE, - AAFWK::HiSysEventType::BEHAVIOR, eventInfo); } } // namespace AbilityRuntime } // namespace OHOS diff --git a/frameworks/kits/ability/native/src/js_service_extension.cpp b/frameworks/kits/ability/native/src/js_service_extension.cpp index 44dd964c..24b261e5 100644 --- a/frameworks/kits/ability/native/src/js_service_extension.cpp +++ b/frameworks/kits/ability/native/src/js_service_extension.cpp @@ -27,7 +27,6 @@ #include "napi_common_configuration.h" #include "napi_common_want.h" #include "napi_remote_object.h" -#include "event_report.h" namespace OHOS { namespace AbilityRuntime { @@ -117,10 +116,6 @@ void JsServiceExtension::OnStart(const AAFwk::Want &want) NativeValue* argv[] = {nativeWant}; CallObjectMethod("onCreate", argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTART, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); } void JsServiceExtension::OnStop() @@ -134,10 +129,6 @@ void JsServiceExtension::OnStop() HILOG_INFO("The service extension connection is not disconnected."); } HILOG_INFO("%{public}s end.", __func__); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONSTOP, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); } sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) @@ -177,10 +168,6 @@ sptr JsServiceExtension::OnConnect(const AAFwk::Want &want) if (remoteObj == nullptr) { HILOG_ERROR("remoteObj nullptr."); } - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONCONNECT, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); return remoteObj; } @@ -213,10 +200,6 @@ void JsServiceExtension::OnDisconnect(const AAFwk::Want &want) } nativeEngine->CallFunction(value, method, argv, ARGC_ONE); HILOG_INFO("%{public}s end.", __func__); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONDISCONNECT, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); } void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int startId) @@ -238,10 +221,6 @@ void JsServiceExtension::OnCommand(const AAFwk::Want &want, bool restart, int st NativeValue* argv[] = {nativeWant, nativeStartId}; CallObjectMethod("onRequest", argv, ARGC_TWO); HILOG_INFO("%{public}s end.", __func__); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = abilityInfo_->name; - AAFWK::EventReport::SendExtensionEvent(AAFWK::SERVICE_EXTENSION_ONREQUEST, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); } NativeValue* JsServiceExtension::CallObjectMethod(const char* name, NativeValue* const* argv, size_t argc) diff --git a/hisysevent.yaml b/hisysevent.yaml index 55945ca1..a049f634 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -45,106 +45,105 @@ THREAD_BLOCK_6S: PACKAGE_NAME: {type: STRING, desc: package name} PROCESS_NAME: {type: STRING, desc: process name} MSG: {type: STRING, desc: application event message} - + +# fault event + START_ABILITY_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start ability error} ABILITY_NAME: {type: STRING, desc: ability name} TERMINATE_ABILITY_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: terminate ability error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} START_EXTENSION_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start extensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} STOP_EXTENSION_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: stop extensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} CONNECT_SERVICE_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: connnect serviceExtensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DISCONNECT_SERVICE_ERROR: __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility error} + USER_ID: {type: INT32, desc: userId} + ERROR_CODE: {type: INT32, desc: error code} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} - + +# ability behavior event + START_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start ability} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DO_FOREGROUND_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: foreground ability} - ABILITY_NAME: {type: STRING, desc: ability name} + SCENE_FLAG: {type: STRING, desc: scene flag} DO_BACKGROUND_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: background ability} - ABILITY_NAME: {type: STRING, desc: ability name} + SCENE_FLAG: {type: STRING, desc: scene flag} + +CLOSE_ABILITY: + __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: close ability} TERMINATE_ABILITY: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: terminate ability} - ABILITY_NAME: {type: STRING, desc: ability name} -ABILITY_ONSTART: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onstart} - ABILITY_NAME: {type: STRING, desc: ability name} +# serviceExtensionAbility behavior event -ABILITY_ONSTOP: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onstop} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONFOREGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onforeground} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_ONBACKGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle onbackground} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_WINDOWSTAGE_CREATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle windowstage create} - ABILITY_NAME: {type: STRING, desc: ability name} - -ABILITY_WINDOWSTAGE_DESTORY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: ability lifecycle windwostage destory} - ABILITY_NAME: {type: STRING, desc: ability name} - START_SERVICE_EXTENSION: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start serviceExtensionAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} + EXTENSION_TYPE: {type: STRING, desc: extension type} STOP_SERVICE_EXTENSION: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: stop serviceExtensionAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} + EXTENSION_TYPE: {type: STRING, desc: extension type} CONNECT_SERVICE_EXTENSION: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: connect serviceExtensionAbility} + USER_ID: {type: INT32, desc: userId} + BUNDLE_NAME: {type: STRING, desc: bundle name} + MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DISCONNECT_SERVICE_EXTENSION: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility} - ABILITY_NAME: {type: STRING, desc: ability name} -SERVICE_EXTENSION_ONSTART: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onstart} - ABILITY_NAME: {type: STRING, desc: ability name} - -SERVICE_EXTENSION_ONSTOP: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onstop} - ABILITY_NAME: {type: STRING, desc: ability name} - -SERVICE_EXTENSION_ONCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onconnect} - ABILITY_NAME: {type: STRING, desc: ability name} - -SERVICE_EXTENSION_ONDISCONNECT: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle ondisconnect} - ABILITY_NAME: {type: STRING, desc: ability name} - -SERVICE_EXTENSION_ONREQUEST: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: serviceExtensionAbility lifecycle onrequest} - ABILITY_NAME: {type: STRING, desc: ability name} +# app behavior event APP_ATTACH: __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: attach app} diff --git a/interfaces/innerkits/ability_manager/BUILD.gn b/interfaces/innerkits/ability_manager/BUILD.gn index f0cd05b1..4daa7d8e 100644 --- a/interfaces/innerkits/ability_manager/BUILD.gn +++ b/interfaces/innerkits/ability_manager/BUILD.gn @@ -93,10 +93,7 @@ ohos_shared_library("ability_manager") { "${services_path}/abilitymgr:abilityms_config", ] - deps = [ - "${services_path}/common:perm_verification", - "//third_party/jsoncpp:jsoncpp", - ] + deps = [ "//third_party/jsoncpp:jsoncpp" ] external_deps = [ "ability_base:base", diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 417b8854..a1b0607e 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -23,7 +23,6 @@ #include "iservice_registry.h" #include "string_ex.h" #include "system_ability_definition.h" -#include "event_report.h" #include "hitrace_meter.h" namespace OHOS { @@ -102,15 +101,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->StartAbility(want, userId, requestCode); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->StartAbility(want, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility( @@ -121,15 +112,7 @@ ErrCode AbilityManagerClient::StartAbility( CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", want.GetElement().GetAbilityName().c_str(), userId); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->StartAbility(want, callerToken, userId, requestCode); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->StartAbility(want, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartSetting &abilityStartSetting, @@ -138,15 +121,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions &startOptions, @@ -157,15 +132,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), userId); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr &callerToken, @@ -175,15 +142,7 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, bundleName=%{public}s, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), want.GetElement().GetBundleName().c_str(), userId); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); } ErrCode AbilityManagerClient::StopExtensionAbility(const Want &want, const sptr &callerToken, @@ -201,15 +160,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Terminate ability come."); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = resultWant->GetElement().GetAbilityName().c_str(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->TerminateAbility(token, resultCode, resultWant); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->TerminateAbility(token, resultCode, resultWant); } ErrCode AbilityManagerClient::TerminateAbility(const sptr &callerToken, int requestCode) @@ -217,15 +168,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = "terminate ability"; - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->TerminateAbilityByCaller(callerToken, requestCode); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->TerminateAbilityByCaller(callerToken, requestCode); } ErrCode AbilityManagerClient::TerminateAbilityResult(const sptr &token, int startId) @@ -259,15 +202,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->ConnectAbility(want, connect, nullptr, userId); } ErrCode AbilityManagerClient::ConnectAbility( @@ -278,15 +213,7 @@ ErrCode AbilityManagerClient::ConnectAbility( CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), userId); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - ret = abms->ConnectAbility(want, connect, callerToken, userId); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->ConnectAbility(want, connect, callerToken, userId); } ErrCode AbilityManagerClient::DisconnectAbility(const sptr &connect) @@ -295,16 +222,7 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); - int32_t ret = ERR_OK; - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = "disconnect ability"; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, - eventInfo); - ret = abms->DisconnectAbility(connect); - if (ret != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); - } - return ret; + return ret = abms->DisconnectAbility(connect); } sptr AbilityManagerClient::AcquireDataAbility( @@ -378,9 +296,6 @@ ErrCode AbilityManagerClient::StopServiceAbility(const Want &want) { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->StopServiceAbility(want); } @@ -889,9 +804,6 @@ ErrCode AbilityManagerClient::DoAbilityForeground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = "do ability foreground"; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->DoAbilityForeground(token, flag); } @@ -899,9 +811,6 @@ ErrCode AbilityManagerClient::DoAbilityBackground(const sptr &tok { auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - AAFWK::EventInfo eventInfo; - eventInfo.abilityName = "do ability background"; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_BACKGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return abms->DoAbilityBackground(token, flag); } diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 93799abf..e51fa406 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -64,6 +64,7 @@ #include "uri_permission_manager_client.h" #include "xcollie/watchdog.h" #include "parameter.h" +#include "event_report.h" using OHOS::AppExecFwk::ElementName; using OHOS::Security::AccessToken::AccessTokenKit; @@ -258,6 +259,12 @@ int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int re { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_INFO("%{public}s coldStart:%{public}d", __func__, want.GetBoolParam("coldStart", false)); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return StartAbilityInner(want, nullptr, requestCode, -1, userId); } @@ -266,8 +273,16 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr(weak_from_this()); - return manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); + eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } HILOG_INFO("Start ability come, ability is %{public}s, userId is %{public}d", want.GetElement().GetAbilityName().c_str(), userId); if (CheckIfOperateRemote(want)) { HILOG_INFO("AbilityManagerService::StartAbility. try to StartRemoteAbility"); - return StartRemoteAbility(want, requestCode); + eventInfo.errCode = StartRemoteAbility(want, requestCode); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + return eventInfo.errCode; } return StartAbilityInner(want, callerToken, requestCode, -1, userId); } @@ -378,18 +397,30 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability setting."); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t validUserId = GetValidUserId(userId); if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -397,6 +428,8 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett auto result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId); if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } auto abilityInfo = abilityRequest.abilityInfo; @@ -406,11 +439,15 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } @@ -418,6 +455,8 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (abilityInfo.type == AppExecFwk::AbilityType::DATA) { HILOG_ERROR("Cannot start data ability, use 'AcquireDataAbility()' instead."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -427,21 +466,29 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett HILOG_ERROR("StartAbility: App data ability preloading failed, '%{public}s', %{public}d", abilityInfo.bundleName.c_str(), result); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } } #ifdef SUPPORT_GRAPHICS if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } #endif if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { + eventInfo.errCode = ERR_WOULD_BLOCK; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } auto missionListManager = GetListManagerByUserId(validUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } return missionListManager->StartAbility(abilityRequest); @@ -452,18 +499,30 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Start ability options."); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t validUserId = GetValidUserId(userId); if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -471,6 +530,8 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st auto result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId); if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } @@ -481,16 +542,22 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -500,11 +567,15 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("StartAbility: App data ability preloading failed, '%{public}s', %{public}d", abilityInfo.bundleName.c_str(), result); + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return result; } } if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { + eventInfo.errCode = ERR_WOULD_BLOCK; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); @@ -513,6 +584,8 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st auto missionListManager = GetListManagerByUserId(validUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } return missionListManager->StartAbility(abilityRequest); @@ -556,18 +629,30 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &token, int resultCode, const Want *resultWant) { - return TerminateAbilityWithFlag(token, resultCode, resultWant, true); + AAFWK::EventInfo eventInfo; + auto abilityRecord = Token::GetAbilityRecordByToken(token); + auto eventInfo.userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE; + eventInfo.bundleName = resultWant.GetElement().GetBundleName(); + eventInfo.moduleName = resultWant.GetElement().GetModuleName(); + eventInfo.abilityName = resultWant.GetElement().GetAbilityName(); + eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::CloseAbility(const sptr &token, int resultCode, const Want *resultWant) { + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -947,6 +1069,12 @@ int AbilityManagerService::ConnectAbility( HILOG_INFO("Connect ability called."); CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); + AAFWK::EventInfo eventInfo; + eventInfo.userId = userId; + eventInfo.bundleName = want.GetElement().GetBundleName(); + eventInfo.moduleName = want.GetElement().GetModuleName(); + eventInfo.abilityName = want.GetElement().GetAbilityName(); + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); @@ -1001,6 +1129,8 @@ int AbilityManagerService::DisconnectAbility(const sptr &con DisconnectLocalAbility(connect); DisconnectRemoteAbility(connect->AsObject()); + AAFWK::EventInfo eventInfo; + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -3979,6 +4109,9 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, } abilityRecord->ProcessForegroundAbility(flag); + AAFWK::EventInfo eventInfo; + eventInfo.sceneFlag = flag; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -3993,6 +4126,9 @@ int AbilityManagerService::DoAbilityBackground(const sptr &token, abilityRecord->lifeCycleStateInfo_.sceneFlag = flag; int ret = MinimizeAbility(token); abilityRecord->lifeCycleStateInfo_.sceneFlag = SCENE_FLAG_NORMAL; + AAFWK::EventInfo eventInfo; + eventInfo.sceneFlag = flag; + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); return ret; } diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index ac7ad35a..d0edd44a 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -30,7 +30,6 @@ group("appms_target") { ohos_shared_library("libappms") { sources = [ - "${services_path}/common/src/event_report.cpp", "src/ability_running_record.cpp", "src/ams_mgr_scheduler.cpp", "src/app_death_recipient.cpp", diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 032e2bd2..9bca46d2 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -37,24 +37,14 @@ const std::string DISCONNECT_SERVICE_ERROR = "DISCONNECT_SERVICE_ERROR"; // ability behavior event const std::string START_ABILITY = "START_ABILITY"; const std::string TERMINATE_ABILITY = "TERMINATE_ABILITY"; +const std::string CLOSE_ABILITY = "CLOSE_ABILITY"; const std::string DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; -const std::string ABILITY_ONSTART = "ABILITY_ONSTART"; -const std::string ABILITY_ONSTOP = "ABILITY_ONSTOP"; -const std::string ABILITY_ONFOREGROUND = "ABILITY_ONFOREGROUND"; -const std::string ABILITY_ONBACKGROUND = "ABILITY_ONBACKGROUND"; -const std::string ABILITY_WINDOWSTAGE_CREATE = "ABILITY_WINDOWSTAGE_CREATE"; -const std::string ABILITY_WINDOWSTAGE_DESTORY = "ABILITY_WINDOWSTAGE_DESTORY"; // serviceExtensionAbility behavior event const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; const std::string DISCONNECT_SERVICE_EXTENSION = "DISCONNECT_SERVICE_EXTENSION"; -const std::string SERVICE_EXTENSION_ONSTART = "SERVICE_EXTENSION_ONSTART"; -const std::string SERVICE_EXTENSION_ONSTOP = "SERVICE_EXTENSION_ONSTOP"; -const std::string SERVICE_EXTENSION_ONCONNECT = "SERVICE_EXTENSION_ONCONNECT"; -const std::string SERVICE_EXTENSION_ONDISCONNECT = "SERVICE_EXTENSION_ONDISCONNECT"; -const std::string SERVICE_EXTENSION_ONREQUEST = "SERVICE_EXTENSION_ONREQUEST"; // form behavior event const std::string ADD_FORM = "ADD_FORM"; const std::string REQUEST_FORM = "REQUEST_FORM"; @@ -66,12 +56,6 @@ const std::string ROUTE_EVENT_FORM = "ROUTE_EVENT_FORM"; const std::string RELEASE_FORM = "RELEASE_FORM"; const std::string DELETE_INVALID_FORM = "DELETE_INVALID_FORM"; const std::string SET_NEXT_REFRESH_TIME_FORM = "SET_NEXT_REFRESH_TIME_FORM"; -const std::string FORM_LIFECYCLE_ONCREATE = "FORM_LIFECYCLE_ONCREATE"; -const std::string FORM_LIFECYCLE_ONDESTROY = "FORM_LIFECYCLE_ONDESTROY"; -const std::string FORM_LIFECYCLE_ONUPDATE = "FORM_LIFECYCLE_ONUPDATE"; -const std::string FORM_LIFECYCLE_EVENT = "FORM_LIFECYCLE_EVENT"; -const std::string FORM_LIFECYCLE_ONCASTTEMPFORM = "FORM_LIFECYCLE_ONCASTTEMPFORM"; -const std::string FORM_LIFECYCLE_ONACQUIREFORMSTATE = "FORM_LIFECYCLE_ONACQUIREFORMSTATE"; // app behavior event const std::string APP_ATTACH = "APP_ATTACH"; const std::string APP_LAUNCH = "APP_LAUNCH"; @@ -93,8 +77,10 @@ struct EventInfo { int64_t timeStamp = 0; int64_t formId = -1; uint32_t versionCode = 0; + uint32_t sceneFlag = -1; std::string versionName; std::string bundleName; + std::string moduleName; std::string abilityName; // olny used in fault event @@ -107,8 +93,10 @@ struct EventInfo { timeStamp = 0; formId =-1; versionCode = 0; + sceneFlag = -1; versionName.clear(); bundleName.clear(); + moduleName.clear(); abilityName.clear(); errCode = ERR_OK; } @@ -119,9 +107,6 @@ public: static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); static void SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - template - static void EventWrite(const std::string &eventName, - HiSysEventType type, Types... keyValues); }; } // namespace AAFWK } // namespace OHOS diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index ea285d42..28afc565 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -19,33 +19,32 @@ #include +using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; + namespace OHOS { namespace AAFWK { namespace { // event params +const std::string TYPE = "TYPE"; const std::string EVENT_KEY_PID = "PID"; -const std::string EVENT_KEY_UID = "UID"; -const std::string EVENT_KEY_RID = "RID"; -const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; -const std::string EVENT_KEY_ABILITY_TYPE = "ABILITY_TYPE"; -const std::string EVENT_KEY_MODEL_TYPE = "MODEL_TYPE"; +const std::string EVENT_KEY_USERID = "USERID"; +const std::string EVENT_KEY_FORM_ID = "FORM_ID"; +const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; +const std::string EVENT_KEY_ERROR_CODE = "ERROR_CODE"; +const std::string EVENT_KEY_SCENE_FLAG = "SCENE_FLAG"; const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; -const std::string EVENT_KEY_DEVICEID = "DEVICEID"; -const std::string EVENT_KEY_URI = "URI"; -const std::string EVENT_KEY_ACTION = "ACTION"; -const std::string EVENT_KEY_APP_NAME = "APP_NAME"; +const std::string EVENT_KEY_MODULE_NAME = "MODULE_NAME"; +const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; -const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; -const std::string EVENT_KEY_FORM_ID = "FORM_ID"; -const std::string TYPE = "TYPE"; } void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { - EventReport::EventWrite( + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, - type, + static_cast(type), EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_VERSION_NAME, eventInfo.versionName, EVENT_KEY_VERSION_CODE, eventInfo.versionCode, @@ -55,39 +54,41 @@ void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { - EventReport::EventWrite( + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, - type, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + static_cast(type), + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); } void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { - EventReport::EventWrite( + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, - type, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + static_cast(type), + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); } void EventReport::SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { - EventReport::EventWrite( + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, - type, - EVENT_KEY_ABILITY_NAME, eventInfo.formId); -} - -template -void EventReport::EventWrite( - const std::string &eventName, - HiSysEventType type, - Types... keyValues) -{ - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - keyValues...); + static_cast(type), + EVENT_KEY_ABILITY_NAME, eventInfo.formId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } } // namespace AAFWK } // namespace OHOS \ No newline at end of file From 3e0c03b700b0ab5f2cab7d7508896617323234ea Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 17:08:38 +0800 Subject: [PATCH 31/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Icba0bdcbd0608abb8e2d62c54892c674f190edc0 --- .../abilitymgr/src/ability_manager_client.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index bcf5c296..fc1cecdb 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -101,7 +101,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, in HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - return ret = abms->StartAbility(want, userId, requestCode); + return abms->StartAbility(want, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility( @@ -112,7 +112,7 @@ ErrCode AbilityManagerClient::StartAbility( CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Start ability come, ability:%{public}s, userId:%{public}d.", want.GetElement().GetAbilityName().c_str(), userId); - return ret = abms->StartAbility(want, callerToken, userId, requestCode); + return abms->StartAbility(want, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartSetting &abilityStartSetting, @@ -121,7 +121,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const AbilityStartS HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - return ret = abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); + return abms->StartAbility(want, abilityStartSetting, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions &startOptions, @@ -132,7 +132,7 @@ ErrCode AbilityManagerClient::StartAbility(const Want &want, const StartOptions CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), userId); - return ret = abms->StartAbility(want, startOptions, callerToken, userId, requestCode); + return abms->StartAbility(want, startOptions, callerToken, userId, requestCode); } ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr &callerToken, @@ -142,7 +142,7 @@ ErrCode AbilityManagerClient::StartExtensionAbility(const Want &want, const sptr CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("%{public}s come, bundleName=%{public}s, abilityName=%{public}s, userId=%{public}d.", __func__, want.GetElement().GetAbilityName().c_str(), want.GetElement().GetBundleName().c_str(), userId); - return ret = abms->StartExtensionAbility(want, callerToken, userId, extensionType); + return abms->StartExtensionAbility(want, callerToken, userId, extensionType); } ErrCode AbilityManagerClient::StopExtensionAbility(const Want &want, const sptr &callerToken, @@ -160,7 +160,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &token, auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Terminate ability come."); - return ret = abms->TerminateAbility(token, resultCode, resultWant); + return abms->TerminateAbility(token, resultCode, resultWant); } ErrCode AbilityManagerClient::TerminateAbility(const sptr &callerToken, int requestCode) @@ -168,7 +168,7 @@ ErrCode AbilityManagerClient::TerminateAbility(const sptr &caller HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); - return ret = abms->TerminateAbilityByCaller(callerToken, requestCode); + return abms->TerminateAbilityByCaller(callerToken, requestCode); } ErrCode AbilityManagerClient::TerminateAbilityResult(const sptr &token, int startId) @@ -202,7 +202,7 @@ ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptrConnectAbility(want, connect, nullptr, userId); + return abms->ConnectAbility(want, connect, nullptr, userId); } ErrCode AbilityManagerClient::ConnectAbility( @@ -213,7 +213,7 @@ ErrCode AbilityManagerClient::ConnectAbility( CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Connect ability called, bundleName:%{public}s, abilityName:%{public}s, userId:%{public}d.", want.GetElement().GetBundleName().c_str(), want.GetElement().GetAbilityName().c_str(), userId); - return ret = abms->ConnectAbility(want, connect, callerToken, userId); + return abms->ConnectAbility(want, connect, callerToken, userId); } ErrCode AbilityManagerClient::DisconnectAbility(const sptr &connect) @@ -222,7 +222,7 @@ ErrCode AbilityManagerClient::DisconnectAbility(const sptr & auto abms = GetAbilityManager(); CHECK_POINTER_RETURN_NOT_CONNECTED(abms); HILOG_INFO("Disconnect ability begin."); - return ret = abms->DisconnectAbility(connect); + return abms->DisconnectAbility(connect); } sptr AbilityManagerClient::AcquireDataAbility( From 34fb695a64f28fb31e3ac9a9c58034a50bf5d12e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 17:19:11 +0800 Subject: [PATCH 32/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I2fa8d7bd9ca8e7eb5d64db9e096d870bc8d629fb --- form_runtime/BUILD.gn | 2 +- .../src/ability_manager_service.cpp | 45 ++++++++++++------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/form_runtime/BUILD.gn b/form_runtime/BUILD.gn index dfb8eb25..2dbdc59b 100644 --- a/form_runtime/BUILD.gn +++ b/form_runtime/BUILD.gn @@ -165,7 +165,7 @@ ohos_shared_library("fmskit_native") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "form_runtime:form_manager", - "hisysevent_native:libhisysevent", + "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr_standard:samgr_proxy", "utils_base:utils", diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 65c69755..1898e8fb 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -294,7 +294,8 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr(weak_from_this()); - eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); + eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, + CheckIfOperateRemote(want)); AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -648,21 +649,24 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &con DisconnectLocalAbility(connect); DisconnectRemoteAbility(connect->AsObject()); AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, + eventInfo); return ERR_OK; } From ef50c13de0a356e44311b940bc5ec4512e7675c1 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 17:42:27 +0800 Subject: [PATCH 33/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id7b34e933808dcb53c2f3bdfaa899f07da64ccd1 --- .../services/src/form_mgr_service.cpp | 1 + .../native/src/ability_runtime/js_ability.cpp | 1 - .../src/ability_manager_service.cpp | 40 ++++++++----------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index 1bc1d608..06ed00ee 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -40,6 +40,7 @@ #include "permission_verification.h" #include "string_ex.h" #include "system_ability_definition.h" +#include "event_report.h" namespace OHOS { namespace AppExecFwk { diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp index a710f3af..153a58e7 100644 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability.cpp @@ -255,7 +255,6 @@ void JsAbility::onSceneDestroyed() applicationContext->DispatchOnAbilityWindowStageDestroy(jsAbilityObj_); } HILOG_INFO("onSceneDestroyed end, ability is %{public}s.", GetAbilityName().c_str()); - eventInfo); } void JsAbility::OnForeground(const Want &want) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 1898e8fb..b5b2cf28 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -488,13 +488,9 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett } auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { -<<<<<<< HEAD HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); -======= - HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId); ->>>>>>> upstream/master return ERR_INVALID_VALUE; } return missionListManager->StartAbility(abilityRequest); @@ -590,13 +586,9 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st abilityRequest.want.SetParam(Want::PARAM_RESV_WINDOW_MODE, startOptions.GetWindowMode()); auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { -<<<<<<< HEAD HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); -======= - HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId); ->>>>>>> upstream/master return ERR_INVALID_VALUE; } return missionListManager->StartAbility(abilityRequest); @@ -649,7 +641,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &token, in { AAFWK::EventInfo eventInfo; auto abilityRecord = Token::GetAbilityRecordByToken(token); - auto eventInfo.userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE; - eventInfo.bundleName = resultWant.GetElement().GetBundleName(); - eventInfo.moduleName = resultWant.GetElement().GetModuleName(); - eventInfo.abilityName = resultWant.GetElement().GetAbilityName(); + eventInfo.userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE; + eventInfo.bundleName = resultWant->GetElement().GetBundleName(); + eventInfo.moduleName = resultWant->GetElement().GetModuleName(); + eventInfo.abilityName = resultWant->GetElement().GetAbilityName(); eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { From fb7c4db60d6181d560b1b9a7f690a7a69f7d4a8f Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 18:04:54 +0800 Subject: [PATCH 34/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ia088cbc8e4eaaee0fc0631b4825dce7531d2cdef --- services/test/moduletest/mission_dump_test/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 22585eef..1f6df35d 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -49,6 +49,7 @@ ohos_moduletest("mission_dump_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", From 3d5d2c8432c5c2dcd32f63e579c885ebed8c1521 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 18:27:59 +0800 Subject: [PATCH 35/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id69bbd7617115c9638a9dc27d492a0eaf1589ecc --- .../test/unittest/phone/mission_list_manager_test/BUILD.gn | 1 + .../test/unittest/phone/specified_mission_list_test/BUILD.gn | 1 + .../test/unittest/phone/start_option_display_id_test/BUILD.gn | 1 + 3 files changed, 3 insertions(+) diff --git a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn index f1c751e2..b939cbea 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("mission_list_manager_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", "//utils/native/base:utils", diff --git a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn index d288050b..6b0e44db 100644 --- a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn @@ -47,6 +47,7 @@ ohos_unittest("specified_mission_list_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", "//utils/native/base:utils", diff --git a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn index 60e003e3..d6ef11a4 100644 --- a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn @@ -50,6 +50,7 @@ ohos_unittest("start_option_display_id_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", From 6617c4cae94d7c7be67f1d1cab92b765643bb08a Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 18:40:45 +0800 Subject: [PATCH 36/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Iac6e0aaa4d49aafee39a50ed04bd63690d4f65c5 --- services/abilitymgr/test/BUILD.gn | 1 + .../test/unittest/phone/mission_list_manager_test/BUILD.gn | 1 - .../test/unittest/phone/specified_mission_list_test/BUILD.gn | 1 - .../test/unittest/phone/start_option_display_id_test/BUILD.gn | 1 - 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/services/abilitymgr/test/BUILD.gn b/services/abilitymgr/test/BUILD.gn index d4ec3cfe..fc2de77e 100644 --- a/services/abilitymgr/test/BUILD.gn +++ b/services/abilitymgr/test/BUILD.gn @@ -58,6 +58,7 @@ ohos_source_set("abilityms_test_source") { "${services_path}/abilitymgr/src/want_sender_proxy.cpp", "${services_path}/abilitymgr/src/want_sender_stub.cpp", "${services_path}/abilitymgr/src/wants_info.cpp", + "${services_path}/common/src/event_report.cpp", ] include_dirs = [ diff --git a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn index b939cbea..f1c751e2 100644 --- a/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/mission_list_manager_test/BUILD.gn @@ -47,7 +47,6 @@ ohos_unittest("mission_list_manager_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", "//utils/native/base:utils", diff --git a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn index 6b0e44db..d288050b 100644 --- a/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/specified_mission_list_test/BUILD.gn @@ -47,7 +47,6 @@ ohos_unittest("specified_mission_list_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "${services_path}/common:perm_verification", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", "//utils/native/base:utils", diff --git a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn index d6ef11a4..60e003e3 100644 --- a/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/start_option_display_id_test/BUILD.gn @@ -50,7 +50,6 @@ ohos_unittest("start_option_display_id_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", From 4a36a196d47ecfa0525f5bcff83a79a1f6daa1c4 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 19:02:41 +0800 Subject: [PATCH 37/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I98c63d311b727f8319c0686533c7b92c66c20051 --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 - .../common/ams/specified_ability_service_test/BUILD.gn | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index 815779f2..e575c67e 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -57,7 +57,6 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", - "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn index 5866e352..ffcd0491 100644 --- a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn @@ -59,6 +59,7 @@ ohos_moduletest("specified_ability_service_test") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", From 29514113bb744e15d1e656fbba6b65f052a288cb Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 19:26:44 +0800 Subject: [PATCH 38/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I8dc2c69440e2005b63e279f8cdd6cf2e832f110b --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index e575c67e..815779f2 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", + "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] From 42a2e2aca852fb7dae35630e7f7d10ebbd278d1e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 20:15:32 +0800 Subject: [PATCH 39/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I745310b7d7da1ba396360be6d5afbf49c470aaf0 --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 2 +- services/test/moduletest/on_new_want_module_test/BUILD.gn | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index 815779f2..1d82646f 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -27,6 +27,7 @@ ohos_unittest("ability_manager_client_test") { sources = [ "${services_path}/abilitymgr/src/ability_manager_client.cpp", + "${services_path}/common/src/event_report.cpp", "ability_manager_client_test.cpp", ] @@ -45,7 +46,6 @@ ohos_unittest("ability_manager_client_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", diff --git a/services/test/moduletest/on_new_want_module_test/BUILD.gn b/services/test/moduletest/on_new_want_module_test/BUILD.gn index 61329d0d..3e27178a 100644 --- a/services/test/moduletest/on_new_want_module_test/BUILD.gn +++ b/services/test/moduletest/on_new_want_module_test/BUILD.gn @@ -33,6 +33,7 @@ ohos_moduletest("on_new_want_module_test") { "${aafwk_path}/services/abilitymgr/src/mission_list.cpp", "${aafwk_path}/services/abilitymgr/src/mission_list_manager.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", + "${aafwk_path}/services/common/src/event_report.cpp", "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", ] From f5562ade73dbf1c8f44136c62fc665dc14c24a34 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 20:57:26 +0800 Subject: [PATCH 40/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I0e8cc910e29b082508f0cbd042b75bb17d3e8d84 --- services/test/moduletest/mission_dump_test/BUILD.gn | 2 +- services/test/moduletest/on_new_want_module_test/BUILD.gn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 1f6df35d..025dbf00 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -30,6 +30,7 @@ ohos_moduletest("mission_dump_test") { sources = [ "mission_dump_test.cpp" ] sources += [ "${aafwk_path}/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp", + "${aafwk_path}/services/common/src/event_report.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", ] @@ -49,7 +50,6 @@ ohos_moduletest("mission_dump_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", - "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", diff --git a/services/test/moduletest/on_new_want_module_test/BUILD.gn b/services/test/moduletest/on_new_want_module_test/BUILD.gn index 3e27178a..5c112d28 100644 --- a/services/test/moduletest/on_new_want_module_test/BUILD.gn +++ b/services/test/moduletest/on_new_want_module_test/BUILD.gn @@ -32,8 +32,8 @@ ohos_moduletest("on_new_want_module_test") { "${aafwk_path}/services/abilitymgr/src/ability_manager_service.cpp", "${aafwk_path}/services/abilitymgr/src/mission_list.cpp", "${aafwk_path}/services/abilitymgr/src/mission_list_manager.cpp", - "${aafwk_path}/services/common/src/permission_verification.cpp", "${aafwk_path}/services/common/src/event_report.cpp", + "${aafwk_path}/services/common/src/permission_verification.cpp", "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", ] From 89b1b2f3fc46cbf861ac6c966f0d6b40b1397634 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 21:19:36 +0800 Subject: [PATCH 41/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id1d51857f903b75109dd5c9464bae6099164d44d --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 1 + services/test/moduletest/mission_dump_test/BUILD.gn | 1 + 2 files changed, 2 insertions(+) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index 1d82646f..9c3730de 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -57,6 +57,7 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 025dbf00..3f4ed0f5 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -62,6 +62,7 @@ ohos_moduletest("mission_dump_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] From 3a7e2416988b3326892f4b4118d6bb437020525e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 21:47:57 +0800 Subject: [PATCH 42/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I7c945491a866e7037f8dec7360c9c3da3556b220 --- .../test/unittest/phone/ability_manager_client_test/BUILD.gn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn index 9c3730de..815779f2 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/BUILD.gn @@ -27,7 +27,6 @@ ohos_unittest("ability_manager_client_test") { sources = [ "${services_path}/abilitymgr/src/ability_manager_client.cpp", - "${services_path}/common/src/event_report.cpp", "ability_manager_client_test.cpp", ] @@ -46,6 +45,7 @@ ohos_unittest("ability_manager_client_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", @@ -57,7 +57,6 @@ ohos_unittest("ability_manager_client_test") { "ability_base:zuri", "access_token:libaccesstoken_sdk", "dsoftbus_standard:softbus_client", - "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", From 50affdf691531c2b524cb92b24efa8d9e708258e Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Wed, 25 May 2022 22:04:39 +0800 Subject: [PATCH 43/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Id8e352678718a00217b5a88da4deb2b9e7674521 --- services/test/moduletest/mission_dump_test/BUILD.gn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/test/moduletest/mission_dump_test/BUILD.gn b/services/test/moduletest/mission_dump_test/BUILD.gn index 3f4ed0f5..1f6df35d 100644 --- a/services/test/moduletest/mission_dump_test/BUILD.gn +++ b/services/test/moduletest/mission_dump_test/BUILD.gn @@ -30,7 +30,6 @@ ohos_moduletest("mission_dump_test") { sources = [ "mission_dump_test.cpp" ] sources += [ "${aafwk_path}/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp", - "${aafwk_path}/services/common/src/event_report.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", "//foundation/distributedhardware/devicemanager/test/unittest/mock/parameter.cpp", ] @@ -50,6 +49,7 @@ ohos_moduletest("mission_dump_test") { "${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock", "${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock", + "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/libpng:libpng", @@ -62,7 +62,6 @@ ohos_moduletest("mission_dump_test") { "access_token:libaccesstoken_sdk", "common_event_service:cesfwk_innerkits", "dsoftbus_standard:softbus_client", - "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] From e714017a36d8e5c8239408f5cd86a22c49bbb074 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 01:26:58 +0800 Subject: [PATCH 44/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I153d2151a4eb0d936b7bf96944076e873a79720e --- form_runtime/hisysevent.yaml | 20 +- .../services/src/form_mgr_service.cpp | 21 ++- hisysevent.yaml | 64 +++---- .../include/ability_manager_service.h | 1 + .../src/ability_manager_service.cpp | 172 ++++++++++++------ services/appmgr/src/app_mgr_service_inner.cpp | 17 +- services/common/BUILD.gn | 1 - services/common/include/event_report.h | 29 ++- services/common/src/event_report.cpp | 157 ++++++++++++---- .../specified_ability_service_test/BUILD.gn | 3 +- 10 files changed, 318 insertions(+), 167 deletions(-) diff --git a/form_runtime/hisysevent.yaml b/form_runtime/hisysevent.yaml index 99ca33f8..e9ef7627 100644 --- a/form_runtime/hisysevent.yaml +++ b/form_runtime/hisysevent.yaml @@ -16,53 +16,53 @@ domain: AAFWK # form behavior event ADD_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} REQUEST_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DELETE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} CASTTEMP_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} ACQUIREFORMSTATE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} MESSAGE_EVENT_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} ROUTE_EVENT_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} RELEASE_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} DELETE_INVALID_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} SET_NEXT_REFRESH_TIME_FORM: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: form manager} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: form manager} FORM_ID: {type: INT64, desc: formId} \ No newline at end of file diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index 06ed00ee..04e8968e 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -41,6 +41,7 @@ #include "string_ex.h" #include "system_ability_definition.h" #include "event_report.h" +#include "hisysevent.h" namespace OHOS { namespace AppExecFwk { @@ -97,7 +98,7 @@ int FormMgrService::AddForm(const int64_t formId, const Want &want, eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (ret != ERR_OK) { HILOG_ERROR("%{public}s fail, add form permission denied", __func__); return ret; @@ -120,7 +121,7 @@ int FormMgrService::DeleteForm(const int64_t formId, const sptr & } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteForm(formId, callerToken); } @@ -141,7 +142,7 @@ int FormMgrService::ReleaseForm(const int64_t formId, const sptr } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().ReleaseForm(formId, callerToken, delCache); } @@ -191,7 +192,7 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RequestForm(formId, callerToken, want); } @@ -208,7 +209,7 @@ int FormMgrService::SetNextRefreshTime(const int64_t formId, const int64_t nextT HILOG_INFO("%{public}s called.", __func__); AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().SetNextRefreshTime(formId, nextTime); } @@ -248,7 +249,7 @@ int FormMgrService::CastTempForm(const int64_t formId, const sptr } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().CastTempForm(formId, callerToken); } @@ -335,7 +336,7 @@ int FormMgrService::MessageEvent(const int64_t formId, const Want &want, const s eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().MessageEvent(formId, want, callerToken); } @@ -358,7 +359,7 @@ int FormMgrService::RouterEvent(const int64_t formId, Want &want) eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RouterEvent(formId, want); } @@ -531,7 +532,7 @@ int FormMgrService::DeleteInvalidForms(const std::vector &formIds, cons return ret; } AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -554,7 +555,7 @@ int FormMgrService::AcquireFormState(const Want &want, const sptr eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().AcquireFormState(want, callerToken, stateInfo); } diff --git a/hisysevent.yaml b/hisysevent.yaml index a049f634..5b533a36 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -49,11 +49,11 @@ THREAD_BLOCK_6S: # fault event START_ABILITY_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start ability error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: start ability error} ABILITY_NAME: {type: STRING, desc: ability name} TERMINATE_ABILITY_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: terminate ability error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: terminate ability error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -61,7 +61,7 @@ TERMINATE_ABILITY_ERROR: ABILITY_NAME: {type: STRING, desc: ability name} START_EXTENSION_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: start extensionAbility error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: start extensionAbility error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -69,7 +69,7 @@ START_EXTENSION_ERROR: ABILITY_NAME: {type: STRING, desc: ability name} STOP_EXTENSION_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: stop extensionAbility error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: stop extensionAbility error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -77,7 +77,7 @@ STOP_EXTENSION_ERROR: ABILITY_NAME: {type: STRING, desc: ability name} CONNECT_SERVICE_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: connnect serviceExtensionAbility error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: connnect serviceExtensionAbility error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -85,7 +85,7 @@ CONNECT_SERVICE_ERROR: ABILITY_NAME: {type: STRING, desc: ability name} DISCONNECT_SERVICE_ERROR: - __BASE: {type: FAULT, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility error} + __BASE: {type: FAULT, level: MINOR, tag: ability, desc: disconnect serviceExtensionAbility error} USER_ID: {type: INT32, desc: userId} ERROR_CODE: {type: INT32, desc: error code} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -95,30 +95,30 @@ DISCONNECT_SERVICE_ERROR: # ability behavior event START_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start ability} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start ability} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} DO_FOREGROUND_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: foreground ability} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: foreground ability} SCENE_FLAG: {type: STRING, desc: scene flag} DO_BACKGROUND_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: background ability} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: background ability} SCENE_FLAG: {type: STRING, desc: scene flag} CLOSE_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: close ability} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: close ability} TERMINATE_ABILITY: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: terminate ability} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: terminate ability} # serviceExtensionAbility behavior event START_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: start serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start serviceExtensionAbility} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} @@ -126,61 +126,61 @@ START_SERVICE_EXTENSION: EXTENSION_TYPE: {type: STRING, desc: extension type} STOP_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: stop serviceExtensionAbility} + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: stop serviceExtensionAbility} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} EXTENSION_TYPE: {type: STRING, desc: extension type} -CONNECT_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: connect serviceExtensionAbility} +CONNECT_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: connect serviceAbility} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} MODULE_NAME: {type: STRING, desc: module name} ABILITY_NAME: {type: STRING, desc: ability name} -DISCONNECT_SERVICE_EXTENSION: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: disconnect serviceExtensionAbility} +DISCONNECT_SERVICE: + __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: disconnect serviceAbility} # app behavior event APP_ATTACH: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: attach app} - NAME: {type: STRING, desc: application name} + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: attach app} + BUNDLE_NAME: {type: STRING, desc: bundle name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} - PROCESS: {type: STRING, desc: process} + PID: {type: INT32, desc: pid} TIME_STAMP: {type: INT32, desc: time stamp} APP_LAUNCH: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: launch app} - NAME: {type: STRING, desc: application name} + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: launch app} + BUNDLE_NAME: {type: STRING, desc: bundle name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} - PROCESS: {type: STRING, desc: process} + PID: {type: INT32, desc: pid} TIME_STAMP: {type: INT32, desc: time stamp} APP_FOREGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: foreground app} - NAME: {type: STRING, desc: application name} + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: foreground app} + BUNDLE_NAME: {type: STRING, desc: bundle name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} - PROCESS: {type: STRING, desc: process} + PID: {type: INT32, desc: pid} TIME_STAMP: {type: INT32, desc: time stamp} APP_BACKGROUND: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: background app} - NAME: {type: STRING, desc: application name} + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: background app} + BUNDLE_NAME: {type: STRING, desc: bundle name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} - PROCESS: {type: STRING, desc: process} + PID: {type: INT32, desc: pid} TIME_STAMP: {type: INT32, desc: time stamp} APP_TERMINATE: - __BASE: {type: BEHAVIOR, level: MINOR, tag: IDENTIFICATION, desc: terminate app} - NAME: {type: STRING, desc: application name} + __BASE: {type: BEHAVIOR, level: MINOR, tag: app, desc: terminate app} + BUNDLE_NAME: {type: STRING, desc: bundle name} VERSION_NAME: {type: STRING, desc: version name} VERSION_CODE: {type: INT32, desc: version code} - PROCESS: {type: STRING, desc: process} + PID: {type: INT32, desc: pid} TIME_STAMP: {type: INT32, desc: time stamp} \ No newline at end of file diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 6d6755f8..3687b618 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1016,6 +1016,7 @@ private: const sptr &callerToken, int32_t userId); int CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest, int32_t validUserId, AppExecFwk::ExtensionAbilityType extensionType); + std::string GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType); constexpr static int REPOLL_TIME_MICRO_SECONDS = 1000000; constexpr static int WAITING_BOOT_ANIMATION_TIMER = 5; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index b5b2cf28..194605d2 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -57,6 +57,7 @@ #include "xcollie/watchdog.h" #include "parameter.h" #include "event_report.h" +#include "hisysevent.h" #ifdef SUPPORT_GRAPHICS #include "display_manager.h" @@ -263,8 +264,13 @@ int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int re eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); - return StartAbilityInner(want, nullptr, requestCode, -1, userId); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + int32_t ret = StartAbilityInner(want, nullptr, requestCode, -1, userId); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::StartAbility(const Want &want, const sptr &callerToken, @@ -277,11 +283,11 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr(weak_from_this()); eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -305,10 +311,15 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr &callerToken, @@ -403,18 +414,18 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); @@ -422,7 +433,7 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -431,7 +442,7 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } auto abilityInfo = abilityRequest.abilityInfo; @@ -442,14 +453,14 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } @@ -458,7 +469,7 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (abilityInfo.type == AppExecFwk::AbilityType::DATA) { HILOG_ERROR("Cannot start data ability, use 'AcquireDataAbility()' instead."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -469,7 +480,7 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett abilityInfo.bundleName.c_str(), result); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } } @@ -477,23 +488,28 @@ int AbilityManagerService::StartAbility(const Want &want, const AbilityStartSett if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } #endif if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { eventInfo.errCode = ERR_WOULD_BLOCK; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } - return missionListManager->StartAbility(abilityRequest); + int32_t ret = missionListManager->StartAbility(abilityRequest); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::StartAbility(const Want &want, const StartOptions &startOptions, @@ -506,18 +522,18 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); @@ -525,7 +541,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -534,7 +550,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } @@ -546,21 +562,21 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -571,14 +587,14 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st abilityInfo.bundleName.c_str(), result); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } } if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { eventInfo.errCode = ERR_WOULD_BLOCK; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); @@ -588,10 +604,15 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } - return missionListManager->StartAbility(abilityRequest); + int32_t ret = missionListManager->StartAbility(abilityRequest); + if (ret != ERR_OK) { + eventInfo.errCode = ret; + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + } + return ret; } int AbilityManagerService::CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest, @@ -637,11 +658,12 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &token, in eventInfo.moduleName = resultWant->GetElement().GetModuleName(); eventInfo.abilityName = resultWant->GetElement().GetAbilityName(); eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, AAFWK::HiSysEventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); } return eventInfo.errCode; } @@ -842,7 +865,7 @@ int AbilityManagerService::TerminateAbility(const sptr &token, in int AbilityManagerService::CloseAbility(const sptr &token, int resultCode, const Want *resultWant) { AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -1090,7 +1113,7 @@ int AbilityManagerService::ConnectAbility( eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { @@ -1147,7 +1170,7 @@ int AbilityManagerService::DisconnectAbility(const sptr &con DisconnectLocalAbility(connect); DisconnectRemoteAbility(connect->AsObject()); AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_EXTENSION, AAFWK::HiSysEventType::BEHAVIOR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -4057,7 +4080,7 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, abilityRecord->ProcessForegroundAbility(flag); AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -4074,7 +4097,7 @@ int AbilityManagerService::DoAbilityBackground(const sptr &token, abilityRecord->lifeCycleStateInfo_.sceneFlag = SCENE_FLAG_NORMAL; AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return ret; } @@ -4615,6 +4638,49 @@ int AbilityManagerService::DumpAbilityInfoDone(std::vector &infos, return ERR_OK; } +std::string AbilityManagerService::GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType) +{ + std::string extensionTypeStr; + if (extensionType == AppExecFwk::ExtensionAbilityType::FORM) + { + extensionTypeStr = "FOMR"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::WORK_SCHEDULER) + { + extensionTypeStr = "WORK_SCHEDULER"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::INPUTMETHOD) + { + extensionTypeStr = "INPUTMETHOD"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::SERVICE) + { + extensionTypeStr = "SERVICE"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::ACCESSIBILITY) + { + extensionTypeStr = "ACCESSIBILITY"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::DATASHARE) + { + extensionTypeStr = "DATASHARE"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::FILESHARE) + { + extensionTypeStr = "FILESHARE"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::STATICSUBSCRIBER) + { + extensionTypeStr = "STATICSUBSCRIBER"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::WALLPAPER) + { + extensionTypeStr = "WALLPAPER"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::BACKUP) + { + extensionTypeStr = "BACKUP"; + } else if (extensionType == AppExecFwk::ExtensionAbilityType::WINDOW) + { + extensionTypeStr = "WINDOW"; + } else + { + extensionTypeStr = "UNSPECIFIED"; + } + return extensionTypeStr; +} + #ifdef SUPPORT_GRAPHICS int AbilityManagerService::SetMissionLabel(const sptr &token, const std::string &label) { diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 34a02568..fe95a59d 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -50,6 +50,7 @@ #endif #include "uri_permission_manager_client.h" #include "event_report.h" +#include "hisysevent.h" namespace OHOS { namespace AppExecFwk { @@ -279,7 +280,7 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptr(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -324,7 +325,7 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptr(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -368,7 +369,7 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -398,7 +399,7 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -428,9 +429,6 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) OnAppStateChanged(appRecord, ApplicationState::APP_STATE_TERMINATED); appRunningManager_->RemoveAppRunningRecordById(recordId); RemoveAppFromRecentListById(recordId); - DelayedSingleton::GetInstance()->OnProcessDied(appRecord); - - HILOG_INFO("application is terminated"); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); @@ -440,7 +438,10 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, AAFWK::HiSysEventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + DelayedSingleton::GetInstance()->OnProcessDied(appRecord); + + HILOG_INFO("application is terminated"); } int32_t AppMgrServiceInner::KillApplication(const std::string &bundleName) diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 3a182fc0..648d4394 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -52,7 +52,6 @@ ohos_shared_library("perm_verification") { ] external_deps = [ - "ability_base:want", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", "hisysevent_native:libhisysevent", diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 9bca46d2..fdf593f0 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -19,14 +19,12 @@ #include #include -#include "application_info.h" -#include "want.h" #include "errors.h" +#include "hisysevent.h" namespace OHOS { namespace AAFWK { namespace { -// event type // fault event const std::string START_ABILITY_ERROR = "START_ABILITY_ERROR"; const std::string TERMINATE_ABILITY_ERROR = "TERMINATE_ABILITY_ERROR"; @@ -43,8 +41,8 @@ const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; // serviceExtensionAbility behavior event const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; -const std::string CONNECT_SERVICE_EXTENSION = "CONNECT_SERVICE_EXTENSION"; -const std::string DISCONNECT_SERVICE_EXTENSION = "DISCONNECT_SERVICE_EXTENSION"; +const std::string CONNECT_SERVICE = "CONNECT_SERVICE"; +const std::string DISCONNECT_SERVICE = "DISCONNECT_SERVICE"; // form behavior event const std::string ADD_FORM = "ADD_FORM"; const std::string REQUEST_FORM = "REQUEST_FORM"; @@ -64,13 +62,6 @@ const std::string APP_BACKGROUND = "APP_BACKGROUND"; const std::string APP_TERMINATE = "APP_TERMINATE"; } -enum HiSysEventType { - FAULT = 1, - STATISTIC = 2, - SECURITY = 3, - BEHAVIOR = 4, -}; - struct EventInfo { int32_t pid = -1; int32_t userId = -1; @@ -82,6 +73,7 @@ struct EventInfo { std::string bundleName; std::string moduleName; std::string abilityName; + std::string extensionType; // olny used in fault event ErrCode errCode = ERR_OK; @@ -98,15 +90,20 @@ struct EventInfo { bundleName.clear(); moduleName.clear(); abilityName.clear(); + extensionType.clear(); errCode = ERR_OK; } }; class EventReport { public: - static void SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); + static void SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo); + static void SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo); + static void SendExtensionEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo); + static void SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo); }; } // namespace AAFWK } // namespace OHOS diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 28afc565..7b5bfad2 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -19,8 +19,6 @@ #include -using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; - namespace OHOS { namespace AAFWK { namespace { @@ -37,14 +35,16 @@ const std::string EVENT_KEY_MODULE_NAME = "MODULE_NAME"; const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_EXTENSION_TYPE = "EXTENSION_TYPE"; } -void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +void EventReport::SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo) { - HiSysEvent::Write( - HiSysEvent::Domain::AAFWK, + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, - static_cast(type), + type, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_VERSION_NAME, eventInfo.versionName, EVENT_KEY_VERSION_CODE, eventInfo.versionCode, @@ -52,43 +52,128 @@ void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type EVENT_KEY_TIME_STAMP, eventInfo.timeStamp); } -void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo) { - HiSysEvent::Write( - HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - EVENT_KEY_USERID, eventInfo.userId, - EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag, - EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, - EVENT_KEY_MODULE_NAME, eventInfo.moduleName, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, - EVENT_KEY_ERROR_CODE, eventInfo.errCode); + if (eventName == START_ABILITY_ERROR | eventName == TERMINATE_ABILITY_ERROR) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); + } else if (eventName == START_ABILITY_ERROR) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag); + } else + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type); + } } -void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo) { - HiSysEvent::Write( - HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - EVENT_KEY_USERID, eventInfo.userId, - EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, - EVENT_KEY_MODULE_NAME, eventInfo.moduleName, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, - EVENT_KEY_ERROR_CODE, eventInfo.errCode); + if (eventName == DISCONNECT_SERVICE) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type); + } else if (eventName ==CONNECT_SERVICE) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType); + } else + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_USERID, eventInfo.userId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_ERROR_CODE, eventInfo.errCode); + } } -void EventReport::SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) +void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + const EventInfo& eventInfo) { - HiSysEvent::Write( - HiSysEvent::Domain::AAFWK, - eventName, - static_cast(type), - EVENT_KEY_ABILITY_NAME, eventInfo.formId, - EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, - EVENT_KEY_MODULE_NAME, eventInfo.moduleName, - EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + if (eventName == DELETE_INVALID_FORM) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type); + } else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.formId, + EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, + EVENT_KEY_MODULE_NAME, eventInfo.moduleName, + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); + } else + { + OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + eventName, + type, + EVENT_KEY_ABILITY_NAME, eventInfo.formId); + } + + } } // namespace AAFWK } // namespace OHOS \ No newline at end of file diff --git a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn index ffcd0491..82c88c23 100644 --- a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn @@ -32,6 +32,7 @@ ohos_moduletest("specified_ability_service_test") { "${aafwk_path}/services/abilitymgr/src/ability_manager_proxy.cpp", "${aafwk_path}/services/abilitymgr/src/ability_manager_service.cpp", "${aafwk_path}/services/abilitymgr/test/mock/libs/sa_mgr/src/sa_mgr_client_mock.cpp", + "${aafwk_path}/services/common/src/event_report.cpp", "${aafwk_path}/services/common/src/permission_verification.cpp", "${aafwk_path}/services/test/mock/src/mock_app_mgr_client.cpp", "${aafwk_path}/services/test/mock/src/mock_bundle_mgr.cpp", @@ -59,7 +60,6 @@ ohos_moduletest("specified_ability_service_test") { "${distributedschedule_path}/safwk/interfaces/innerkits/safwk:system_ability_fwk", "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "${innerkits_path}/uri_permission:uri_permission_mgr", - "${services_path}/common:perm_verification", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", @@ -89,6 +89,7 @@ ohos_moduletest("specified_ability_service_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", From 102e20721eb06e76dfd54fa16cc9855ab643d66d Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 01:58:42 +0800 Subject: [PATCH 45/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I5201f8e58b132701d1bfe5600e827b339cd08407 --- .../services/src/form_mgr_service.cpp | 18 +- .../src/ability_manager_service.cpp | 232 +++++++++++------- services/appmgr/src/app_mgr_service_inner.cpp | 6 +- services/common/BUILD.gn | 1 - services/common/src/event_report.cpp | 29 ++- 5 files changed, 173 insertions(+), 113 deletions(-) diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index 04e8968e..e396c998 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -209,7 +209,8 @@ int FormMgrService::SetNextRefreshTime(const int64_t formId, const int64_t nextT HILOG_INFO("%{public}s called.", __func__); AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().SetNextRefreshTime(formId, nextTime); } @@ -249,7 +250,8 @@ int FormMgrService::CastTempForm(const int64_t formId, const sptr } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().CastTempForm(formId, callerToken); } @@ -336,7 +338,8 @@ int FormMgrService::MessageEvent(const int64_t formId, const Want &want, const s eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().MessageEvent(formId, want, callerToken); } @@ -359,7 +362,8 @@ int FormMgrService::RouterEvent(const int64_t formId, Want &want) eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RouterEvent(formId, want); } @@ -532,7 +536,8 @@ int FormMgrService::DeleteInvalidForms(const std::vector &formIds, cons return ret; } AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -555,7 +560,8 @@ int FormMgrService::AcquireFormState(const Want &want, const sptr eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().AcquireFormState(want, callerToken, stateInfo); } diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 194605d2..b142bd71 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -264,11 +264,13 @@ int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int re eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); int32_t ret = StartAbilityInner(want, nullptr, requestCode, -1, userId); if (ret != ERR_OK) { eventInfo.errCode = ret; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); } return ret; } @@ -283,11 +285,13 @@ int AbilityManagerService::StartAbility(const Want &want, const sptr(weak_from_this()); eventInfo.errCode = manager->FreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -311,13 +316,15 @@ int AbilityManagerService::StartAbility(const Want &want, const sptrStartAbility(abilityRequest); if (ret != ERR_OK) { eventInfo.errCode = ret; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); } return ret; } @@ -522,18 +542,21 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); @@ -541,7 +564,8 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (!JudgeMultiUserConcurrency(validUserId)) { HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -550,7 +574,8 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (result != ERR_OK) { HILOG_ERROR("Generate ability request local error."); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } @@ -562,21 +587,24 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st result = CheckStaticCfgPermission(abilityInfo); if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); if (result != ERR_OK) { HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } if (abilityInfo.type != AppExecFwk::AbilityType::PAGE) { HILOG_ERROR("Only support for page type ability."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -587,14 +615,16 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st abilityInfo.bundleName.c_str(), result); eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } } if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { eventInfo.errCode = ERR_WOULD_BLOCK; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); @@ -604,13 +634,15 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (missionListManager == nullptr) { HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t ret = missionListManager->StartAbility(abilityRequest); if (ret != ERR_OK) { eventInfo.errCode = ret; - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); } return ret; } @@ -659,28 +691,29 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr &token, in eventInfo.moduleName = resultWant->GetElement().GetModuleName(); eventInfo.abilityName = resultWant->GetElement().GetAbilityName(); eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); } return eventInfo.errCode; } @@ -865,7 +907,8 @@ int AbilityManagerService::TerminateAbility(const sptr &token, in int AbilityManagerService::CloseAbility(const sptr &token, int resultCode, const Want *resultWant) { AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -4080,7 +4123,8 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, abilityRecord->ProcessForegroundAbility(flag); AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -4097,7 +4141,8 @@ int AbilityManagerService::DoAbilityBackground(const sptr &token, abilityRecord->lifeCycleStateInfo_.sceneFlag = SCENE_FLAG_NORMAL; AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; - AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); return ret; } @@ -4641,42 +4686,43 @@ int AbilityManagerService::DumpAbilityInfoDone(std::vector &infos, std::string AbilityManagerService::GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType) { std::string extensionTypeStr; - if (extensionType == AppExecFwk::ExtensionAbilityType::FORM) - { - extensionTypeStr = "FOMR"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::WORK_SCHEDULER) - { - extensionTypeStr = "WORK_SCHEDULER"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::INPUTMETHOD) - { - extensionTypeStr = "INPUTMETHOD"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::SERVICE) - { - extensionTypeStr = "SERVICE"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::ACCESSIBILITY) - { - extensionTypeStr = "ACCESSIBILITY"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::DATASHARE) - { - extensionTypeStr = "DATASHARE"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::FILESHARE) - { - extensionTypeStr = "FILESHARE"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::STATICSUBSCRIBER) - { - extensionTypeStr = "STATICSUBSCRIBER"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::WALLPAPER) - { - extensionTypeStr = "WALLPAPER"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::BACKUP) - { - extensionTypeStr = "BACKUP"; - } else if (extensionType == AppExecFwk::ExtensionAbilityType::WINDOW) - { - extensionTypeStr = "WINDOW"; - } else - { - extensionTypeStr = "UNSPECIFIED"; + switch (extensionType){ + case AppExecFwk::ExtensionAbilityType::FORM: + extensionTypeStr = "FOMR"; + break; + case AppExecFwk::ExtensionAbilityType::WORK_SCHEDULER: + extensionTypeStr = "WORK_SCHEDULER"; + break; + case AppExecFwk::ExtensionAbilityType::INPUTMETHOD: + extensionTypeStr = "INPUTMETHOD"; + break; + case AppExecFwk::ExtensionAbilityType::SERVICE: + extensionTypeStr = "SERVICE"; + break; + case AppExecFwk::ExtensionAbilityType::ACCESSIBILITY: + extensionTypeStr = "ACCESSIBILITY"; + break; + case AppExecFwk::ExtensionAbilityType::DATASHARE: + extensionTypeStr = "DATASHARE"; + break; + case AppExecFwk::ExtensionAbilityType::FILESHARE: + extensionTypeStr = "FILESHARE"; + break; + case AppExecFwk::ExtensionAbilityType::STATICSUBSCRIBER: + extensionTypeStr = "STATICSUBSCRIBER"; + break; + case AppExecFwk::ExtensionAbilityType::WALLPAPER: + extensionTypeStr = "WALLPAPER"; + break; + case AppExecFwk::ExtensionAbilityType::BACKUP: + extensionTypeStr = "BACKUP"; + break; + case AppExecFwk::ExtensionAbilityType::WINDOW: + extensionTypeStr = "WINDOW"; + break; + default: + extensionTypeStr = "UNSPECIFIED"; + break; } return extensionTypeStr; } diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index fe95a59d..d4d0998e 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -369,7 +369,8 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -399,7 +400,8 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, + OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 648d4394..f2625c90 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -53,7 +53,6 @@ ohos_shared_library("perm_verification") { external_deps = [ "access_token:libaccesstoken_sdk", - "bundle_framework:appexecfwk_base", "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 7b5bfad2..63751505 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -66,7 +66,8 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_ERROR_CODE, eventInfo.errCode); - } else if (eventName == START_ABILITY_ERROR) + } + else if (eventName == START_ABILITY_ERROR) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -76,14 +77,16 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) + } + else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag); - } else + } + else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -101,7 +104,8 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type); - } else if (eventName ==CONNECT_SERVICE) + } + else if (eventName ==CONNECT_SERVICE) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -111,7 +115,8 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) + } + else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -122,7 +127,8 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType); - } else + } + else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -145,7 +151,8 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type); - } else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) + } + else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -154,7 +161,8 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) + } + else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -164,7 +172,8 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else + } + else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, @@ -172,8 +181,6 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H type, EVENT_KEY_ABILITY_NAME, eventInfo.formId); } - - } } // namespace AAFWK } // namespace OHOS \ No newline at end of file From 2bd5375c8924b9df46ab5d7bce928498cfaa12a0 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 02:17:38 +0800 Subject: [PATCH 46/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I01086b6ec2dbff6e41b2eac805afc48a995cd8ff --- services/test/moduletest/ability_record_test/BUILD.gn | 1 + services/test/moduletest/ability_timeout_module_test/BUILD.gn | 1 + services/test/moduletest/running_infos_module_test/BUILD.gn | 1 + 3 files changed, 3 insertions(+) diff --git a/services/test/moduletest/ability_record_test/BUILD.gn b/services/test/moduletest/ability_record_test/BUILD.gn index 936d4381..eef6540e 100644 --- a/services/test/moduletest/ability_record_test/BUILD.gn +++ b/services/test/moduletest/ability_record_test/BUILD.gn @@ -117,6 +117,7 @@ ohos_moduletest("AbilityRecordModuleTest") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/ability_timeout_module_test/BUILD.gn b/services/test/moduletest/ability_timeout_module_test/BUILD.gn index 76169d21..b0779e03 100644 --- a/services/test/moduletest/ability_timeout_module_test/BUILD.gn +++ b/services/test/moduletest/ability_timeout_module_test/BUILD.gn @@ -117,6 +117,7 @@ ohos_moduletest("ability_timeout_module_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", diff --git a/services/test/moduletest/running_infos_module_test/BUILD.gn b/services/test/moduletest/running_infos_module_test/BUILD.gn index 853fd6a4..f383d0d4 100644 --- a/services/test/moduletest/running_infos_module_test/BUILD.gn +++ b/services/test/moduletest/running_infos_module_test/BUILD.gn @@ -112,6 +112,7 @@ ohos_moduletest("running_infos_module_test") { "dataability:native_dataability", "dsoftbus_standard:softbus_client", "hicollie_native:libhicollie", + "hisysevent_native:libhisysevent", "hitrace_native:hitrace_meter", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", From 30299f849e2e192b223a9eb9a17f2940dd40256b Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 02:45:57 +0800 Subject: [PATCH 47/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: If57b150c096cc04e31f1b3546da2e16d30875c1a --- .../src/ability_manager_service.cpp | 2 +- services/common/src/event_report.cpp | 45 +++++-------------- 2 files changed, 13 insertions(+), 34 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index b142bd71..02129367 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -4686,7 +4686,7 @@ int AbilityManagerService::DumpAbilityInfoDone(std::vector &infos, std::string AbilityManagerService::GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType) { std::string extensionTypeStr; - switch (extensionType){ + switch (extensionType) { case AppExecFwk::ExtensionAbilityType::FORM: extensionTypeStr = "FOMR"; break; diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 63751505..822a063b 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -55,8 +55,7 @@ void EventReport::SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::Hi void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, const EventInfo& eventInfo) { - if (eventName == START_ABILITY_ERROR | eventName == TERMINATE_ABILITY_ERROR) - { + if (eventName == START_ABILITY_ERROR | eventName == TERMINATE_ABILITY_ERROR) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -66,9 +65,7 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_ERROR_CODE, eventInfo.errCode); - } - else if (eventName == START_ABILITY_ERROR) - { + } else if (eventName == START_ABILITY_ERROR) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -77,17 +74,13 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } - else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) - { + } else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag); - } - else - { + } else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -98,15 +91,12 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, const EventInfo& eventInfo) { - if (eventName == DISCONNECT_SERVICE) - { + if (eventName == DISCONNECT_SERVICE) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type); - } - else if (eventName ==CONNECT_SERVICE) - { + } else if (eventName ==CONNECT_SERVICE) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -115,9 +105,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } - else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) - { + } else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -127,9 +115,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType); - } - else - { + } else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -145,15 +131,12 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, const EventInfo& eventInfo) { - if (eventName == DELETE_INVALID_FORM) - { + if (eventName == DELETE_INVALID_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type); - } - else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) - { + } else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -161,9 +144,7 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } - else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) - { + } else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -172,9 +153,7 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } - else - { + } else { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, From e58cd472e97dd931826e7addc5f066d27c5890ab Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 10:21:44 +0800 Subject: [PATCH 48/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Idfb77ceeb719c4298c29568c417098b7cd176ec1 --- .../src/ability_manager_service.cpp | 56 +++++++++++++++---- services/common/src/event_report.cpp | 10 ++-- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 02129367..5119cd63 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -750,7 +750,10 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptrStartAbility(abilityRequest); + eventInfo.errCode = connectManager->StartAbility(abilityRequest); + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + return eventInfo.errCode; } int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr &callerToken, @@ -829,7 +832,11 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptrStopServiceAbility(abilityRequest); + eventInfo.errCode = connectManager->StopServiceAbility(abilityRequest); + AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + eventInfo); + return eventInfo.errCode; } @@ -1161,17 +1168,26 @@ int AbilityManagerService::ConnectAbility( if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); + eventInfo.errCode = CHECK_PERMISSION_FAILED; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } int32_t validUserId = GetValidUserId(userId); std::string localDeviceId; if (!GetLocalDeviceId(localDeviceId)) { HILOG_ERROR("%{public}s: Get Local DeviceId failed", __func__); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } auto manager = std::make_shared(weak_from_this()); int result = manager->IsConnectFreeInstall(want, validUserId, callerToken, localDeviceId); if (result != ERR_OK) { + eventInfo.errCode = result; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return result; } @@ -1186,6 +1202,9 @@ int AbilityManagerService::ConnectAbility( bool queryResult = IN_PROCESS_CALL(bms->QueryExtensionAbilityInfoByUri(uri, validUserId, extensionInfo)); if (!queryResult || extensionInfo.name.empty() || extensionInfo.bundleName.empty()) { HILOG_ERROR("Invalid extension ability info."); + eventInfo.errCode = ERR_INVALID_VALUE; + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } abilityWant.SetElementName(extensionInfo.bundleName, extensionInfo.name); @@ -1193,29 +1212,44 @@ int AbilityManagerService::ConnectAbility( if (CheckIfOperateRemote(abilityWant)) { HILOG_INFO("AbilityManagerService::ConnectAbility. try to ConnectRemoteAbility"); - return ConnectRemoteAbility(abilityWant, connect->AsObject()); + eventInfo.errCode = ConnectRemoteAbility(abilityWant, connect->AsObject()); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + return eventInfo.errCode; } if (callerToken != nullptr && callerToken->GetObjectDescriptor() != u"ohos.aafwk.AbilityToken") { HILOG_INFO("%{public}s invalid Token.", __func__); - return ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); + eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + return eventInfo.errCode; } - return ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); + eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::DisconnectAbility(const sptr &connect) { HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Disconnect ability begin."); - CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); - CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); - - DisconnectLocalAbility(connect); - DisconnectRemoteAbility(connect->AsObject()); AAFWK::EventInfo eventInfo; AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); - return ERR_OK; + CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); + CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); + + eventInfo.errCode = DisconnectLocalAbility(connect); + eventInfo.errCode |= DisconnectRemoteAbility(connect->AsObject()); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + } + return eventInfo.errCode; } int AbilityManagerService::ConnectLocalAbility(const Want &want, const int32_t userId, diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 822a063b..5f034b77 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -55,7 +55,7 @@ void EventReport::SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::Hi void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, const EventInfo& eventInfo) { - if (eventName == START_ABILITY_ERROR | eventName == TERMINATE_ABILITY_ERROR) { + if (eventName == START_ABILITY_ERROR || eventName == TERMINATE_ABILITY_ERROR) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -74,7 +74,7 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == DO_FOREGROUND_ABILITY | eventName == DO_BACKGROUND_ABILITY) { + } else if (eventName == DO_FOREGROUND_ABILITY || eventName == DO_BACKGROUND_ABILITY) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -105,7 +105,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == START_SERVICE_EXTENSION | eventName == STOP_SERVICE_EXTENSION) { + } else if (eventName == START_SERVICE_EXTENSION || eventName == STOP_SERVICE_EXTENSION) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -136,7 +136,7 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, type); - } else if (eventName == ACQUIREFORMSTATE_FORM | eventName == MESSAGE_EVENT_FORM) { + } else if (eventName == ACQUIREFORMSTATE_FORM || eventName == MESSAGE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, @@ -144,7 +144,7 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == ADD_FORM | eventName == REQUEST_FORM | eventName == ROUTE_EVENT_FORM) { + } else if (eventName == ADD_FORM || eventName == REQUEST_FORM || eventName == ROUTE_EVENT_FORM) { OHOS::HiviewDFX::HiSysEvent::Write( OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, eventName, From 2c168643acde594ef0dfb900cafb52e8bed6ecf7 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 11:11:16 +0800 Subject: [PATCH 49/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I741d96c8de1174eb85419f19abcbd6cb6a5b847a --- .../services/src/form_mgr_service.cpp | 20 +-- .../src/ability_manager_service.cpp | 126 +++++++++--------- services/appmgr/src/app_mgr_service_inner.cpp | 10 +- services/common/include/event_report.h | 11 +- services/common/src/event_report.cpp | 60 ++++----- 5 files changed, 115 insertions(+), 112 deletions(-) diff --git a/form_runtime/services/src/form_mgr_service.cpp b/form_runtime/services/src/form_mgr_service.cpp index e396c998..85c77209 100644 --- a/form_runtime/services/src/form_mgr_service.cpp +++ b/form_runtime/services/src/form_mgr_service.cpp @@ -98,7 +98,7 @@ int FormMgrService::AddForm(const int64_t formId, const Want &want, eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::ADD_FORM, HiSysEventType::BEHAVIOR, eventInfo); if (ret != ERR_OK) { HILOG_ERROR("%{public}s fail, add form permission denied", __func__); return ret; @@ -121,7 +121,7 @@ int FormMgrService::DeleteForm(const int64_t formId, const sptr & } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteForm(formId, callerToken); } @@ -142,7 +142,7 @@ int FormMgrService::ReleaseForm(const int64_t formId, const sptr } AAFWK::EventInfo eventInfo; eventInfo.userId = formId; - AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::RELEASE_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().ReleaseForm(formId, callerToken, delCache); } @@ -192,7 +192,7 @@ int FormMgrService::RequestForm(const int64_t formId, const sptr eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendFormEvent(AAFWK::REQUEST_FORM, HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RequestForm(formId, callerToken, want); } @@ -210,7 +210,7 @@ int FormMgrService::SetNextRefreshTime(const int64_t formId, const int64_t nextT AAFWK::EventInfo eventInfo; eventInfo.userId = formId; AAFWK::EventReport::SendFormEvent(AAFWK::SET_NEXT_REFRESH_TIME_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().SetNextRefreshTime(formId, nextTime); } @@ -251,7 +251,7 @@ int FormMgrService::CastTempForm(const int64_t formId, const sptr AAFWK::EventInfo eventInfo; eventInfo.userId = formId; AAFWK::EventReport::SendFormEvent(AAFWK::CASTTEMP_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().CastTempForm(formId, callerToken); } @@ -339,7 +339,7 @@ int FormMgrService::MessageEvent(const int64_t formId, const Want &want, const s eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendFormEvent(AAFWK::MESSAGE_EVENT_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().MessageEvent(formId, want, callerToken); } @@ -363,7 +363,7 @@ int FormMgrService::RouterEvent(const int64_t formId, Want &want) eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendFormEvent(AAFWK::ROUTE_EVENT_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().RouterEvent(formId, want); } @@ -537,7 +537,7 @@ int FormMgrService::DeleteInvalidForms(const std::vector &formIds, cons } AAFWK::EventInfo eventInfo; AAFWK::EventReport::SendFormEvent(AAFWK::DELETE_INVALID_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().DeleteInvalidForms(formIds, callerToken, numFormsDeleted); } @@ -561,7 +561,7 @@ int FormMgrService::AcquireFormState(const Want &want, const sptr eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendFormEvent(AAFWK::ACQUIREFORMSTATE_FORM, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return FormMgrAdapter::GetInstance().AcquireFormState(want, callerToken, stateInfo); } diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 5119cd63..4b7a64dd 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -265,12 +265,12 @@ int AbilityManagerService::StartAbility(const Want &want, int32_t userId, int re eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); int32_t ret = StartAbilityInner(want, nullptr, requestCode, -1, userId); if (ret != ERR_OK) { eventInfo.errCode = ret; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return ret; } @@ -286,12 +286,12 @@ int AbilityManagerService::StartAbility(const Want &want, const sptrFreeInstall(fiWant, validUserId, requestCode, callerToken, CheckIfOperateRemote(want)); AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -317,14 +317,14 @@ int AbilityManagerService::StartAbility(const Want &want, const sptrStartAbility(abilityRequest); if (ret != ERR_OK) { eventInfo.errCode = ret; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return ret; } @@ -543,20 +543,20 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } if (callerToken != nullptr && !VerificationAllToken(callerToken)) { eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t oriValidUserId = GetValidUserId(userId); @@ -565,7 +565,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("Multi-user non-concurrent mode is not satisfied."); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -575,7 +575,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("Generate ability request local error."); eventInfo.errCode = result; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return result; } @@ -588,7 +588,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (result != AppExecFwk::Constants::PERMISSION_GRANTED) { eventInfo.errCode = result; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return result; } result = AbilityUtil::JudgeAbilityVisibleControl(abilityInfo); @@ -596,7 +596,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("%{public}s JudgeAbilityVisibleControl error.", __func__); eventInfo.errCode = result; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return result; } @@ -604,7 +604,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("Only support for page type ability."); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -616,7 +616,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st result); eventInfo.errCode = result; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return result; } } @@ -624,7 +624,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st if (!IsAbilityControllerStart(want, abilityInfo.bundleName)) { eventInfo.errCode = ERR_WOULD_BLOCK; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_WOULD_BLOCK; } GrantUriPermission(want, validUserId); @@ -635,14 +635,14 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } int32_t ret = missionListManager->StartAbility(abilityRequest); if (ret != ERR_OK) { eventInfo.errCode = ret; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return ret; } @@ -692,12 +692,12 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptrStartAbility(abilityRequest); AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -768,12 +768,12 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptrStopServiceAbility(abilityRequest); AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -903,10 +903,10 @@ int AbilityManagerService::TerminateAbility(const sptr &token, in eventInfo.abilityName = resultWant->GetElement().GetAbilityName(); eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; } @@ -915,7 +915,7 @@ int AbilityManagerService::CloseAbility(const sptr &token, int re { AAFWK::EventInfo eventInfo; AAFWK::EventReport::SendAbilityEvent(AAFWK::CLOSE_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return TerminateAbilityWithFlag(token, resultCode, resultWant, false); } @@ -1163,14 +1163,14 @@ int AbilityManagerService::ConnectAbility( eventInfo.bundleName = want.GetElement().GetBundleName(); eventInfo.moduleName = want.GetElement().GetModuleName(); eventInfo.abilityName = want.GetElement().GetAbilityName(); - AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE, HiSysEventType::BEHAVIOR, eventInfo); if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } int32_t validUserId = GetValidUserId(userId); @@ -1179,7 +1179,7 @@ int AbilityManagerService::ConnectAbility( HILOG_ERROR("%{public}s: Get Local DeviceId failed", __func__); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } auto manager = std::make_shared(weak_from_this()); @@ -1187,7 +1187,7 @@ int AbilityManagerService::ConnectAbility( if (result != ERR_OK) { eventInfo.errCode = result; AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return result; } @@ -1204,7 +1204,7 @@ int AbilityManagerService::ConnectAbility( HILOG_ERROR("Invalid extension ability info."); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } abilityWant.SetElementName(extensionInfo.bundleName, extensionInfo.name); @@ -1214,7 +1214,7 @@ int AbilityManagerService::ConnectAbility( HILOG_INFO("AbilityManagerService::ConnectAbility. try to ConnectRemoteAbility"); eventInfo.errCode = ConnectRemoteAbility(abilityWant, connect->AsObject()); AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -1222,13 +1222,13 @@ int AbilityManagerService::ConnectAbility( HILOG_INFO("%{public}s invalid Token.", __func__); eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); if (eventInfo.errCode != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; } @@ -1238,7 +1238,7 @@ int AbilityManagerService::DisconnectAbility(const sptr &con HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); HILOG_DEBUG("Disconnect ability begin."); AAFWK::EventInfo eventInfo; - AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE, HiSysEventType::BEHAVIOR, eventInfo); CHECK_POINTER_AND_RETURN(connect, ERR_INVALID_VALUE); CHECK_POINTER_AND_RETURN(connect->AsObject(), ERR_INVALID_VALUE); @@ -1247,7 +1247,7 @@ int AbilityManagerService::DisconnectAbility(const sptr &con eventInfo.errCode |= DisconnectRemoteAbility(connect->AsObject()); if (eventInfo.errCode != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, - OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, eventInfo); + HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; } @@ -4158,7 +4158,7 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return ERR_OK; } @@ -4176,7 +4176,7 @@ int AbilityManagerService::DoAbilityBackground(const sptr &token, AAFWK::EventInfo eventInfo; eventInfo.sceneFlag = flag; AAFWK::EventReport::SendAbilityEvent(AAFWK::DO_FOREGROUND_ABILITY, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); return ret; } diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index d4d0998e..28d367dd 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -280,7 +280,7 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptr(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::LaunchApplication(const std::shared_ptr &appRecord) @@ -325,7 +325,7 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptr(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::AddAbilityStageDone(const int32_t recordId) @@ -370,7 +370,7 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) @@ -401,7 +401,7 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, - OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + HiSysEventType::BEHAVIOR, eventInfo); } void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) @@ -440,7 +440,7 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) eventInfo.timeStamp = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, eventInfo); + AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo); DelayedSingleton::GetInstance()->OnProcessDied(appRecord); HILOG_INFO("application is terminated"); diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index fdf593f0..0fd3933f 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -22,6 +22,9 @@ #include "errors.h" #include "hisysevent.h" +using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType; +using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; + namespace OHOS { namespace AAFWK { namespace { @@ -96,13 +99,13 @@ struct EventInfo { }; class EventReport { public: - static void SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + static void SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + static void SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendExtensionEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + static void SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); - static void SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, + static void SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo); }; } // namespace AAFWK diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 5f034b77..7e5ac6b9 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -38,11 +38,11 @@ const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; const std::string EVENT_KEY_EXTENSION_TYPE = "EXTENSION_TYPE"; } -void EventReport::SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, +void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, @@ -52,12 +52,12 @@ void EventReport::SendAppEvent(const std::string &eventName, OHOS::HiviewDFX::Hi EVENT_KEY_TIME_STAMP, eventInfo.timeStamp); } -void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, +void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { if (eventName == START_ABILITY_ERROR || eventName == TERMINATE_ABILITY_ERROR) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_USERID, eventInfo.userId, @@ -66,8 +66,8 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_ERROR_CODE, eventInfo.errCode); } else if (eventName == START_ABILITY_ERROR) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_USERID, eventInfo.userId, @@ -75,30 +75,30 @@ void EventReport::SendAbilityEvent(const std::string &eventName, OHOS::HiviewDFX EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } else if (eventName == DO_FOREGROUND_ABILITY || eventName == DO_BACKGROUND_ABILITY) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_SCENE_FLAG, eventInfo.sceneFlag); } else { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type); } } -void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, +void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { if (eventName == DISCONNECT_SERVICE) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type); } else if (eventName ==CONNECT_SERVICE) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_USERID, eventInfo.userId, @@ -106,8 +106,8 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } else if (eventName == START_SERVICE_EXTENSION || eventName == STOP_SERVICE_EXTENSION) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_USERID, eventInfo.userId, @@ -116,8 +116,8 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, EVENT_KEY_EXTENSION_TYPE, eventInfo.extensionType); } else { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_USERID, eventInfo.userId, @@ -128,25 +128,25 @@ void EventReport::SendExtensionEvent(const std::string &eventName, OHOS::HiviewD } } -void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::HiSysEvent::EventType type, +void EventReport::SendFormEvent(const std::string &eventName, HiSysEventType type, const EventInfo& eventInfo) { if (eventName == DELETE_INVALID_FORM) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type); } else if (eventName == ACQUIREFORMSTATE_FORM || eventName == MESSAGE_EVENT_FORM) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } else if (eventName == ADD_FORM || eventName == REQUEST_FORM || eventName == ROUTE_EVENT_FORM) { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_ABILITY_NAME, eventInfo.formId, @@ -154,8 +154,8 @@ void EventReport::SendFormEvent(const std::string &eventName, OHOS::HiviewDFX::H EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); } else { - OHOS::HiviewDFX::HiSysEvent::Write( - OHOS::HiviewDFX::HiSysEvent::Domain::AAFWK, + HiSysEvent::Write( + HiSysEvent::Domain::AAFWK, eventName, type, EVENT_KEY_ABILITY_NAME, eventInfo.formId); From b5ed67e21f9002acd377c98976361f9d31fd90ca Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 11:30:10 +0800 Subject: [PATCH 50/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ibaa37f61f361b789073bb68d77f3b9c31ac1cb13 --- services/abilitymgr/src/ability_manager_service.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 4b7a64dd..498c2709 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -751,8 +751,10 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptrStartAbility(abilityRequest); - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, - HiSysEventType::FAULT, eventInfo); + if (eventInfo.errCode != ERR_OK) { + AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, + HiSysEventType::FAULT, eventInfo); + } return eventInfo.errCode; } From bf95c1d6812241bd2ce159379469db120ff6fffd Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 16:25:04 +0800 Subject: [PATCH 51/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ifebac8e6fa927acbc5b9db6ee84d761039047240 --- hisysevent.yaml | 4 +- .../include/ability_manager_service.h | 1 - .../src/ability_manager_service.cpp | 104 +++++------------- services/appmgr/src/app_mgr_service_inner.cpp | 30 ++--- services/common/BUILD.gn | 5 +- services/common/include/event_report.h | 15 ++- services/common/src/event_report.cpp | 11 +- 7 files changed, 55 insertions(+), 115 deletions(-) diff --git a/hisysevent.yaml b/hisysevent.yaml index 5b533a36..0b7e8511 100644 --- a/hisysevent.yaml +++ b/hisysevent.yaml @@ -117,7 +117,7 @@ TERMINATE_ABILITY: # serviceExtensionAbility behavior event -START_SERVICE_EXTENSION: +START_SERVICE: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: start serviceExtensionAbility} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} @@ -125,7 +125,7 @@ START_SERVICE_EXTENSION: ABILITY_NAME: {type: STRING, desc: ability name} EXTENSION_TYPE: {type: STRING, desc: extension type} -STOP_SERVICE_EXTENSION: +STOP_SERVICE: __BASE: {type: BEHAVIOR, level: MINOR, tag: ability, desc: stop serviceExtensionAbility} USER_ID: {type: INT32, desc: userId} BUNDLE_NAME: {type: STRING, desc: bundle name} diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 3687b618..6d6755f8 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1016,7 +1016,6 @@ private: const sptr &callerToken, int32_t userId); int CheckOptExtensionAbility(const Want &want, AbilityRequest &abilityRequest, int32_t validUserId, AppExecFwk::ExtensionAbilityType extensionType); - std::string GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType); constexpr static int REPOLL_TIME_MICRO_SECONDS = 1000000; constexpr static int WAITING_BOOT_ANIMATION_TIMER = 5; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 498c2709..3f8333bf 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -632,7 +632,7 @@ int AbilityManagerService::StartAbility(const Want &want, const StartOptions &st abilityRequest.want.SetParam(Want::PARAM_RESV_WINDOW_MODE, startOptions.GetWindowMode()); auto missionListManager = GetListManagerByUserId(oriValidUserId); if (missionListManager == nullptr) { - HILOG_ERROR("missionListManager is Null. userId=%{public}d", validUserId); + HILOG_ERROR("missionListManager is Null. userId=%{public}d", oriValidUserId); eventInfo.errCode = ERR_INVALID_VALUE; AAFWK::EventReport::SendAbilityEvent(AAFWK::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo); @@ -690,13 +690,13 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptrStartAbility(abilityRequest); if (eventInfo.errCode != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::START_EXTENSION_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::START_EXTENSION_ERROR, HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; @@ -768,13 +768,13 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptrStopServiceAbility(abilityRequest); - AAFWK::EventReport::SendAbilityEvent(AAFWK::STOP_EXTENSION_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::STOP_EXTENSION_ERROR, HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; @@ -898,19 +898,13 @@ void AbilityManagerService::GrantUriPermission(const Want &want, int32_t validUs int AbilityManagerService::TerminateAbility(const sptr &token, int resultCode, const Want *resultWant) { AAFWK::EventInfo eventInfo; - auto abilityRecord = Token::GetAbilityRecordByToken(token); - eventInfo.userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE; - eventInfo.bundleName = resultWant->GetElement().GetBundleName(); - eventInfo.moduleName = resultWant->GetElement().GetModuleName(); - eventInfo.abilityName = resultWant->GetElement().GetAbilityName(); - eventInfo.errCode = TerminateAbilityWithFlag(token, resultCode, resultWant, true); AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY, HiSysEventType::BEHAVIOR, eventInfo); if (eventInfo.errCode != ERR_OK) { AAFWK::EventReport::SendAbilityEvent(AAFWK::TERMINATE_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo); } - return eventInfo.errCode; + return TerminateAbilityWithFlag(token, resultCode, resultWant, true); } int AbilityManagerService::CloseAbility(const sptr &token, int resultCode, const Want *resultWant) @@ -1171,7 +1165,7 @@ int AbilityManagerService::ConnectAbility( if (VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED) { HILOG_ERROR("%{public}s: Permission verification failed", __func__); eventInfo.errCode = CHECK_PERMISSION_FAILED; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return CHECK_PERMISSION_FAILED; } @@ -1180,7 +1174,7 @@ int AbilityManagerService::ConnectAbility( if (!GetLocalDeviceId(localDeviceId)) { HILOG_ERROR("%{public}s: Get Local DeviceId failed", __func__); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -1188,7 +1182,7 @@ int AbilityManagerService::ConnectAbility( int result = manager->IsConnectFreeInstall(want, validUserId, callerToken, localDeviceId); if (result != ERR_OK) { eventInfo.errCode = result; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return result; } @@ -1205,7 +1199,7 @@ int AbilityManagerService::ConnectAbility( if (!queryResult || extensionInfo.name.empty() || extensionInfo.bundleName.empty()) { HILOG_ERROR("Invalid extension ability info."); eventInfo.errCode = ERR_INVALID_VALUE; - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return ERR_INVALID_VALUE; } @@ -1215,7 +1209,7 @@ int AbilityManagerService::ConnectAbility( if (CheckIfOperateRemote(abilityWant)) { HILOG_INFO("AbilityManagerService::ConnectAbility. try to ConnectRemoteAbility"); eventInfo.errCode = ConnectRemoteAbility(abilityWant, connect->AsObject()); - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } @@ -1223,13 +1217,13 @@ int AbilityManagerService::ConnectAbility( if (callerToken != nullptr && callerToken->GetObjectDescriptor() != u"ohos.aafwk.AbilityToken") { HILOG_INFO("%{public}s invalid Token.", __func__); eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, nullptr); - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); return eventInfo.errCode; } eventInfo.errCode = ConnectLocalAbility(abilityWant, validUserId, connect, callerToken); if (eventInfo.errCode != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::CONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; @@ -1248,7 +1242,7 @@ int AbilityManagerService::DisconnectAbility(const sptr &con eventInfo.errCode = DisconnectLocalAbility(connect); eventInfo.errCode |= DisconnectRemoteAbility(connect->AsObject()); if (eventInfo.errCode != ERR_OK) { - AAFWK::EventReport::SendAbilityEvent(AAFWK::DISCONNECT_SERVICE_ERROR, + AAFWK::EventReport::SendExtensionEvent(AAFWK::DISCONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo); } return eventInfo.errCode; @@ -4719,50 +4713,6 @@ int AbilityManagerService::DumpAbilityInfoDone(std::vector &infos, return ERR_OK; } -std::string AbilityManagerService::GetExtensionType(AppExecFwk::ExtensionAbilityType extensionType) -{ - std::string extensionTypeStr; - switch (extensionType) { - case AppExecFwk::ExtensionAbilityType::FORM: - extensionTypeStr = "FOMR"; - break; - case AppExecFwk::ExtensionAbilityType::WORK_SCHEDULER: - extensionTypeStr = "WORK_SCHEDULER"; - break; - case AppExecFwk::ExtensionAbilityType::INPUTMETHOD: - extensionTypeStr = "INPUTMETHOD"; - break; - case AppExecFwk::ExtensionAbilityType::SERVICE: - extensionTypeStr = "SERVICE"; - break; - case AppExecFwk::ExtensionAbilityType::ACCESSIBILITY: - extensionTypeStr = "ACCESSIBILITY"; - break; - case AppExecFwk::ExtensionAbilityType::DATASHARE: - extensionTypeStr = "DATASHARE"; - break; - case AppExecFwk::ExtensionAbilityType::FILESHARE: - extensionTypeStr = "FILESHARE"; - break; - case AppExecFwk::ExtensionAbilityType::STATICSUBSCRIBER: - extensionTypeStr = "STATICSUBSCRIBER"; - break; - case AppExecFwk::ExtensionAbilityType::WALLPAPER: - extensionTypeStr = "WALLPAPER"; - break; - case AppExecFwk::ExtensionAbilityType::BACKUP: - extensionTypeStr = "BACKUP"; - break; - case AppExecFwk::ExtensionAbilityType::WINDOW: - extensionTypeStr = "WINDOW"; - break; - default: - extensionTypeStr = "UNSPECIFIED"; - break; - } - return extensionTypeStr; -} - #ifdef SUPPORT_GRAPHICS int AbilityManagerService::SetMissionLabel(const sptr &token, const std::string &label) { diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 28d367dd..607966d8 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -273,13 +273,11 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrRegisterAppDeathRecipient(); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.abilityName = appRecord->GetAbilityInfo()->name; eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); + eventInfo.processName = applicationInfo->process; AAFWK::EventReport::SendAppEvent(AAFWK::APP_ATTACH, HiSysEventType::BEHAVIOR, eventInfo); } @@ -318,13 +316,11 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrLaunchPendingAbilities(); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.abilityName = appRecord->GetAbilityInfo()->name; eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); + eventInfo.processName = applicationInfo->process; AAFWK::EventReport::SendAppEvent(AAFWK::APP_LAUNCH, HiSysEventType::BEHAVIOR, eventInfo); } @@ -362,13 +358,11 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) HILOG_INFO("application is foregrounded"); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.abilityName = appRecord->GetAbilityInfo()->name; eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); + eventInfo.processName = applicationInfo->process; AAFWK::EventReport::SendAppEvent(AAFWK::APP_FOREGROUND, HiSysEventType::BEHAVIOR, eventInfo); } @@ -393,13 +387,11 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) HILOG_INFO("application is backgrounded"); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.abilityName = appRecord->GetAbilityInfo()->name; eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); + eventInfo.processName = applicationInfo->process; AAFWK::EventReport::SendAppEvent(AAFWK::APP_BACKGROUND, HiSysEventType::BEHAVIOR, eventInfo); } @@ -433,13 +425,11 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) RemoveAppFromRecentListById(recordId); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); + eventInfo.abilityName = appRecord->GetAbilityInfo()->name; eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; - eventInfo.timeStamp = - std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) - .count(); + eventInfo.processName = applicationInfo->process; AAFWK::EventReport::SendAppEvent(AAFWK::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo); DelayedSingleton::GetInstance()->OnProcessDied(appRecord); diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index f2625c90..fe87c9d2 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -35,7 +35,10 @@ ohos_source_set("abilitymgr_common") { config("perm_verification_config") { visibility = [ ":*" ] - include_dirs = [ "include" ] + include_dirs = [ + "include", + "${bundlefwk_inner_api_path}/appexecfwk_base/include", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 0fd3933f..48d61cdf 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -21,6 +21,7 @@ #include "errors.h" #include "hisysevent.h" +#include "extension_ability_info.h" using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType; using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; @@ -42,8 +43,8 @@ const std::string CLOSE_ABILITY = "CLOSE_ABILITY"; const std::string DO_FOREGROUND_ABILITY = "DO_FOREGROUND_ABILITY"; const std::string DO_BACKGROUND_ABILITY = "DO_BACKGROUND_ABILITY"; // serviceExtensionAbility behavior event -const std::string START_SERVICE_EXTENSION = "START_SERVICE_EXTENSION"; -const std::string STOP_SERVICE_EXTENSION = "STOP_SERVICE_EXTENSION"; +const std::string START_SERVICE = "START_SERVICE"; +const std::string STOP_SERVICE = "STOP_SERVICE"; const std::string CONNECT_SERVICE = "CONNECT_SERVICE"; const std::string DISCONNECT_SERVICE = "DISCONNECT_SERVICE"; // form behavior event @@ -66,9 +67,7 @@ const std::string APP_TERMINATE = "APP_TERMINATE"; } struct EventInfo { - int32_t pid = -1; int32_t userId = -1; - int64_t timeStamp = 0; int64_t formId = -1; uint32_t versionCode = 0; uint32_t sceneFlag = -1; @@ -76,16 +75,15 @@ struct EventInfo { std::string bundleName; std::string moduleName; std::string abilityName; - std::string extensionType; + std::string processName; + AppExecFwk::ExtensionAbilityType extensionType; // olny used in fault event ErrCode errCode = ERR_OK; void Reset() { - pid =-1; userId = -1; - timeStamp = 0; formId =-1; versionCode = 0; sceneFlag = -1; @@ -93,7 +91,8 @@ struct EventInfo { bundleName.clear(); moduleName.clear(); abilityName.clear(); - extensionType.clear(); + processName.clear(); + extensionType = AppExecFwk::ExtensionAbilityType::UNSPECIFIED; errCode = ERR_OK; } }; diff --git a/services/common/src/event_report.cpp b/services/common/src/event_report.cpp index 7e5ac6b9..a51e971e 100644 --- a/services/common/src/event_report.cpp +++ b/services/common/src/event_report.cpp @@ -14,7 +14,6 @@ */ #include "event_report.h" -#include "hisysevent.h" #include "hilog_wrapper.h" #include @@ -27,7 +26,6 @@ const std::string TYPE = "TYPE"; const std::string EVENT_KEY_PID = "PID"; const std::string EVENT_KEY_USERID = "USERID"; const std::string EVENT_KEY_FORM_ID = "FORM_ID"; -const std::string EVENT_KEY_TIME_STAMP = "TIME_STAMP"; const std::string EVENT_KEY_ERROR_CODE = "ERROR_CODE"; const std::string EVENT_KEY_SCENE_FLAG = "SCENE_FLAG"; const std::string EVENT_KEY_BUNDLE_NAME = "BUNDLE_NAME"; @@ -35,6 +33,7 @@ const std::string EVENT_KEY_MODULE_NAME = "MODULE_NAME"; const std::string EVENT_KEY_ABILITY_NAME = "ABILITY_NAME"; const std::string EVENT_KEY_VERSION_NAME = "VERSION_NAME"; const std::string EVENT_KEY_VERSION_CODE = "VERSION_CODE"; +const std::string EVENT_KEY_PROCESS_NAME = "PROCESS_NAME"; const std::string EVENT_KEY_EXTENSION_TYPE = "EXTENSION_TYPE"; } @@ -48,8 +47,8 @@ void EventReport::SendAppEvent(const std::string &eventName, HiSysEventType type EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_VERSION_NAME, eventInfo.versionName, EVENT_KEY_VERSION_CODE, eventInfo.versionCode, - EVENT_KEY_PID, eventInfo.pid, - EVENT_KEY_TIME_STAMP, eventInfo.timeStamp); + EVENT_KEY_ABILITY_NAME, eventInfo.abilityName, + EVENT_KEY_PROCESS_NAME, eventInfo.processName); } void EventReport::SendAbilityEvent(const std::string &eventName, HiSysEventType type, @@ -96,7 +95,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventTyp HiSysEvent::Domain::AAFWK, eventName, type); - } else if (eventName ==CONNECT_SERVICE) { + } else if (eventName == CONNECT_SERVICE) { HiSysEvent::Write( HiSysEvent::Domain::AAFWK, eventName, @@ -105,7 +104,7 @@ void EventReport::SendExtensionEvent(const std::string &eventName, HiSysEventTyp EVENT_KEY_BUNDLE_NAME, eventInfo.bundleName, EVENT_KEY_MODULE_NAME, eventInfo.moduleName, EVENT_KEY_ABILITY_NAME, eventInfo.abilityName); - } else if (eventName == START_SERVICE_EXTENSION || eventName == STOP_SERVICE_EXTENSION) { + } else if (eventName == START_SERVICE || eventName == STOP_SERVICE) { HiSysEvent::Write( HiSysEvent::Domain::AAFWK, eventName, From 289ca3980c877dc05d504aea8b183d7a74e7dcb0 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 18:51:40 +0800 Subject: [PATCH 52/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I3ff2fea77891e54ad8af47ca7235556877f55238 --- services/abilitymgr/src/ability_manager_service.cpp | 4 ++-- services/common/BUILD.gn | 4 ++-- services/common/include/event_report.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 3f8333bf..80e0b7be 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -690,7 +690,7 @@ int AbilityManagerService::StartExtensionAbility(const Want &want, const sptr Date: Thu, 26 May 2022 19:05:13 +0800 Subject: [PATCH 53/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ie7968171685dea15774c0d8fdaa1db1bb3e9d21d --- services/appmgr/src/app_mgr_service_inner.cpp | 10 +++++----- services/common/BUILD.gn | 7 ++----- services/common/include/event_report.h | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 607966d8..9db23c0f 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -273,7 +273,7 @@ void AppMgrServiceInner::AttachApplication(const pid_t pid, const sptrRegisterAppDeathRecipient(); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.abilityName = appRecord->GetAbilityInfo()->name; + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; @@ -316,7 +316,7 @@ void AppMgrServiceInner::LaunchApplication(const std::shared_ptrLaunchPendingAbilities(); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.abilityName = appRecord->GetAbilityInfo()->name; + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; @@ -358,7 +358,7 @@ void AppMgrServiceInner::ApplicationForegrounded(const int32_t recordId) HILOG_INFO("application is foregrounded"); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.abilityName = appRecord->GetAbilityInfo()->name; + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; @@ -387,7 +387,7 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId) HILOG_INFO("application is backgrounded"); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.abilityName = appRecord->GetAbilityInfo()->name; + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; @@ -425,7 +425,7 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) RemoveAppFromRecentListById(recordId); AAFWK::EventInfo eventInfo; auto applicationInfo = appRecord->GetApplicationInfo(); - eventInfo.abilityName = appRecord->GetAbilityInfo()->name; + eventInfo.pid = appRecord->GetPriorityObject()->GetPid(); eventInfo.bundleName = applicationInfo->name; eventInfo.versionName = applicationInfo->versionName; eventInfo.versionCode = applicationInfo->versionCode; diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index 2daa15f5..f2625c90 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -21,7 +21,7 @@ group("common_target") { } config("common_config") { - include_dirs = [ "include" ] + include_dirs = [ "include/" ] } ohos_source_set("abilitymgr_common") { @@ -35,10 +35,7 @@ ohos_source_set("abilitymgr_common") { config("perm_verification_config") { visibility = [ ":*" ] - include_dirs = [ - "include/", - "${bundlefwk_inner_api_path}/appexecfwk_base/include", - ] + include_dirs = [ "include" ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index d849350e..2888af6a 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -21,7 +21,6 @@ #include "errors.h" #include "hisysevent.h" -#include "extension_ability_info.h" using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType; using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; From 7dd4e3ced9790509a5385f444de85ef6d1db90e7 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 19:20:50 +0800 Subject: [PATCH 54/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: I7d84d053695cbb55dc0286133f3ca0f1ec4cf105 --- services/common/BUILD.gn | 5 ++++- services/common/include/event_report.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/common/BUILD.gn b/services/common/BUILD.gn index f2625c90..fe87c9d2 100644 --- a/services/common/BUILD.gn +++ b/services/common/BUILD.gn @@ -35,7 +35,10 @@ ohos_source_set("abilitymgr_common") { config("perm_verification_config") { visibility = [ ":*" ] - include_dirs = [ "include" ] + include_dirs = [ + "include", + "${bundlefwk_inner_api_path}/appexecfwk_base/include", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index 2888af6a..d849350e 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -21,6 +21,7 @@ #include "errors.h" #include "hisysevent.h" +#include "extension_ability_info.h" using HiSysEventType = OHOS::HiviewDFX::HiSysEvent::EventType; using HiSysEvent = OHOS::HiviewDFX::HiSysEvent; From c1c25cdd7cfb50a432e718a345d02079965b88a7 Mon Sep 17 00:00:00 2001 From: "zhoushicheng2@huawei.com" Date: Thu, 26 May 2022 19:32:07 +0800 Subject: [PATCH 55/55] zhoushicheng2@huawei.com Signed-off-by: zhoushicheng2@huawei.com Change-Id: Ib0ad969f616d5fd88b57ac47043acae6a2fa8413 --- services/common/include/event_report.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/common/include/event_report.h b/services/common/include/event_report.h index d849350e..dda33f78 100644 --- a/services/common/include/event_report.h +++ b/services/common/include/event_report.h @@ -67,6 +67,7 @@ const std::string APP_TERMINATE = "APP_TERMINATE"; } struct EventInfo { + int32_t pid = -1; int32_t userId = -1; int64_t formId = -1; int32_t extensionType = -1; @@ -83,6 +84,7 @@ struct EventInfo { void Reset() { + pid =-1; userId = -1; formId =-1; versionCode = 0;