From 92ef54096eea752df7db6a6e232b5d4595f72bf2 Mon Sep 17 00:00:00 2001 From: byndyx Date: Wed, 11 Oct 2023 16:04:00 +0800 Subject: [PATCH] hicollie Signed-off-by: byndyx --- bundle.json | 1 + common/include/constants_dinput.h | 5 +++++ services/sink/transport/BUILD.gn | 1 + .../transport/src/distributed_input_sink_transport.cpp | 9 +++++++++ services/source/sourcemanager/BUILD.gn | 1 + .../src/distributed_input_source_manager.cpp | 9 +++++++++ 6 files changed, 26 insertions(+) diff --git a/bundle.json b/bundle.json index e3174fa..47194c0 100755 --- a/bundle.json +++ b/bundle.json @@ -39,6 +39,7 @@ "c_utils", "distributed_hardware_fwk", "config_policy", + "hicollie", "hisysevent", "hitrace", "graphic_2d", diff --git a/common/include/constants_dinput.h b/common/include/constants_dinput.h index e7604ff..3fee6bc 100644 --- a/common/include/constants_dinput.h +++ b/common/include/constants_dinput.h @@ -1,3 +1,6 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. + */ /* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -84,6 +87,8 @@ namespace DistributedInput { constexpr int32_t EPOLL_WAITTIME = 100; + constexpr uint64_t WATCHDOG_INTERVAL_TIME_MS = 20 * 1000; + /* The input device is a keyboard or has buttons. */ constexpr uint32_t INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001; diff --git a/services/sink/transport/BUILD.gn b/services/sink/transport/BUILD.gn index 240becf..b8756ae 100644 --- a/services/sink/transport/BUILD.gn +++ b/services/sink/transport/BUILD.gn @@ -55,6 +55,7 @@ ohos_shared_library("libdinput_sink_trans") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", + "hicollie:libhicollie", "hitrace:hitrace_meter", "ipc:ipc_core", "safwk:system_ability_fwk", diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index af0e0ef..52c0d37 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -1,3 +1,6 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. + */ /* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,6 +34,7 @@ #include "hidumper.h" #include "session.h" #include "softbus_bus_center.h" +#include "xcollie/watchdog.h" #include "distributed_input_transport_base.h" @@ -41,6 +45,11 @@ DistributedInputSinkTransport::DistributedInputSinkTransport() : mySessionName_( { std::shared_ptr runner = AppExecFwk::EventRunner::Create(true); eventHandler_ = std::make_shared(runner); + + if (OHOS::HiviewDFX::Watchdog::GetInstance().AddThread("dinputwatchdog", eventHandler_, + WATCHDOG_INTERVAL_TIME_MS)) { + DHLOGE("HiviewDFX::Watchdog::GetInstance().AddThread() Failed."); + } DHLOGI("DistributedInputSinkTransport ctor."); } diff --git a/services/source/sourcemanager/BUILD.gn b/services/source/sourcemanager/BUILD.gn index 7bfd57f..5acbfe6 100644 --- a/services/source/sourcemanager/BUILD.gn +++ b/services/source/sourcemanager/BUILD.gn @@ -109,6 +109,7 @@ ohos_shared_library("libdinput_source") { "distributed_hardware_fwk:libdhfwk_sdk", "dsoftbus:softbus_client", "eventhandler:libeventhandler", + "hicollie:libhicollie", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "ipc:ipc_core", diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index 4cfaeb4..77c714e 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -1,3 +1,6 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved. + */ /* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,6 +39,7 @@ #include "distributed_input_source_transport.h" #include "distributed_input_transport_base.h" #include "dinput_softbus_define.h" +#include "xcollie/watchdog.h" #include "hisysevent_util.h" #include "hidumper.h" #include "input_check_param.h" @@ -118,6 +122,11 @@ bool DistributedInputSourceManager::InitAuto() DHLOGI("init success"); std::shared_ptr runner = AppExecFwk::EventRunner::Create(true); callBackHandler_ = std::make_shared(runner, this); + + if (OHOS::HiviewDFX::Watchdog::GetInstance().AddThread("dinputsourcewatchdog", callBackHandler_, + WATCHDOG_INTERVAL_TIME_MS)) { + DHLOGE("HiviewDFX::Watchdog::GetInstance().AddThread() Failed."); + } return true; }