diff --git a/bundle.json b/bundle.json index 05d7e2de116093b65ef3f26e68957d09ba47a603..e5afdc47c37a6bf7cc0a12db541a273ebb817db4 100644 --- a/bundle.json +++ b/bundle.json @@ -23,6 +23,9 @@ ], "rom":"2000k", "ram":"6M", + "hisysevent_config": [ + "//foundation/distributedhardware/distributedscreen/hisysevent.yaml" + ], "deps":{ "components":[ "appexecfwk_standard", diff --git a/hisysevent.yaml b/hisysevent.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4652dfb9899c7ebf8ec549895d66e259bf8a0b52 --- /dev/null +++ b/hisysevent.yaml @@ -0,0 +1,87 @@ +# 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. + +##################################################### +# below is the format of defining event # +##################################################### +#domain: domain name. [Only one domain name can be defined at the top] +# +#author: the author name who defined this event. +#date: the date when this event was defined, format is YYYY-MM-DD. +#logged: source file which refer to this event. +#usage: the usage of this event. +#//Define event name and event properties. +#@EVENT_NAME: the event definition part begin. +# // __BASE is used for defining the basic info of the event. +# // "type" optional values are: FAULT, STATISTICS, SECURITY, BEHAVIOR. +# // "level" optional values are: CRITICAL, MINOR. +# // "tag" set tags with may used by subscriber of this event, multiple tags devided by space. +# // "desc" full description of this event. +# @PARAMETER: {type: parameter type, arrsize: array length(optional), desc: parameter description}. +# // follow the __BASE block, each line defines a parameter of this event. +# // "type" optional values are: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, STRING. +# // "arrsize" of the parameter is an array, set a non-zero value. +# // "desc" full description of this parameter. + +##################################################### +# Example of some hiviewdfx events definition # +##################################################### + +domain: DSCREEN + +SA_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: dscreen sa error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MSG: {type: STRING, desc: dscreen sa error info} + +VIRTUALSCREEN_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: virtual screen error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MSG: {type: STRING, desc: dscreen virtual screen error info} + +SOFTBUS_SESSIONSERVER_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: softbus sessionserver error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + PKGNAME: {type: STRING, desc: softbus package name} + SESSIONNAME: {type: STRING, desc: softbus session name} + MSG: {type: STRING, desc: dscreen softbus sessionserver error info} + +SOFTBUS_SESSION_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: softbus session error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MYSESSIONNAME: {type: STRING, desc: softbus my session name} + PEERSESSIONNAME: {type: STRING, desc: softbus peer session name} + PEERDEVID: {type: STRING, desc: peer network id} + MSG: {type: STRING, desc: dscreen softbus session error info} + +VIDEO_ENCODER_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: video encoder error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MSG: {type: STRING, desc: dscreen video encoder error info} + +VIDEO_DECODER_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: video decoder error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MSG: {type: STRING, desc: dscreen video decoder error info} + +WINDOW_ERROR: + __BASE: {type: FAULT, level: CRITICAL, desc: screenregion window error occured} + PID: {type: INT32, desc: dscreen pid} + UID: {type: INT32, desc: dscreen uid} + MSG: {type: STRING, desc: dscreen virtual window error info} \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn b/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn index adc10a540538a713700035ebf28382004c631f2f..4e469f9abbcb806c0eb06a727dedbabd1956ac5c 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn +++ b/interfaces/innerkits/native_cpp/screen_sink/BUILD.gn @@ -46,6 +46,7 @@ ohos_shared_library("distributed_screen_sink_sdk") { ] external_deps = [ + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp index 2911bce44c5de42b0cffe66bda1b3f2838e81ef9..620a672336884ee2b96dc9f1c2c83692c9b66591 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/callback/dscreen_sink_load_callback.cpp @@ -14,6 +14,11 @@ */ #include "dscreen_sink_load_callback.h" +#include + +#include "hisysevent.h" + +#include "dscreen_errcode.h" #include "dscreen_log.h" #include "dscreen_sink_handler.h" @@ -38,6 +43,16 @@ void DScreenSinkLoadCallback::OnLoadSystemAbilitySuccess( void DScreenSinkLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { DHLOGE("load screen SA failed, systemAbilityId:%d", systemAbilityId); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen sink OnLoadSystemAbilityFail."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } } } } \ No newline at end of file diff --git a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp index 440e5537ca7b5778a2a58abdeb7c43f26eeb06fa..56100b05a820cae17e76aaedd1bab2129466c5d9 100644 --- a/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_sink/src/dscreen_sink_handler.cpp @@ -15,6 +15,7 @@ #include "dscreen_sink_handler.h" +#include "hisysevent.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" @@ -56,6 +57,16 @@ int32_t DScreenSinkHandler::InitSink(const std::string ¶ms) if (ret != ERR_OK) { DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d", DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, ret); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen sink LoadSystemAbility call failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SA_GET_SINKPROXY_FAIL; } } @@ -64,6 +75,16 @@ int32_t DScreenSinkHandler::InitSink(const std::string ¶ms) [this]() { return dScreenSinkProxy_ != nullptr; }); if (!waitStatus) { DHLOGE("screen load sa timeout"); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen sink sa load timeout."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SA_LOAD_TIMEOUT; } diff --git a/interfaces/innerkits/native_cpp/screen_source/BUILD.gn b/interfaces/innerkits/native_cpp/screen_source/BUILD.gn index 565bc5e61bda647f0e5e617f73a483889092ebdc..8ca358db18bd939838211e59b1525fb9015152d0 100644 --- a/interfaces/innerkits/native_cpp/screen_source/BUILD.gn +++ b/interfaces/innerkits/native_cpp/screen_source/BUILD.gn @@ -48,6 +48,7 @@ ohos_shared_library("distributed_screen_source_sdk") { ] external_deps = [ + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp index bd7126119420458da48e64b2daf4ee7fa7800b3f..168b15cdc891042ad493a12d14ced09121484065 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/callback/dscreen_source_load_callback.cpp @@ -14,6 +14,11 @@ */ #include "dscreen_source_load_callback.h" +#include + +#include "hisysevent.h" + +#include "dscreen_errcode.h" #include "dscreen_log.h" #include "dscreen_source_handler.h" @@ -37,6 +42,16 @@ void DScreenSourceLoadCallback::OnLoadSystemAbilitySuccess( void DScreenSourceLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId) { DHLOGE("load screen SA failed, systemAbilityId:%d", systemAbilityId); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen source OnLoadSystemAbilityFail."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } } } } diff --git a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp index 806d8e2f7b06d5a4a9b12b4e92740337bd18cfc0..96558a4d53e292c4fb3d8d84da41b905836c4dad 100644 --- a/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp +++ b/interfaces/innerkits/native_cpp/screen_source/src/dscreen_source_handler.cpp @@ -15,6 +15,7 @@ #include "dscreen_source_handler.h" +#include "hisysevent.h" #include "if_system_ability_manager.h" #include "iservice_registry.h" @@ -61,6 +62,16 @@ int32_t DScreenSourceHandler::InitSource(const std::string ¶ms) if (ret != ERR_OK) { DHLOGE("Failed to Load systemAbility, systemAbilityId:%d, ret code:%d", DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, ret); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen source LoadSystemAbility call failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SA_GET_SOURCEPROXY_FAIL; } } @@ -69,6 +80,16 @@ int32_t DScreenSourceHandler::InitSource(const std::string ¶ms) [this]() { return (dScreenSourceProxy_ != nullptr); }); if (!waitStatus) { DHLOGE("screen load sa timeout."); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SA_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "dscreen source sa load timeout."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SA_LOAD_TIMEOUT; } diff --git a/interfaces/innerkits/native_cpp/test/unittest/screensinktest/BUILD.gn b/interfaces/innerkits/native_cpp/test/unittest/screensinktest/BUILD.gn index 7a36a109e75dca6b8104cdd6a4ae71b3948d7ae4..29eac1822e0c884f7fa3cc2dc311851144fa78b9 100644 --- a/interfaces/innerkits/native_cpp/test/unittest/screensinktest/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/unittest/screensinktest/BUILD.gn @@ -21,7 +21,7 @@ config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "//third_party/json/include", - "//foundation/graphic/standard/interfaces/innerkits/surface", + "//foundation/graphic/graphic/interfaces/innerkits/surface", "${fwk_common_path}/utils/include", "${fwk_utils_path}/include", ] diff --git a/interfaces/innerkits/native_cpp/test/unittest/screensourcetest/BUILD.gn b/interfaces/innerkits/native_cpp/test/unittest/screensourcetest/BUILD.gn index 540b1a8e1f731959c36e11855ca7f601769498b2..4be676ffbfe1b94dd2c167237c143c352de93b4f 100644 --- a/interfaces/innerkits/native_cpp/test/unittest/screensourcetest/BUILD.gn +++ b/interfaces/innerkits/native_cpp/test/unittest/screensourcetest/BUILD.gn @@ -21,7 +21,7 @@ config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "//third_party/json/include", - "//foundation/graphic/standard/interfaces/innerkits/surface", + "//foundation/graphic/graphic/interfaces/innerkits/surface", "${fwk_common_path}/utils/include", "${fwk_utils_path}/include", ] diff --git a/services/screenclient/BUILD.gn b/services/screenclient/BUILD.gn index ab4e73c2d61097468192efb4a248f560bd2e0d8b..68dab59184efaa3fa12badb3a94a198d83207585 100644 --- a/services/screenclient/BUILD.gn +++ b/services/screenclient/BUILD.gn @@ -50,6 +50,7 @@ ohos_shared_library("distributed_screen_client") { ] external_deps = [ + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "input:libmmi-client", ] diff --git a/services/screenclient/src/screen_client_window_adapter.cpp b/services/screenclient/src/screen_client_window_adapter.cpp index 9e3eb78cb0f42d1892b3c7ab73bb4525f071e4e8..eba5a749ee0d21d753eeb1adfb4bd5fc5cabd305 100644 --- a/services/screenclient/src/screen_client_window_adapter.cpp +++ b/services/screenclient/src/screen_client_window_adapter.cpp @@ -15,6 +15,7 @@ #include "screen_client_window_adapter.h" +#include "hisysevent.h" #include "rs_surface_node.h" #include "window_option.h" #include "wm_common.h" @@ -63,6 +64,16 @@ sptr ScreenClientWindowAdapter::CreateWindow(std::shared_ptr window = Rosen::Window::Create(windowName, option); if (window == nullptr || window->GetSurfaceNode() == nullptr) { DHLOGE("Create screen client window failed."); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "WINDOW_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "create window failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return nullptr; } auto surface = window->GetSurfaceNode()->GetSurface(); @@ -111,6 +122,16 @@ int32_t ScreenClientWindowAdapter::ShowWindow(int32_t windowId) } if (OHOS::Rosen::WMError::WM_OK != window->Show()) { DHLOGE("Show window failed."); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "WINDOW_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "show window failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR; } DHLOGD("Show window (windowId = %d) success.", windowId); diff --git a/services/screenservice/sourceservice/BUILD.gn b/services/screenservice/sourceservice/BUILD.gn index a821fa9610b7587748dc2017b989ab3e29717b16..6da772f6d1ae8d18af076d4cdcf13529c425fa0a 100644 --- a/services/screenservice/sourceservice/BUILD.gn +++ b/services/screenservice/sourceservice/BUILD.gn @@ -74,6 +74,7 @@ ohos_shared_library("distributed_screen_source") { ] external_deps = [ + "hisysevent_native:libhisysevent", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/screenservice/sourceservice/dscreenmgr/src/screen_manager_adapter.cpp b/services/screenservice/sourceservice/dscreenmgr/src/screen_manager_adapter.cpp index 6e6cb06ac7c186e4bfe37212f318581b1fece187..d013edd8ad0d2584ff0ff3b9ba809753d5f24bdc 100644 --- a/services/screenservice/sourceservice/dscreenmgr/src/screen_manager_adapter.cpp +++ b/services/screenservice/sourceservice/dscreenmgr/src/screen_manager_adapter.cpp @@ -19,6 +19,7 @@ #include "display_manager.h" #include "dm_common.h" +#include "hisysevent.h" #include "screen.h" #include "dscreen_constants.h" @@ -46,6 +47,16 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(iter->second); if (err != Rosen::DMError::DM_OK) { DHLOGE("remove virtual screen failed, screenId:%ulld", iter->second); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIRTUALSCREEN_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "destroy virtual screen failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return SCREEN_ID_INVALID; } screenIdMap_.erase(screenName); @@ -62,6 +73,18 @@ uint64_t ScreenMgrAdapter::CreateVirtualScreen(const std::string &devId, const s }; uint64_t screenId = Rosen::ScreenManager::GetInstance().CreateVirtualScreen(option); + if (screenId == SCREEN_ID_INVALID) { + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIRTUALSCREEN_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "create virtual screen failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } + } screenIdMap_.emplace(screenName, screenId); return screenId; } @@ -112,6 +135,16 @@ int32_t ScreenMgrAdapter::RemoveVirtualScreen(uint64_t screenId) Rosen::DMError err = Rosen::ScreenManager::GetInstance().DestroyVirtualScreen(screenId); if (err != Rosen::DMError::DM_OK) { DHLOGE("remove virtual screen failed, screenId:%ulld", screenId); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIRTUALSCREEN_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "destroy virtual screen failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_SA_REMOVE_VIRTUALSCREEN_FAIL; } return DH_SUCCESS; diff --git a/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp b/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp index 6f5d65434b9fdf75876d88e02a677db7062b0f06..78417cd6da08d5546e79c8a27fd7e65ca87d7b23 100644 --- a/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp +++ b/services/screentransport/screensinkprocessor/decoder/src/image_sink_decoder.cpp @@ -18,6 +18,8 @@ #include #include +#include "hisysevent.h" + #include "dscreen_constants.h" #include "dscreen_errcode.h" #include "dscreen_log.h" @@ -78,6 +80,16 @@ int32_t ImageSinkDecoder::StartDecoder() ret = videoDecoder_->Start(); if (ret != Media::MSERR_OK) { DHLOGE("%s: Start decoder failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIDEO_DECODER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "video decoder start failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_CODEC_START_FAILED; } StartInputThread(); @@ -102,6 +114,16 @@ int32_t ImageSinkDecoder::StopDecoder() ret = videoDecoder_->Stop(); if (ret != Media::MSERR_OK) { DHLOGE("%s: Stop decoder failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIDEO_DECODER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "video decoder stop failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_CODEC_STOP_FAILED; } StopInputThread(); diff --git a/services/screentransport/screensinktrans/BUILD.gn b/services/screentransport/screensinktrans/BUILD.gn index 7f22e34f64926b4f934965bf80e72ee47798a9cc..ec24bd54f0e6bff1d5d5449061a0353ff9a0e2bd 100644 --- a/services/screentransport/screensinktrans/BUILD.gn +++ b/services/screentransport/screensinktrans/BUILD.gn @@ -60,6 +60,7 @@ ohos_shared_library("distributed_screen_sinktrans") { ] external_deps = [ + "hisysevent_native:libhisysevent", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", "multimedia_media_standard:media_client", diff --git a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp index bb8f216d71721b165bccbdb809716e09b742eb16..1a21da7cd78ff01c43a63d43b16fd9f205a09d87 100644 --- a/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp +++ b/services/screentransport/screensourceprocessor/encoder/src/image_source_encoder.cpp @@ -18,6 +18,8 @@ #include #include +#include "hisysevent.h" + #include "dscreen_constants.h" #include "dscreen_errcode.h" #include "dscreen_log.h" @@ -84,6 +86,16 @@ int32_t ImageSourceEncoder::StartEncoder() ret = videoEncoder_->Start(); if (ret != Media::MSERR_OK) { DHLOGE("%s: Start encoder failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIDEO_ENCODER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "video encoder start failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_CODEC_START_FAILED; } @@ -106,6 +118,16 @@ int32_t ImageSourceEncoder::StopEncoder() ret = videoEncoder_->Stop(); if (ret != Media::MSERR_OK) { DHLOGE("%s: Stop encoder failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "VIDEO_ENCODER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MSG", "video encoder stop failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_CODEC_STOP_FAILED; } diff --git a/services/screentransport/screensourcetrans/BUILD.gn b/services/screentransport/screensourcetrans/BUILD.gn index fa3f89a743b36998a2bc2d55da897c359945f8e2..1e74dcb3da8c47e11a8d6c55a95b1ce593cdc6d0 100644 --- a/services/screentransport/screensourcetrans/BUILD.gn +++ b/services/screentransport/screensourcetrans/BUILD.gn @@ -59,6 +59,7 @@ ohos_shared_library("distributed_screen_sourcetrans") { ] external_deps = [ + "hisysevent_native:libhisysevent", "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", "multimedia_media_standard:media_client", diff --git a/services/softbusadapter/src/softbus_adapter.cpp b/services/softbusadapter/src/softbus_adapter.cpp index 29a1378c881ed2cf5112a9fd0f0163b3f142eca5..a346d5fcb7e739eed5dd27fa3c2b16cfbe366be4 100644 --- a/services/softbusadapter/src/softbus_adapter.cpp +++ b/services/softbusadapter/src/softbus_adapter.cpp @@ -16,7 +16,9 @@ #include "softbus_adapter.h" #include +#include +#include "hisysevent.h" #include "softbus_bus_center.h" #include "softbus_common.h" @@ -109,6 +111,18 @@ int32_t SoftbusAdapter::CreateSoftbusSessionServer(const std::string &pkgname, c int32_t ret = CreateSessionServer(pkgname.c_str(), sessionName.c_str(), &sessListener_); if (ret != DH_SUCCESS) { DHLOGE("%s: CreateSessionServer failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SOFTBUS_SESSIONSERVER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "PKGNAME", pkgname.c_str(), + "SESSIONNAME", sessionName.c_str(), + "MSG", "create session server failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ret; } } else { @@ -136,6 +150,18 @@ int32_t SoftbusAdapter::RemoveSoftbusSessionServer(const std::string &pkgname, c int32_t ret = RemoveSessionServer(pkgname.c_str(), sessionName.c_str()); if (ret != DH_SUCCESS) { DHLOGE("%s: RemoveSessionServer failed.", LOG_TAG); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SOFTBUS_SESSIONSERVER_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "PKGNAME", pkgname.c_str(), + "SESSIONNAME", sessionName.c_str(), + "MSG", "remove session server failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ret; } @@ -177,6 +203,19 @@ int32_t SoftbusAdapter::OpenSoftbusSession(const std::string &mySessionName, con int32_t sessionId = OpenSession(mySessionName.c_str(), peerSessionName.c_str(), peerDevId.c_str(), "0", &attr); if (sessionId < 0) { DHLOGE("%s: OpenSession failed sessionId:%d.", LOG_TAG, sessionId); + int32_t res = OHOS::HiviewDFX::HiSysEvent::Write( + OHOS::HiviewDFX::HiSysEvent::Domain::DSCREEN, + "SOFTBUS_SESSION_ERROR", + OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, + "PID", getpid(), + "UID", getuid(), + "MYSESSIONNAME", mySessionName.c_str(), + "PEERSESSIONNAME", peerSessionName.c_str(), + "PEERDEVID", peerDevId.c_str(), + "MSG", "open session failed."); + if (res != DH_SUCCESS) { + DHLOGE("Write HiSysEvent error, res:%d", res); + } return ERR_DH_SCREEN_ADAPTER_OPEN_SESSION_FAIL; }