From 8f2c8ed50f37911bfc5736130cfa607635a96886 Mon Sep 17 00:00:00 2001 From: litiangang4 Date: Mon, 7 Aug 2023 20:07:42 +0800 Subject: [PATCH] =?UTF-8?q?dinput=E5=8F=82=E6=95=B0&=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: litiangang4 --- common/include/input_check_param.cpp | 4 +- common/include/input_hub.cpp | 70 +++++++++---------- common/include/input_hub.h | 70 +++++++++---------- dfx_utils/include/hidumper.h | 24 +++---- dfx_utils/src/hidumper.cpp | 20 +++--- .../i_add_white_list_infos_call_back.h | 4 +- .../i_del_white_list_infos_call_back.h | 4 +- frameworks/include/i_distributed_sink_input.h | 2 +- .../include/i_distributed_source_input.h | 8 +-- .../i_get_sink_screen_infos_call_back.h | 4 +- .../include/i_prepare_d_input_call_back.h | 4 +- .../include/i_register_d_input_call_back.h | 4 +- .../include/i_start_d_input_call_back.h | 4 +- frameworks/include/i_stop_d_input_call_back.h | 4 +- .../include/i_unprepare_d_input_call_back.h | 4 +- .../include/i_unregister_d_input_call_back.h | 4 +- .../include/distributed_input_handler.h | 6 +- .../src/distributed_input_handler.cpp | 4 +- .../include/distributed_input_kit.h | 14 ++-- .../inner_kits/src/distributed_input_kit.cpp | 16 ++--- .../unittest/distributed_input_inner_test.cpp | 8 +-- .../unittest/distributed_input_inner_test.h | 10 +-- .../mock/mock_distributed_input_client.cpp | 30 ++++---- .../add_white_list_infos_call_back_proxy.h | 4 +- .../del_white_list_infos_call_back_proxy.h | 4 +- .../ipc/include/distributed_input_client.h | 28 ++++---- .../include/distributed_input_sink_proxy.h | 6 +- .../include/distributed_input_source_proxy.h | 10 +-- .../get_sink_screen_infos_call_back_proxy.h | 4 +- .../include/prepare_d_input_call_back_proxy.h | 4 +- .../register_d_input_call_back_proxy.h | 4 +- .../include/start_d_input_call_back_proxy.h | 4 +- .../include/stop_d_input_call_back_proxy.h | 4 +- .../unprepare_d_input_call_back_proxy.h | 4 +- .../unregister_d_input_call_back_proxy.h | 4 +- .../add_white_list_infos_call_back_proxy.cpp | 2 +- .../del_white_list_infos_call_back_proxy.cpp | 2 +- .../ipc/src/distributed_input_client.cpp | 30 ++++---- .../src/distributed_input_source_proxy.cpp | 18 ++--- .../get_sink_screen_infos_call_back_proxy.cpp | 2 +- .../src/prepare_d_input_call_back_proxy.cpp | 2 +- .../src/register_d_input_call_back_proxy.cpp | 2 +- .../ipc/src/start_d_input_call_back_proxy.cpp | 2 +- .../ipc/src/stop_d_input_call_back_proxy.cpp | 4 +- .../src/unprepare_d_input_call_back_proxy.cpp | 4 +- .../unregister_d_input_call_back_proxy.cpp | 2 +- .../add_white_list_infos_call_back_test.cpp | 24 +++---- .../add_white_list_infos_call_back_test.h | 16 ++--- .../distributed_input_client_test.cpp | 10 +-- .../distributed_input_client_test.h | 12 ++-- .../del_white_list_infos_call_back_test.cpp | 2 +- .../del_white_list_infos_call_back_test.h | 4 +- .../dinput_source_callback_unittest.cpp | 30 ++++---- .../dinput_source_callback_unittest.h | 24 +++---- .../unprepare_d_input_call_back_test.cpp | 4 +- .../unprepare_d_input_call_back_test.h | 4 +- .../unregister_d_input_call_back_test.cpp | 4 +- .../unregister_d_input_call_back_test.h | 4 +- .../include/dinput_sink_trans_callback.h | 10 +-- .../include/distributed_input_collector.h | 4 +- .../src/distributed_input_collector.cpp | 2 +- .../include/distributed_input_sink_manager.h | 30 ++++---- .../src/distributed_input_sink_manager.cpp | 30 ++++---- .../distributed_input_sinkmanager_test.cpp | 2 +- .../distributed_input_sinkmanager_test.h | 4 +- .../distributed_input_sink_transport.h | 6 +- .../src/distributed_input_sink_transport.cpp | 4 +- .../include/distributed_input_inject.h | 16 ++--- .../include/distributed_input_node_manager.h | 28 ++++---- .../inputinject/include/virtual_device.h | 12 ++-- .../src/distributed_input_inject.cpp | 10 +-- .../src/distributed_input_node_manager.cpp | 28 ++++---- .../source/inputinject/src/virtual_device.cpp | 12 ++-- .../distributed_input_source_manager.h | 44 ++++++------ .../distributed_input_source_sa_cli_mgr.h | 6 +- .../src/distributed_input_source_manager.cpp | 40 +++++------ .../distributed_input_source_sa_cli_mgr.cpp | 4 +- .../distributed_input_sourcemanager_test.cpp | 16 ++--- .../distributed_input_sourcemanager_test.h | 16 ++--- .../distributed_input_source_transport.h | 26 +++---- .../distributed_input_source_transport.cpp | 24 +++---- .../include/distributed_input_sink_handler.h | 10 +-- .../src/distributed_input_sink_handler.cpp | 2 +- .../mock/mock_distributed_input_client.cpp | 26 +++---- .../distributed_input_source_handler.h | 16 ++--- .../src/distributed_input_source_handler.cpp | 2 +- .../mock/mock_distributed_input_client.cpp | 26 +++---- .../dinputconfigdh_fuzzer.cpp | 4 +- .../dinputinitsink_fuzzer.cpp | 4 +- .../dinputinitsource_fuzzer.cpp | 4 +- .../dinputonsessionclosed_fuzzer.cpp | 4 +- .../dinputonsessionopend_fuzzer.cpp | 4 +- .../dinputreleasesink_fuzzer.cpp | 4 +- .../dinputreleasesource_fuzzer.cpp | 4 +- .../dinputsubscribelocaldh_fuzzer.cpp | 4 +- .../distributed_input_client_fuzzer.cpp | 6 +- .../distributed_input_kit_fuzzer.cpp | 18 ++--- ...istributed_input_sink_transport_fuzzer.cpp | 8 +-- ...tributed_input_source_transport_fuzzer.cpp | 6 +- ...istributed_input_transport_base_fuzzer.cpp | 6 +- utils/include/dinput_context.h | 6 +- utils/include/dinput_utils_tool.h | 24 +++---- utils/src/dinput_context.cpp | 4 +- utils/src/dinput_utils_tool.cpp | 24 +++---- 104 files changed, 600 insertions(+), 600 deletions(-) diff --git a/common/include/input_check_param.cpp b/common/include/input_check_param.cpp index ed64077..af980bd 100644 --- a/common/include/input_check_param.cpp +++ b/common/include/input_check_param.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -39,7 +39,7 @@ bool DInputCheckParam::CheckParam(const std::string &deviceId, sptr callback) { if (deviceId.empty() || deviceId.size() > DEV_ID_LENGTH_MAX) { diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index 1001041..1900da6 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -93,7 +93,7 @@ int32_t InputHub::Release() return DH_SUCCESS; } -size_t InputHub::StartCollectInputEvents(RawEvent* buffer, size_t bufferSize) +size_t InputHub::StartCollectInputEvents(RawEvent *buffer, size_t bufferSize) { size_t count = 0; isStartCollectEvent_ = true; @@ -151,7 +151,7 @@ void InputHub::StopCollectInputEvents() isStartCollectEvent_ = false; } -size_t InputHub::GetEvents(RawEvent* buffer, size_t bufferSize) +size_t InputHub::GetEvents(RawEvent *buffer, size_t bufferSize) { RawEvent* event = buffer; size_t capacity = bufferSize; @@ -194,7 +194,7 @@ size_t InputHub::GetEvents(RawEvent* buffer, size_t bufferSize) return event - buffer; } -bool InputHub::IsTouchPad(const InputDevice& inputDevice) +bool InputHub::IsTouchPad(const InputDevice &inputDevice) { std::string dhName = inputDevice.name; DHLOGI("device name is %s.", dhName.c_str()); @@ -205,7 +205,7 @@ bool InputHub::IsTouchPad(const InputDevice& inputDevice) return true; } -size_t InputHub::CollectEvent(RawEvent* buffer, size_t& capacity, Device* device, struct input_event readBuffer[], +size_t InputHub::CollectEvent(RawEvent *buffer, size_t &capacity, Device *device, struct input_event readBuffer[], const size_t count) { std::vector needFilted(capacity, false); @@ -236,7 +236,7 @@ size_t InputHub::CollectEvent(RawEvent* buffer, size_t& capacity, Device* device return event - buffer; } -size_t InputHub::ReadInputEvent(int32_t readSize, Device& device) +size_t InputHub::ReadInputEvent(int32_t readSize, Device &device) { size_t count = 0; if (readSize == 0 || (readSize < 0 && errno == ENODEV)) { @@ -259,7 +259,7 @@ size_t InputHub::ReadInputEvent(int32_t readSize, Device& device) return count; } -size_t InputHub::DeviceIsExists(InputDeviceEvent* buffer, size_t bufferSize) +size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize) { InputDeviceEvent* event = buffer; size_t capacity = bufferSize; @@ -310,7 +310,7 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent* buffer, size_t bufferSize) return event - buffer; } -size_t InputHub::StartCollectInputHandler(InputDeviceEvent* buffer, size_t bufferSize) +size_t InputHub::StartCollectInputHandler(InputDeviceEvent *buffer, size_t bufferSize) { size_t count = 0; isStartCollectHandler_ = true; @@ -419,7 +419,7 @@ std::vector InputHub::GetAllInputDevices() return vecDevice; } -void InputHub::ScanInputDevices(const std::string& dirName) +void InputHub::ScanInputDevices(const std::string &dirName) { DHLOGI("ScanInputDevices enter, dirName %s.", dirName.c_str()); std::vector vecInputDevPath; @@ -429,7 +429,7 @@ void InputHub::ScanInputDevices(const std::string& dirName) } } -bool InputHub::IsDeviceRegistered(const std::string& devicePath) +bool InputHub::IsDeviceRegistered(const std::string &devicePath) { std::unique_lock deviceLock(devicesMutex_); for (const auto& [deviceId, device] : devices_) { @@ -440,7 +440,7 @@ bool InputHub::IsDeviceRegistered(const std::string& devicePath) return false; } -int32_t InputHub::OpenInputDeviceLocked(const std::string& devicePath) +int32_t InputHub::OpenInputDeviceLocked(const std::string &devicePath) { if (IsDeviceRegistered(devicePath)) { return DH_SUCCESS; @@ -474,7 +474,7 @@ int32_t InputHub::OpenInputDeviceLocked(const std::string& devicePath) return DH_SUCCESS; } -int32_t InputHub::QueryInputDeviceInfo(int fd, InputDevice& identifier) +int32_t InputHub::QueryInputDeviceInfo(int fd, InputDevice &identifier) { char buffer[INPUT_EVENT_BUFFER_SIZE] = {0}; // Get device name. @@ -525,7 +525,7 @@ int32_t InputHub::QueryInputDeviceInfo(int fd, InputDevice& identifier) return DH_SUCCESS; } -void InputHub::QueryEventInfo(int fd, InputDevice& identifier) +void InputHub::QueryEventInfo(int fd, InputDevice &identifier) { DHLOGI("QueryEventInfo: devName: %s, dhId: %s!", identifier.name.c_str(), GetAnonyString(identifier.descriptor).c_str()); @@ -554,7 +554,7 @@ struct libevdev* InputHub::GetLibEvDev(int fd) return dev; } -void InputHub::GetEventTypes(struct libevdev* dev, InputDevice& identifier) +void InputHub::GetEventTypes(struct libevdev *dev, InputDevice &identifier) { for (uint32_t eventType = 0; eventType < EV_CNT; eventType++) { if (!libevdev_has_event_type(dev, eventType)) { @@ -566,7 +566,7 @@ void InputHub::GetEventTypes(struct libevdev* dev, InputDevice& identifier) } } -int32_t InputHub::GetEventKeys(struct libevdev* dev, InputDevice& identifier) +int32_t InputHub::GetEventKeys(struct libevdev *dev, InputDevice &identifier) { if (!libevdev_has_event_type(dev, EV_KEY)) { DHLOGE("The device doesn't has EV_KEY type!"); @@ -583,7 +583,7 @@ int32_t InputHub::GetEventKeys(struct libevdev* dev, InputDevice& identifier) return DH_SUCCESS; } -int32_t InputHub::GetABSInfo(struct libevdev* dev, InputDevice& identifier) +int32_t InputHub::GetABSInfo(struct libevdev *dev, InputDevice &identifier) { if (!libevdev_has_event_type(dev, EV_ABS)) { DHLOGE("The device doesn't has EV_ABS type!"); @@ -615,7 +615,7 @@ int32_t InputHub::GetABSInfo(struct libevdev* dev, InputDevice& identifier) return DH_SUCCESS; } -int32_t InputHub::GetRELTypes(struct libevdev* dev, InputDevice& identifier) +int32_t InputHub::GetRELTypes(struct libevdev *dev, InputDevice &identifier) { if (!libevdev_has_event_type(dev, EV_REL)) { DHLOGE("The device doesn't has EV_REL type!"); @@ -632,7 +632,7 @@ int32_t InputHub::GetRELTypes(struct libevdev* dev, InputDevice& identifier) return DH_SUCCESS; } -void InputHub::GetProperties(struct libevdev* dev, InputDevice& identifier) +void InputHub::GetProperties(struct libevdev *dev, InputDevice &identifier) { for (uint32_t prop = 0; prop < INPUT_PROP_CNT; prop++) { if (libevdev_has_property(dev, prop)) { @@ -755,7 +755,7 @@ int32_t InputHub::QueryLocalTouchScreenInfo(int fd) return DH_SUCCESS; } -std::string InputHub::StringPrintf(const char* format, ...) const +std::string InputHub::StringPrintf(const char *format, ...) const { static const int kSpaceLength = 1024; char space[kSpaceLength]; @@ -774,7 +774,7 @@ std::string InputHub::StringPrintf(const char* format, ...) const return result; } -void InputHub::GenerateDescriptor(InputDevice& identifier) const +void InputHub::GenerateDescriptor(InputDevice &identifier) const { std::string rawDescriptor; rawDescriptor += StringPrintf(":%04x:%04x:", identifier.vendor, @@ -799,7 +799,7 @@ void InputHub::GenerateDescriptor(InputDevice& identifier) const GetAnonyString(identifier.descriptor).c_str()); } -int32_t InputHub::RegisterDeviceForEpollLocked(const Device& device) +int32_t InputHub::RegisterDeviceForEpollLocked(const Device &device) { int32_t result = RegisterFdForEpoll(device.fd); if (result != DH_SUCCESS) { @@ -827,7 +827,7 @@ void InputHub::AddDeviceLocked(std::unique_ptr device) openingDevices_.push_back(std::move(device)); } -void InputHub::CloseDeviceLocked(Device& device) +void InputHub::CloseDeviceLocked(Device &device) { DHLOGI("Removed device: path=%s name=%s id=%s fd=%d classes=0x%x", device.path.c_str(), device.identifier.name.c_str(), GetAnonyInt32(device.id).c_str(), @@ -842,7 +842,7 @@ void InputHub::CloseDeviceLocked(Device& device) } } -void InputHub::CloseDeviceForAllLocked(Device& device) +void InputHub::CloseDeviceForAllLocked(Device &device) { DHLOGI("Removed device: path=%s name=%s id=%s fd=%d classes=0x%x", device.path.c_str(), device.identifier.name.c_str(), GetAnonyInt32(device.id).c_str(), @@ -854,7 +854,7 @@ void InputHub::CloseDeviceForAllLocked(Device& device) devices_.erase(device.id); } -int32_t InputHub::UnregisterDeviceFromEpollLocked(const Device& device) const +int32_t InputHub::UnregisterDeviceFromEpollLocked(const Device &device) const { if (device.HasValidFd()) { int32_t result = UnregisterFdFromEpoll(device.fd); @@ -906,7 +906,7 @@ int32_t InputHub::ReadNotifyLocked() return DH_SUCCESS; } -void InputHub::JudgeDeviceOpenOrClose(const inotify_event& event) +void InputHub::JudgeDeviceOpenOrClose(const inotify_event &event) { if (event.len) { if (event.wd == inputWd_) { @@ -923,7 +923,7 @@ void InputHub::JudgeDeviceOpenOrClose(const inotify_event& event) } } -void InputHub::CloseDeviceByPathLocked(const std::string& devicePath) +void InputHub::CloseDeviceByPathLocked(const std::string &devicePath) { Device* device = GetDeviceByPathLocked(devicePath); if (device) { @@ -942,7 +942,7 @@ void InputHub::CloseAllDevicesLocked() } } -InputHub::Device* InputHub::GetDeviceByPathLocked(const std::string& devicePath) +InputHub::Device* InputHub::GetDeviceByPathLocked(const std::string &devicePath) { std::unique_lock deviceLock(devicesMutex_); for (const auto& [id, device] : devices_) { @@ -978,7 +978,7 @@ InputHub::Device* InputHub::GetSupportDeviceByFd(int fd) return nullptr; } -bool InputHub::ContainsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) +bool InputHub::ContainsNonZeroByte(const uint8_t *array, uint32_t startIndex, uint32_t endIndex) { const uint8_t* end = array + endIndex; array += startIndex; @@ -990,13 +990,13 @@ bool InputHub::ContainsNonZeroByte(const uint8_t* array, uint32_t startIndex, ui return false; } -int64_t InputHub::ProcessEventTimestamp(const input_event& event) +int64_t InputHub::ProcessEventTimestamp(const input_event &event) { const int64_t inputEventTime = event.input_event_sec * 1000000000LL + event.input_event_usec * 1000LL; return inputEventTime; } -bool InputHub::TestBit(uint32_t bit, const uint8_t* array) +bool InputHub::TestBit(uint32_t bit, const uint8_t *array) { constexpr int units = 8; return (array)[(bit) / units] & (1 << ((bit) % units)); @@ -1151,7 +1151,7 @@ bool InputHub::IsAllDevicesStoped() return true; } -void InputHub::RecordDeviceLog(const int32_t deviceId, const std::string& devicePath, const InputDevice& identifier) +void InputHub::RecordDeviceLog(const int32_t deviceId, const std::string &devicePath, const InputDevice &identifier) { DHLOGI("add device %d: %s\n", deviceId, devicePath.c_str()); DHLOGI(" bus: %04x\n" @@ -1165,7 +1165,7 @@ void InputHub::RecordDeviceLog(const int32_t deviceId, const std::string& device DHLOGI(" descriptor: \"%s\"\n", GetAnonyString(identifier.descriptor).c_str()); } -void InputHub::RecordEventLog(const RawEvent* event) +void InputHub::RecordEventLog(const RawEvent *event) { std::string eventType = ""; switch (event->type) { @@ -1191,7 +1191,7 @@ void InputHub::RecordEventLog(const RawEvent* event) } void InputHub::HandleTouchScreenEvent(struct input_event readBuffer[], const size_t count, - std::vector& needFilted) + std::vector &needFilted) { std::vector> absIndexs; int32_t firstIndex = -1; @@ -1245,7 +1245,7 @@ void InputHub::HandleTouchScreenEvent(struct input_event readBuffer[], const siz } } -bool InputHub::CheckTouchPointRegion(struct input_event readBuffer[], const AbsInfo& absInfo) +bool InputHub::CheckTouchPointRegion(struct input_event readBuffer[], const AbsInfo &absInfo) { auto sinkInfos = DInputContext::GetInstance().GetAllSinkScreenInfo(); @@ -1262,8 +1262,8 @@ bool InputHub::CheckTouchPointRegion(struct input_event readBuffer[], const AbsI return false; } -InputHub::Device::Device(int fd, int32_t id, const std::string& path, - const InputDevice& identifier) : next(nullptr), fd(fd), id(id), path(path), identifier(identifier), +InputHub::Device::Device(int fd, int32_t id, const std::string &path, + const InputDevice &identifier) : next(nullptr), fd(fd), id(id), path(path), identifier(identifier), classes(0), enabled(false), isShare(false), isVirtual(fd < 0) { memset_s(keyBitmask, sizeof(keyBitmask), 0, sizeof(keyBitmask)); memset_s(absBitmask, sizeof(absBitmask), 0, sizeof(absBitmask)); diff --git a/common/include/input_hub.h b/common/include/input_hub.h index a8f7aa3..4b5e488 100644 --- a/common/include/input_hub.h +++ b/common/include/input_hub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -40,11 +40,11 @@ class InputHub { public: InputHub(); ~InputHub(); - size_t StartCollectInputEvents(RawEvent* buffer, size_t bufferSize); - size_t StartCollectInputHandler(InputDeviceEvent* buffer, size_t bufferSize); + size_t StartCollectInputEvents(RawEvent *buffer, size_t bufferSize); + size_t StartCollectInputHandler(InputDeviceEvent *buffer, size_t bufferSize); void StopCollectInputEvents(); void StopCollectInputHandler(); - size_t DeviceIsExists(InputDeviceEvent* buffer, size_t bufferSize); + size_t DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize); std::vector GetAllInputDevices(); // return efftive dhids AffectDhIds SetSupportInputType(bool enabled, const uint32_t &inputTypes); @@ -56,7 +56,7 @@ public: void GetShareKeyboardPathsByDhIds(std::vector dhIds, std::vector &shareDhidsPaths, std::vector &shareDhIds); bool IsAllDevicesStoped(); - void ScanInputDevices(const std::string& dirName); + void ScanInputDevices(const std::string &dirName); private: struct Device { @@ -70,7 +70,7 @@ private: uint8_t absBitmask[(ABS_MAX + 1) / 8]; uint8_t relBitmask[(REL_MAX + 1) / 8]; - Device(int fd, int32_t id, const std::string& path, const InputDevice& identifier); + Device(int fd, int32_t id, const std::string &path, const InputDevice &identifier); ~Device(); void Close(); bool enabled; // initially true @@ -91,43 +91,43 @@ private: int32_t Initialize(); int32_t Release(); - size_t GetEvents(RawEvent* buffer, size_t bufferSize); - size_t ReadInputEvent(int32_t readSize, Device& device); + size_t GetEvents(RawEvent *buffer, size_t bufferSize); + size_t ReadInputEvent(int32_t readSize, Device &device); void GetDeviceHandler(); int32_t RefreshEpollItem(bool isSleep); - int32_t OpenInputDeviceLocked(const std::string& devicePath); - int32_t QueryInputDeviceInfo(int fd, InputDevice& identifier); - void QueryEventInfo(int fd, InputDevice& identifier); + int32_t OpenInputDeviceLocked(const std::string &devicePath); + int32_t QueryInputDeviceInfo(int fd, InputDevice &identifier); + void QueryEventInfo(int fd, InputDevice &identifier); struct libevdev* GetLibEvDev(int fd); - void GetEventTypes(struct libevdev* dev, InputDevice& identifier); - int32_t GetEventKeys(struct libevdev* dev, InputDevice& identifier); - int32_t GetABSInfo(struct libevdev* dev, InputDevice& identifier); - int32_t GetRELTypes(struct libevdev* dev, InputDevice& identifier); - void GetProperties(struct libevdev* dev, InputDevice& identifier); + void GetEventTypes(struct libevdev *dev, InputDevice &identifier); + int32_t GetEventKeys(struct libevdev *dev, InputDevice &identifier); + int32_t GetABSInfo(struct libevdev *dev, InputDevice &identifier); + int32_t GetRELTypes(struct libevdev *dev, InputDevice &identifier); + void GetProperties(struct libevdev *dev, InputDevice &identifier); int32_t MakeDevice(int fd, std::unique_ptr device); - void GenerateDescriptor(InputDevice& identifier) const; - std::string StringPrintf(const char* format, ...) const; + void GenerateDescriptor(InputDevice &identifier) const; + std::string StringPrintf(const char *format, ...) const; int32_t RegisterFdForEpoll(int fd); - int32_t RegisterDeviceForEpollLocked(const Device& device); + int32_t RegisterDeviceForEpollLocked(const Device &device); void AddDeviceLocked(std::unique_ptr device); - void CloseDeviceLocked(Device& device); - void CloseDeviceForAllLocked(Device& device); - int32_t UnregisterDeviceFromEpollLocked(const Device& device) const; + void CloseDeviceLocked(Device &device); + void CloseDeviceForAllLocked(Device &device); + int32_t UnregisterDeviceFromEpollLocked(const Device &device) const; int32_t UnregisterFdFromEpoll(int fd) const; int32_t ReadNotifyLocked(); - void CloseDeviceByPathLocked(const std::string& devicePath); + void CloseDeviceByPathLocked(const std::string &devicePath); void CloseAllDevicesLocked(); - void JudgeDeviceOpenOrClose(const inotify_event& event); - Device* GetDeviceByPathLocked(const std::string& devicePath); + void JudgeDeviceOpenOrClose(const inotify_event &event); + Device* GetDeviceByPathLocked(const std::string &devicePath); Device* GetDeviceByFdLocked(int fd); Device* GetSupportDeviceByFd(int fd); - bool IsDeviceRegistered(const std::string& devicePath); + bool IsDeviceRegistered(const std::string &devicePath); - bool ContainsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex); - int64_t ProcessEventTimestamp(const input_event& event); - bool IsTouchPad(const InputDevice& inputDevice); + bool ContainsNonZeroByte(const uint8_t *array, uint32_t startIndex, uint32_t endIndex); + int64_t ProcessEventTimestamp(const input_event &event); + bool IsTouchPad(const InputDevice &inputDevice); /* * this macro is used to tell if "bit" is set in "array" @@ -135,15 +135,15 @@ private: * operation with a byte that only has the relevant bit set. * eg. to check for the 12th bit, we do (array[1] & 1<<4) */ - bool TestBit(uint32_t bit, const uint8_t* array); + bool TestBit(uint32_t bit, const uint8_t *array); /* this macro computes the number of bytes needed to represent a bit array of the specified size */ uint32_t SizeofBitArray(uint32_t bit); - void RecordEventLog(const RawEvent* event); - void RecordDeviceLog(const int32_t deviceId, const std::string& devicePath, const InputDevice& identifier); - void HandleTouchScreenEvent(struct input_event readBuffer[], const size_t count, std::vector& needFilted); + void RecordEventLog(const RawEvent *event); + void RecordDeviceLog(const int32_t deviceId, const std::string &devicePath, const InputDevice &identifier); + void HandleTouchScreenEvent(struct input_event readBuffer[], const size_t count, std::vector &needFilted); int32_t QueryLocalTouchScreenInfo(int fd); - bool CheckTouchPointRegion(struct input_event readBuffer[], const AbsInfo& absInfo); - size_t CollectEvent(RawEvent* buffer, size_t& capacity, Device* device, struct input_event readBuffer[], + bool CheckTouchPointRegion(struct input_event readBuffer[], const AbsInfo &absInfo); + size_t CollectEvent(RawEvent *buffer, size_t &capacity, Device *device, struct input_event readBuffer[], const size_t count); /* * isEnable: true for sharing dhid, false for no sharing dhid diff --git a/dfx_utils/include/hidumper.h b/dfx_utils/include/hidumper.h index ef487ca..c5bb91c 100644 --- a/dfx_utils/include/hidumper.h +++ b/dfx_utils/include/hidumper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -54,20 +54,20 @@ class HiDumper { DECLARE_SINGLE_INSTANCE_BASE(HiDumper); public: - bool HiDump(const std::vector& args, std::string& result); - void SaveNodeInfo(const std::string& deviceId, const std::string& nodeName, const std::string& dhId); - void DeleteNodeInfo(const std::string& deviceId, const std::string& dhId); - void CreateSessionInfo(const std::string& remoteDevId, const int32_t& sessionId, const std::string& mySessionName, - const std::string& peerSessionName, const SessionStatus& sessionStatus); - void SetSessionStatus(const std::string& remoteDevId, const SessionStatus& sessionStatus); - void DeleteSessionInfo(const std::string& remoteDevId); + bool HiDump(const std::vector &args, std::string &result); + void SaveNodeInfo(const std::string &deviceId, const std::string &nodeName, const std::string &dhId); + void DeleteNodeInfo(const std::string &deviceId, const std::string &dhId); + void CreateSessionInfo(const std::string &remoteDevId, const int32_t &sessionId, const std::string &mySessionName, + const std::string &peerSessionName, const SessionStatus &sessionStatus); + void SetSessionStatus(const std::string &remoteDevId, const SessionStatus &sessionStatus); + void DeleteSessionInfo(const std::string &remoteDevId); private: explicit HiDumper() = default; ~HiDumper() = default; - int32_t ProcessDump(const std::string& args, std::string& result); - int32_t GetAllNodeInfos(std::string& result); - int32_t GetSessionInfo(std::string& result); - int32_t ShowHelp(std::string& result); + int32_t ProcessDump(const std::string &args, std::string &result); + int32_t GetAllNodeInfos(std::string &result); + int32_t GetSessionInfo(std::string &result); + int32_t ShowHelp(std::string &result); private: std::vector nodeInfos_; std::mutex nodeMutex_; diff --git a/dfx_utils/src/hidumper.cpp b/dfx_utils/src/hidumper.cpp index 82a9918..a7febfc 100644 --- a/dfx_utils/src/hidumper.cpp +++ b/dfx_utils/src/hidumper.cpp @@ -43,7 +43,7 @@ namespace { }; } -bool HiDumper::HiDump(const std::vector& args, std::string& result) +bool HiDumper::HiDump(const std::vector &args, std::string &result) { if (args.empty()) { DHLOGE("args is empty"); @@ -61,7 +61,7 @@ bool HiDumper::HiDump(const std::vector& args, std::string& result) return true; } -int32_t HiDumper::ProcessDump(const std::string& args, std::string& result) +int32_t HiDumper::ProcessDump(const std::string &args, std::string &result) { DHLOGI("ProcessDump Dump."); int32_t ret = ERR_DH_INPUT_HIDUMP_INVALID_ARGS; @@ -98,7 +98,7 @@ int32_t HiDumper::ProcessDump(const std::string& args, std::string& result) return ret; } -int32_t HiDumper::GetAllNodeInfos(std::string& result) +int32_t HiDumper::GetAllNodeInfos(std::string &result) { DHLOGI("GetAllNodeInfos Dump."); std::lock_guard node_lock(nodeMutex_); @@ -115,7 +115,7 @@ int32_t HiDumper::GetAllNodeInfos(std::string& result) return DH_SUCCESS; } -void HiDumper::DeleteNodeInfo(const std::string& deviceId, const std::string& dhId) +void HiDumper::DeleteNodeInfo(const std::string &deviceId, const std::string &dhId) { DHLOGI("DeleteNodeInfo Dump."); std::lock_guard node_lock(nodeMutex_); @@ -128,7 +128,7 @@ void HiDumper::DeleteNodeInfo(const std::string& deviceId, const std::string& dh } } -int32_t HiDumper::GetSessionInfo(std::string& result) +int32_t HiDumper::GetSessionInfo(std::string &result) { DHLOGI("GetSessionInfo Dump."); std::lock_guard lock(sessionMutex_); @@ -157,7 +157,7 @@ int32_t HiDumper::GetSessionInfo(std::string& result) return DH_SUCCESS; } -void HiDumper::DeleteSessionInfo(const std::string& remoteDevId) +void HiDumper::DeleteSessionInfo(const std::string &remoteDevId) { DHLOGI("DeleteSessionInfo Dump."); std::lock_guard session_lock(sessionMutex_); @@ -182,7 +182,7 @@ int32_t HiDumper::ShowHelp(std::string &result) return DH_SUCCESS; } -void HiDumper::SaveNodeInfo(const std::string& deviceId, const std::string& nodeName, const std::string& dhId) +void HiDumper::SaveNodeInfo(const std::string &deviceId, const std::string &nodeName, const std::string &dhId) { std::lock_guard node_lock(nodeMutex_); NodeInfo nodeInfo = { @@ -193,8 +193,8 @@ void HiDumper::SaveNodeInfo(const std::string& deviceId, const std::string& node nodeInfos_.push_back(nodeInfo); } -void HiDumper::CreateSessionInfo(const std::string& remoteDevId, const int32_t& sessionId, - const std::string& mySessionName, const std::string& peerSessionName, const SessionStatus& sessionStatus) +void HiDumper::CreateSessionInfo(const std::string &remoteDevId, const int32_t &sessionId, + const std::string &mySessionName, const std::string &peerSessionName, const SessionStatus &sessionStatus) { std::lock_guard session_lock(sessionMutex_); auto iter = sessionInfos_.find(remoteDevId); @@ -209,7 +209,7 @@ void HiDumper::CreateSessionInfo(const std::string& remoteDevId, const int32_t& } } -void HiDumper::SetSessionStatus(const std::string& remoteDevId, const SessionStatus& sessionStatus) +void HiDumper::SetSessionStatus(const std::string &remoteDevId, const SessionStatus &sessionStatus) { std::lock_guard session_lock(sessionMutex_); auto iter = sessionInfos_.find(remoteDevId); diff --git a/frameworks/include/i_add_white_list_infos_call_back.h b/frameworks/include/i_add_white_list_infos_call_back.h index 187a7a0..ef2d3e0 100644 --- a/frameworks/include/i_add_white_list_infos_call_back.h +++ b/frameworks/include/i_add_white_list_infos_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IAddWhiteListInfosCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& deviceId, const std::string& strJson) = 0; + virtual void OnResult(const std::string &deviceId, const std::string &strJson) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_del_white_list_infos_call_back.h b/frameworks/include/i_del_white_list_infos_call_back.h index ea36bdd..27f786b 100644 --- a/frameworks/include/i_del_white_list_infos_call_back.h +++ b/frameworks/include/i_del_white_list_infos_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IDelWhiteListInfosCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& deviceId) = 0; + virtual void OnResult(const std::string &deviceId) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_distributed_sink_input.h b/frameworks/include/i_distributed_sink_input.h index 733fb7b..71cb247 100644 --- a/frameworks/include/i_distributed_sink_input.h +++ b/frameworks/include/i_distributed_sink_input.h @@ -48,7 +48,7 @@ public: * NotifyStartDScreen and NotifyStopDScreen are RPC interface, * which are used for interacting by dinput source and dinput sink */ - virtual int32_t NotifyStartDScreen(const SrcScreenInfo& remoteCtrlInfo) = 0; + virtual int32_t NotifyStartDScreen(const SrcScreenInfo &remoteCtrlInfo) = 0; virtual int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey) = 0; diff --git a/frameworks/include/i_distributed_source_input.h b/frameworks/include/i_distributed_source_input.h index f84f87c..5df8843 100644 --- a/frameworks/include/i_distributed_source_input.h +++ b/frameworks/include/i_distributed_source_input.h @@ -48,11 +48,11 @@ public: virtual int32_t Release() = 0; virtual int32_t RegisterDistributedHardware( - const std::string& devId, const std::string& dhId, const std::string& parameters, + const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback) = 0; virtual int32_t UnregisterDistributedHardware( - const std::string& devId, const std::string& dhId, + const std::string &devId, const std::string &dhId, sptr callback) = 0; virtual int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) = 0; @@ -60,10 +60,10 @@ public: virtual int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) = 0; virtual int32_t StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) = 0; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) = 0; virtual int32_t StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) = 0; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) = 0; virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) = 0; diff --git a/frameworks/include/i_get_sink_screen_infos_call_back.h b/frameworks/include/i_get_sink_screen_infos_call_back.h index d19cc67..646a2cd 100644 --- a/frameworks/include/i_get_sink_screen_infos_call_back.h +++ b/frameworks/include/i_get_sink_screen_infos_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IGetSinkScreenInfosCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& strJson) = 0; + virtual void OnResult(const std::string &strJson) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_prepare_d_input_call_back.h b/frameworks/include/i_prepare_d_input_call_back.h index f5ab6fd..cfb351b 100644 --- a/frameworks/include/i_prepare_d_input_call_back.h +++ b/frameworks/include/i_prepare_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IPrepareDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_register_d_input_call_back.h b/frameworks/include/i_register_d_input_call_back.h index eb00f69..80baecc 100644 --- a/frameworks/include/i_register_d_input_call_back.h +++ b/frameworks/include/i_register_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IRegisterDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_start_d_input_call_back.h b/frameworks/include/i_start_d_input_call_back.h index b4be761..8c02692 100644 --- a/frameworks/include/i_start_d_input_call_back.h +++ b/frameworks/include/i_start_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IStartDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_stop_d_input_call_back.h b/frameworks/include/i_stop_d_input_call_back.h index e710e44..c54cd1d 100644 --- a/frameworks/include/i_stop_d_input_call_back.h +++ b/frameworks/include/i_stop_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IStopDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_unprepare_d_input_call_back.h b/frameworks/include/i_unprepare_d_input_call_back.h index 6d833b5..9fb398d 100644 --- a/frameworks/include/i_unprepare_d_input_call_back.h +++ b/frameworks/include/i_unprepare_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IUnprepareDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/frameworks/include/i_unregister_d_input_call_back.h b/frameworks/include/i_unregister_d_input_call_back.h index 72f807f..17e30a5 100644 --- a/frameworks/include/i_unregister_d_input_call_back.h +++ b/frameworks/include/i_unregister_d_input_call_back.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -25,7 +25,7 @@ namespace DistributedHardware { namespace DistributedInput { class IUnregisterDInputCallback : public IRemoteBroker { public: - virtual void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) = 0; + virtual void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) = 0; enum class Message { RESULT, diff --git a/inputdevicehandler/include/distributed_input_handler.h b/inputdevicehandler/include/distributed_input_handler.h index 9b3ed2a..16087a8 100644 --- a/inputdevicehandler/include/distributed_input_handler.h +++ b/inputdevicehandler/include/distributed_input_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -52,8 +52,8 @@ public: private: DistributedInputHandler(); ~DistributedInputHandler(); - void StructTransJson(const InputDevice& pBuf, std::string& strDescriptor); - int32_t GetDeviceInfo(std::string& deviceId); + void StructTransJson(const InputDevice &pBuf, std::string &strDescriptor); + int32_t GetDeviceInfo(std::string &deviceId); std::shared_ptr m_listener; bool InitCollectEventsThread(); void NotifyHardWare(int iCnt); diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index c20dc04..6c0a5f0 100644 --- a/inputdevicehandler/src/distributed_input_handler.cpp +++ b/inputdevicehandler/src/distributed_input_handler.cpp @@ -53,7 +53,7 @@ DistributedInputHandler::~DistributedInputHandler() StopInputMonitorDeviceThread(); } -void DistributedInputHandler::StructTransJson(const InputDevice& pBuf, std::string& strDescriptor) +void DistributedInputHandler::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) { DHLOGI("[%s] %d, %d, %d, %d, %s.\n", (pBuf.name).c_str(), pBuf.bus, pBuf.vendor, pBuf.product, pBuf.version, GetAnonyString(pBuf.descriptor).c_str()); @@ -142,7 +142,7 @@ void DistributedInputHandler::UnRegisterPluginListener() this->m_listener = nullptr; } -int32_t DistributedInputHandler::GetDeviceInfo(std::string& deviceId) +int32_t DistributedInputHandler::GetDeviceInfo(std::string &deviceId) { std::unique_lock my_lock(operationMutex_); auto localNode = std::make_unique(); diff --git a/interfaces/inner_kits/include/distributed_input_kit.h b/interfaces/inner_kits/include/distributed_input_kit.h index 9a9039f..172a5e2 100644 --- a/interfaces/inner_kits/include/distributed_input_kit.h +++ b/interfaces/inner_kits/include/distributed_input_kit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -37,8 +37,8 @@ namespace DistributedInput { class DistributedInputKit { public: - static int32_t PrepareRemoteInput(const std::string& sinkId, sptr callback); - static int32_t UnprepareRemoteInput(const std::string& sinkId, sptr callback); + static int32_t PrepareRemoteInput(const std::string &sinkId, sptr callback); + static int32_t UnprepareRemoteInput(const std::string &sinkId, sptr callback); static int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback); @@ -46,9 +46,9 @@ public: sptr callback); static int32_t StartRemoteInput( - const std::string& sinkId, const uint32_t& inputTypes, sptr callback); + const std::string &sinkId, const uint32_t &inputTypes, sptr callback); static int32_t StopRemoteInput( - const std::string& sinkId, const uint32_t& inputTypes, sptr callback); + const std::string &sinkId, const uint32_t &inputTypes, sptr callback); static int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback); @@ -68,13 +68,13 @@ public: static bool IsNeedFilterOut(const std::string &sinkId, const BusinessEvent &event); static bool IsTouchEventNeedFilterOut(const TouchScreenEvent &event); - static DInputServerType IsStartDistributedInput(const uint32_t& inputType); + static DInputServerType IsStartDistributedInput(const uint32_t &inputType); /* * check is dhId sharing to other devices * true: dhId sharing to other device * false: dhId NOT sharing to other device */ - static bool IsStartDistributedInput(const std::string& dhId); + static bool IsStartDistributedInput(const std::string &dhId); static int32_t RegisterInputNodeListener(sptr listener); static int32_t UnregisterInputNodeListener(sptr listener); diff --git a/interfaces/inner_kits/src/distributed_input_kit.cpp b/interfaces/inner_kits/src/distributed_input_kit.cpp index 480fe7f..6c88b71 100644 --- a/interfaces/inner_kits/src/distributed_input_kit.cpp +++ b/interfaces/inner_kits/src/distributed_input_kit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -19,25 +19,25 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { int32_t DistributedInputKit::PrepareRemoteInput( - const std::string& sinkId, sptr callback) + const std::string &sinkId, sptr callback) { return DistributedInputClient::GetInstance().PrepareRemoteInput(sinkId, callback); } int32_t DistributedInputKit::UnprepareRemoteInput( - const std::string& sinkId, sptr callback) + const std::string &sinkId, sptr callback) { return DistributedInputClient::GetInstance().UnprepareRemoteInput(sinkId, callback); } int32_t DistributedInputKit::StartRemoteInput( - const std::string& sinkId, const uint32_t& inputTypes, sptr callback) + const std::string &sinkId, const uint32_t &inputTypes, sptr callback) { return DistributedInputClient::GetInstance().StartRemoteInput(sinkId, inputTypes, callback); } int32_t DistributedInputKit::StopRemoteInput( - const std::string& sinkId, const uint32_t& inputTypes, sptr callback) + const std::string &sinkId, const uint32_t &inputTypes, sptr callback) { return DistributedInputClient::GetInstance().StopRemoteInput(sinkId, inputTypes, callback); } @@ -54,7 +54,7 @@ int32_t DistributedInputKit::StopRemoteInput(const std::string &srcId, const std return DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, inputTypes, callback); } -bool DistributedInputKit::IsNeedFilterOut(const std::string& sinkId, const BusinessEvent& event) +bool DistributedInputKit::IsNeedFilterOut(const std::string &sinkId, const BusinessEvent &event) { return DistributedInputClient::GetInstance().IsNeedFilterOut(sinkId, event); } @@ -64,12 +64,12 @@ bool DistributedInputKit::IsTouchEventNeedFilterOut(const TouchScreenEvent &even return DistributedInputClient::GetInstance().IsTouchEventNeedFilterOut(event); } -DInputServerType DistributedInputKit::IsStartDistributedInput(const uint32_t& inputType) +DInputServerType DistributedInputKit::IsStartDistributedInput(const uint32_t &inputType) { return DInputServerType::NULL_SERVER_TYPE; } -bool DistributedInputKit::IsStartDistributedInput(const std::string& dhId) +bool DistributedInputKit::IsStartDistributedInput(const std::string &dhId) { return DistributedInputClient::GetInstance().IsStartDistributedInput(dhId); } diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp index f38a6af..60c4cea 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp @@ -44,7 +44,7 @@ void DistributedInputInnerTest::TearDownTestCase() } void DistributedInputInnerTest::TestPrepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -52,7 +52,7 @@ void DistributedInputInnerTest::TestPrepareDInputCallback::OnResult( } void DistributedInputInnerTest::TestUnprepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -60,7 +60,7 @@ void DistributedInputInnerTest::TestUnprepareDInputCallback::OnResult( } void DistributedInputInnerTest::TestStartDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -69,7 +69,7 @@ void DistributedInputInnerTest::TestStartDInputCallback::OnResult( } void DistributedInputInnerTest::TestStopDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h index 3eb3cd1..a9ab92b 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -55,7 +55,7 @@ public: public: TestPrepareDInputCallback() = default; virtual ~TestPrepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestUnprepareDInputCallback : public @@ -63,7 +63,7 @@ public: public: TestUnprepareDInputCallback() = default; virtual ~TestUnprepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestStartDInputCallback : public @@ -71,7 +71,7 @@ public: public: TestStartDInputCallback() = default; virtual ~TestStartDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStopDInputCallback : public @@ -79,7 +79,7 @@ public: public: TestStopDInputCallback() = default; virtual ~TestStopDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStartStopDInputCallback : public diff --git a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp index 46ebcd7..b271e2e 100644 --- a/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp +++ b/interfaces/inner_kits/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -26,7 +26,7 @@ namespace OHOS { namespace DistributedHardware { namespace DistributedInput { -std::shared_ptr DistributedInputClient::instance(new DistributedInputClient()); +std::shared_ptr DistributedInputClient::instance = std::make_shared(); DistributedInputClient::DistributedInputClient() {} @@ -36,7 +36,7 @@ DistributedInputClient &DistributedInputClient::GetInstance() } void DistributedInputClient::RegisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkRstInfos.end(); ++iter) { @@ -49,7 +49,7 @@ void DistributedInputClient::RegisterDInputCb::OnResult( } void DistributedInputClient::UnregisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.end(); ++iter) { @@ -78,7 +78,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } -void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId) +void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string &deviceId) { WhiteListUtil::GetInstance().ClearWhiteList(deviceId); } @@ -103,20 +103,20 @@ int32_t DistributedInputClient::ReleaseSink() return DH_SUCCESS; } -int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, const std::shared_ptr& callback) +int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, const std::shared_ptr &callback) { return DH_SUCCESS; } -int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::shared_ptr& callback) +int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::shared_ptr &callback) { return DH_SUCCESS; } int32_t DistributedInputClient::PrepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } @@ -128,7 +128,7 @@ int32_t DistributedInputClient::PrepareRemoteInput( } int32_t DistributedInputClient::UnprepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } @@ -140,7 +140,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput( } int32_t DistributedInputClient::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } @@ -152,7 +152,7 @@ int32_t DistributedInputClient::StartRemoteInput( } int32_t DistributedInputClient::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } @@ -187,7 +187,7 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const return DH_SUCCESS; } -bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event) +bool DistributedInputClient::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { return true; } @@ -213,7 +213,7 @@ bool DistributedInputClient::IsJsonData(std::string strData) const return true; } -bool DistributedInputClient::IsStartDistributedInput(const std::string& dhId) +bool DistributedInputClient::IsStartDistributedInput(const std::string &dhId) { return true; } diff --git a/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h b/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h index 276af7c..81b5704 100644 --- a/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h +++ b/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit AddWhiteListInfosCallbackProxy(const sptr &object); ~AddWhiteListInfosCallbackProxy() override; - void OnResult(const std::string& deviceId, const std::string& strJson) override; + void OnResult(const std::string &deviceId, const std::string &strJson) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h b/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h index 9a06867..88259cc 100644 --- a/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h +++ b/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit DelWhiteListInfosCallbackProxy(const sptr &object); ~DelWhiteListInfosCallbackProxy() override; - void OnResult(const std::string& deviceId) override; + void OnResult(const std::string &deviceId) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/distributed_input_client.h b/interfaces/ipc/include/distributed_input_client.h index 29745fa..cd0adfe 100644 --- a/interfaces/ipc/include/distributed_input_client.h +++ b/interfaces/ipc/include/distributed_input_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -56,21 +56,21 @@ public: int32_t ReleaseSink(); - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, const std::shared_ptr& callback); + int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, const std::shared_ptr &callback); - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::shared_ptr& callback); + int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::shared_ptr &callback); - int32_t PrepareRemoteInput(const std::string& deviceId, sptr callback); + int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback); - int32_t UnprepareRemoteInput(const std::string& deviceId, sptr callback); + int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback); int32_t StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback); + const std::string &deviceId, const uint32_t &inputTypes, sptr callback); int32_t StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback); + const std::string &deviceId, const uint32_t &inputTypes, sptr callback); int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback); @@ -96,10 +96,10 @@ public: bool IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event); bool IsTouchEventNeedFilterOut(const TouchScreenEvent &event); - bool IsStartDistributedInput(const std::string& dhId); + bool IsStartDistributedInput(const std::string &dhId); - int32_t NotifyStartDScreen(const std::string &networkId, const std::string& srcDevId, const uint64_t srcWinId); - int32_t NotifyStopDScreen(const std::string &networkId, const std::string& srcScreenInfoKey); + int32_t NotifyStartDScreen(const std::string &networkId, const std::string &srcDevId, const uint64_t srcWinId); + int32_t NotifyStopDScreen(const std::string &networkId, const std::string &srcScreenInfoKey); int32_t RegisterInputNodeListener(sptr listener); int32_t UnregisterInputNodeListener(sptr listener); @@ -121,14 +121,14 @@ public: public: RegisterDInputCb() = default; ~RegisterDInputCb() override = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override; }; class UnregisterDInputCb : public OHOS::DistributedHardware::DistributedInput::UnregisterDInputCallbackStub { public: UnregisterDInputCb() = default; ~UnregisterDInputCb() override = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override; }; class AddWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::AddWhiteListInfosCallbackStub { diff --git a/interfaces/ipc/include/distributed_input_sink_proxy.h b/interfaces/ipc/include/distributed_input_sink_proxy.h index b65df5a..4a13b01 100644 --- a/interfaces/ipc/include/distributed_input_sink_proxy.h +++ b/interfaces/ipc/include/distributed_input_sink_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -39,8 +39,8 @@ public: int32_t RegisterGetSinkScreenInfosCallback(sptr callback) override; - int32_t NotifyStartDScreen(const SrcScreenInfo& srcScreenRemoteCtrlInfo) override; - int32_t NotifyStopDScreen(const std::string& srcScreenInfoKey) override; + int32_t NotifyStartDScreen(const SrcScreenInfo &srcScreenRemoteCtrlInfo) override; + int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey) override; int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener) override; diff --git a/interfaces/ipc/include/distributed_input_source_proxy.h b/interfaces/ipc/include/distributed_input_source_proxy.h index a602e63..1370711 100644 --- a/interfaces/ipc/include/distributed_input_source_proxy.h +++ b/interfaces/ipc/include/distributed_input_source_proxy.h @@ -34,10 +34,10 @@ public: int32_t Release() override; - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, sptr callback) override; + int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, sptr callback) override; - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, sptr callback) override; int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; @@ -45,10 +45,10 @@ public: int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; int32_t StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) override; int32_t StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) override; int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; diff --git a/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h b/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h index fd5b1d2..77367d5 100644 --- a/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h +++ b/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -30,7 +30,7 @@ public: explicit GetSinkScreenInfosCallbackProxy(const sptr &object); ~GetSinkScreenInfosCallbackProxy() override; - void OnResult(const std::string& strJson) override; + void OnResult(const std::string &strJson) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/prepare_d_input_call_back_proxy.h b/interfaces/ipc/include/prepare_d_input_call_back_proxy.h index 9e50268..c8ca588 100644 --- a/interfaces/ipc/include/prepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/prepare_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit PrepareDInputCallbackProxy(const sptr &object); ~PrepareDInputCallbackProxy() override; - void OnResult(const std::string& deviceId, const int32_t& status) override; + void OnResult(const std::string &deviceId, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/register_d_input_call_back_proxy.h b/interfaces/ipc/include/register_d_input_call_back_proxy.h index fc2ab42..686ef3d 100644 --- a/interfaces/ipc/include/register_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/register_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit RegisterDInputCallbackProxy(const sptr &object); ~RegisterDInputCallbackProxy() override; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/start_d_input_call_back_proxy.h b/interfaces/ipc/include/start_d_input_call_back_proxy.h index b81a3b9..7239628 100644 --- a/interfaces/ipc/include/start_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/start_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit StartDInputCallbackProxy(const sptr &object); ~StartDInputCallbackProxy() override; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/stop_d_input_call_back_proxy.h b/interfaces/ipc/include/stop_d_input_call_back_proxy.h index 92b28d2..67def3c 100644 --- a/interfaces/ipc/include/stop_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/stop_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit StopDInputCallbackProxy(const sptr &object); ~StopDInputCallbackProxy() override; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h b/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h index bae5928..50ab867 100644 --- a/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit UnprepareDInputCallbackProxy(const sptr &object); ~UnprepareDInputCallbackProxy() override; - void OnResult(const std::string& deviceId, const int32_t& status) override; + void OnResult(const std::string &deviceId, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/unregister_d_input_call_back_proxy.h b/interfaces/ipc/include/unregister_d_input_call_back_proxy.h index 6502ce3..2c51676 100644 --- a/interfaces/ipc/include/unregister_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unregister_d_input_call_back_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ public: explicit UnregisterDInputCallbackProxy(const sptr &object); ~UnregisterDInputCallbackProxy() override; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/src/add_white_list_infos_call_back_proxy.cpp b/interfaces/ipc/src/add_white_list_infos_call_back_proxy.cpp index 9ec6247..c6ba5dd 100644 --- a/interfaces/ipc/src/add_white_list_infos_call_back_proxy.cpp +++ b/interfaces/ipc/src/add_white_list_infos_call_back_proxy.cpp @@ -32,7 +32,7 @@ AddWhiteListInfosCallbackProxy::~AddWhiteListInfosCallbackProxy() { } -void AddWhiteListInfosCallbackProxy::OnResult(const std::string& deviceId, const std::string& strJson) +void AddWhiteListInfosCallbackProxy::OnResult(const std::string &deviceId, const std::string &strJson) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/del_white_list_infos_call_back_proxy.cpp b/interfaces/ipc/src/del_white_list_infos_call_back_proxy.cpp index 4b1f715..66e7cbf 100644 --- a/interfaces/ipc/src/del_white_list_infos_call_back_proxy.cpp +++ b/interfaces/ipc/src/del_white_list_infos_call_back_proxy.cpp @@ -32,7 +32,7 @@ DelWhiteListInfosCallbackProxy::~DelWhiteListInfosCallbackProxy() { } -void DelWhiteListInfosCallbackProxy::OnResult(const std::string& deviceId) +void DelWhiteListInfosCallbackProxy::OnResult(const std::string &deviceId) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index e784874..8b00a9d 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -50,7 +50,7 @@ DistributedInputClient &DistributedInputClient::GetInstance() } void DistributedInputClient::RegisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { std::lock_guard lock(DistributedInputClient::GetInstance().operationMutex_); for (std::vector::iterator iter = @@ -66,7 +66,7 @@ void DistributedInputClient::RegisterDInputCb::OnResult( } void DistributedInputClient::UnregisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { std::lock_guard lock(DistributedInputClient::GetInstance().operationMutex_); for (std::vector::iterator iter = @@ -88,7 +88,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de } } -void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId) +void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string &deviceId) { DistributedInputClient::GetInstance().DelWhiteListInfos(deviceId); } @@ -321,8 +321,8 @@ int32_t DistributedInputClient::ReleaseSink() return DInputSAManager::GetInstance().dInputSinkProxy_->Release(); } -int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, const std::shared_ptr& callback) +int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, const std::shared_ptr &callback) { DHLOGI("DinputRegister called, deviceId: %s, dhId: %s, parameters: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), SetAnonyId(parameters).c_str()); @@ -348,8 +348,8 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& d new(std::nothrow) RegisterDInputCb()); } -int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::shared_ptr& callback) +int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::shared_ptr &callback) { DHLOGI("DinputUnregister called, deviceId: %s, dhId: %s.", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); @@ -375,7 +375,7 @@ int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& new(std::nothrow) UnregisterDInputCb()); } -int32_t DistributedInputClient::PrepareRemoteInput(const std::string& deviceId, sptr callback) +int32_t DistributedInputClient::PrepareRemoteInput(const std::string &deviceId, sptr callback) { DHLOGI("DinputPrepare called, deviceId: %s.", GetAnonyString(deviceId).c_str()); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { @@ -388,7 +388,7 @@ int32_t DistributedInputClient::PrepareRemoteInput(const std::string& deviceId, return DInputSAManager::GetInstance().dInputSourceProxy_->PrepareRemoteInput(deviceId, callback); } -int32_t DistributedInputClient::UnprepareRemoteInput(const std::string& deviceId, +int32_t DistributedInputClient::UnprepareRemoteInput(const std::string &deviceId, sptr callback) { DHLOGI("DinputUnprepare called, deviceId: %s.", GetAnonyString(deviceId).c_str()); @@ -403,7 +403,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput(const std::string& deviceId } int32_t DistributedInputClient::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { DHLOGI("DinputStart called, deviceId: %s, inputTypes: %d.", GetAnonyString(deviceId).c_str(), inputTypes); if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) { @@ -416,7 +416,7 @@ int32_t DistributedInputClient::StartRemoteInput( return DInputSAManager::GetInstance().dInputSourceProxy_->StartRemoteInput(deviceId, inputTypes, callback); } -int32_t DistributedInputClient::StopRemoteInput(const std::string& deviceId, const uint32_t& inputTypes, +int32_t DistributedInputClient::StopRemoteInput(const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { DHLOGI("DinputStop called, deviceId: %s, inputTypes: %d.", GetAnonyString(deviceId).c_str(), inputTypes); @@ -547,7 +547,7 @@ int32_t DistributedInputClient::StopRemoteInput(const std::string &srcId, const return DInputSAManager::GetInstance().dInputSourceProxy_->StopRemoteInput(srcId, sinkId, dhIds, callback); } -bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event) +bool DistributedInputClient::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { DHLOGI("IsNeedFilterOut called, deviceId: %s", GetAnonyString(deviceId).c_str()); if (deviceId.empty() || (deviceId.size() > DEV_ID_LENGTH_MAX)) { @@ -570,7 +570,7 @@ bool DistributedInputClient::IsTouchEventNeedFilterOut(const TouchScreenEvent &e return false; } -bool DistributedInputClient::IsStartDistributedInput(const std::string& dhId) +bool DistributedInputClient::IsStartDistributedInput(const std::string &dhId) { std::lock_guard lock(sharingDhIdsMtx_); if (dhId.empty() || (dhId.size() > DH_ID_LENGTH_MAX)) { @@ -739,7 +739,7 @@ void DistributedInputClient::UpdateSinkScreenInfos(const std::string &strJson) } } -int32_t DistributedInputClient::NotifyStartDScreen(const std::string &sinkDevId, const std::string& srcDevId, +int32_t DistributedInputClient::NotifyStartDScreen(const std::string &sinkDevId, const std::string &srcDevId, const uint64_t srcWinId) { sptr remoteDInput = GetRemoteDInput(sinkDevId); @@ -762,7 +762,7 @@ int32_t DistributedInputClient::NotifyStartDScreen(const std::string &sinkDevId, return ret; } -int32_t DistributedInputClient::NotifyStopDScreen(const std::string &networkId, const std::string& srcScreenInfoKey) +int32_t DistributedInputClient::NotifyStopDScreen(const std::string &networkId, const std::string &srcScreenInfoKey) { sptr remoteDInput = GetRemoteDInput(networkId); if (remoteDInput == nullptr || !remoteDInput->AsObject()) { diff --git a/interfaces/ipc/src/distributed_input_source_proxy.cpp b/interfaces/ipc/src/distributed_input_source_proxy.cpp index 30981af..c327407 100644 --- a/interfaces/ipc/src/distributed_input_source_proxy.cpp +++ b/interfaces/ipc/src/distributed_input_source_proxy.cpp @@ -61,8 +61,8 @@ int32_t DistributedInputSourceProxy::Release() return result; } -int32_t DistributedInputSourceProxy::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, sptr callback) +int32_t DistributedInputSourceProxy::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, sptr callback) { MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { @@ -94,7 +94,7 @@ int32_t DistributedInputSourceProxy::RegisterDistributedHardware(const std::stri return result; } -int32_t DistributedInputSourceProxy::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, +int32_t DistributedInputSourceProxy::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, sptr callback) { MessageParcel data; @@ -177,7 +177,7 @@ int32_t DistributedInputSourceProxy::UnprepareRemoteInput(const std::string &dev } int32_t DistributedInputSourceProxy::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { DHLOGI("source proxy StartRemoteInput start"); MessageParcel data; @@ -208,7 +208,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput( } int32_t DistributedInputSourceProxy::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { @@ -236,8 +236,8 @@ int32_t DistributedInputSourceProxy::StopRemoteInput( return result; } -int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string& srcId, const std::string& sinkId, - const uint32_t& inputTypes, sptr callback) +int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &srcId, const std::string &sinkId, + const uint32_t &inputTypes, sptr callback) { DHLOGI("source proxy StartRemoteInput start"); MessageParcel data; @@ -272,8 +272,8 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string& srcId, return result; } -int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string& srcId, const std::string& sinkId, - const uint32_t& inputTypes, sptr callback) +int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string &srcId, const std::string &sinkId, + const uint32_t &inputTypes, sptr callback) { MessageParcel data; if (!data.WriteInterfaceToken(GetDescriptor())) { diff --git a/interfaces/ipc/src/get_sink_screen_infos_call_back_proxy.cpp b/interfaces/ipc/src/get_sink_screen_infos_call_back_proxy.cpp index 30a77ca..543a3a1 100644 --- a/interfaces/ipc/src/get_sink_screen_infos_call_back_proxy.cpp +++ b/interfaces/ipc/src/get_sink_screen_infos_call_back_proxy.cpp @@ -32,7 +32,7 @@ GetSinkScreenInfosCallbackProxy::~GetSinkScreenInfosCallbackProxy() { } -void GetSinkScreenInfosCallbackProxy::OnResult(const std::string& strJson) +void GetSinkScreenInfosCallbackProxy::OnResult(const std::string &strJson) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/prepare_d_input_call_back_proxy.cpp b/interfaces/ipc/src/prepare_d_input_call_back_proxy.cpp index e27c1ed..6ce922e 100644 --- a/interfaces/ipc/src/prepare_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/prepare_d_input_call_back_proxy.cpp @@ -32,7 +32,7 @@ PrepareDInputCallbackProxy::~PrepareDInputCallbackProxy() { } -void PrepareDInputCallbackProxy::OnResult(const std::string& deviceId, const int32_t& status) +void PrepareDInputCallbackProxy::OnResult(const std::string &deviceId, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/register_d_input_call_back_proxy.cpp b/interfaces/ipc/src/register_d_input_call_back_proxy.cpp index 92cfd45..b8c01fe 100644 --- a/interfaces/ipc/src/register_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/register_d_input_call_back_proxy.cpp @@ -32,7 +32,7 @@ RegisterDInputCallbackProxy::~RegisterDInputCallbackProxy() { } -void RegisterDInputCallbackProxy::OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) +void RegisterDInputCallbackProxy::OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/start_d_input_call_back_proxy.cpp b/interfaces/ipc/src/start_d_input_call_back_proxy.cpp index de77a25..7c06d7b 100644 --- a/interfaces/ipc/src/start_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/start_d_input_call_back_proxy.cpp @@ -32,7 +32,7 @@ StartDInputCallbackProxy::~StartDInputCallbackProxy() { } -void StartDInputCallbackProxy::OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) +void StartDInputCallbackProxy::OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/stop_d_input_call_back_proxy.cpp b/interfaces/ipc/src/stop_d_input_call_back_proxy.cpp index dd787fd..8657cd0 100644 --- a/interfaces/ipc/src/stop_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/stop_d_input_call_back_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -32,7 +32,7 @@ StopDInputCallbackProxy::~StopDInputCallbackProxy() { } -void StopDInputCallbackProxy::OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) +void StopDInputCallbackProxy::OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/unprepare_d_input_call_back_proxy.cpp b/interfaces/ipc/src/unprepare_d_input_call_back_proxy.cpp index ede240e..a6a2804 100644 --- a/interfaces/ipc/src/unprepare_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/unprepare_d_input_call_back_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -32,7 +32,7 @@ UnprepareDInputCallbackProxy::~UnprepareDInputCallbackProxy() { } -void UnprepareDInputCallbackProxy::OnResult(const std::string& deviceId, const int32_t& status) +void UnprepareDInputCallbackProxy::OnResult(const std::string &deviceId, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/unregister_d_input_call_back_proxy.cpp b/interfaces/ipc/src/unregister_d_input_call_back_proxy.cpp index d6e9b49..b7328df 100644 --- a/interfaces/ipc/src/unregister_d_input_call_back_proxy.cpp +++ b/interfaces/ipc/src/unregister_d_input_call_back_proxy.cpp @@ -32,7 +32,7 @@ UnregisterDInputCallbackProxy::~UnregisterDInputCallbackProxy() { } -void UnregisterDInputCallbackProxy::OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) +void UnregisterDInputCallbackProxy::OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp index b8d8570..5b7c14e 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp @@ -36,14 +36,14 @@ void AddWhiteListInfosCallbackTest::TearDownTestCase() { } -void AddWhiteListInfosCallbackTest::TestAddWhiteListInfosCallbackStub::OnResult(const std::string& deviceId, - const std::string& strJson) +void AddWhiteListInfosCallbackTest::TestAddWhiteListInfosCallbackStub::OnResult(const std::string &deviceId, + const std::string &strJson) { deviceId_ = deviceId; strJson_ = strJson; } -void AddWhiteListInfosCallbackTest::TestGetSinkScreenInfosCallbackStub::OnResult(const std::string& strJson) +void AddWhiteListInfosCallbackTest::TestGetSinkScreenInfosCallbackStub::OnResult(const std::string &strJson) { strJson_ = strJson; } @@ -65,15 +65,15 @@ void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOffLine(con sinkNodeId_ = sinkNodeId; } -void AddWhiteListInfosCallbackTest::TestPrepareDInputCallbackStub::OnResult(const std::string& devId, - const int32_t& status) +void AddWhiteListInfosCallbackTest::TestPrepareDInputCallbackStub::OnResult(const std::string &devId, + const int32_t &status) { devId_ = devId; status_ = status; } -void AddWhiteListInfosCallbackTest::TestRegisterDInputCallbackStub::OnResult(const std::string& devId, - const std::string& dhId, const int32_t& status) +void AddWhiteListInfosCallbackTest::TestRegisterDInputCallbackStub::OnResult(const std::string &devId, + const std::string &dhId, const int32_t &status) { devId_ = devId; dhId_ = dhId; @@ -100,8 +100,8 @@ int32_t AddWhiteListInfosCallbackTest::TestSimulationEventListenerStub::OnSimula value_ = value; return DH_SUCCESS; } -void AddWhiteListInfosCallbackTest::TestStartDInputCallbackStub::OnResult(const std::string& devId, - const uint32_t& inputTypes, const int32_t& status) +void AddWhiteListInfosCallbackTest::TestStartDInputCallbackStub::OnResult(const std::string &devId, + const uint32_t &inputTypes, const int32_t &status) { devId_ = devId; inputTypes_ = inputTypes; @@ -131,8 +131,8 @@ void AddWhiteListInfosCallbackTest::TestStartStopResultCallbackStub::OnStop(cons dhIds.swap(dhIds); } -void AddWhiteListInfosCallbackTest::TestStopDInputCallbackStub::OnResult(const std::string& devId, - const uint32_t& inputTypes, const int32_t& status) +void AddWhiteListInfosCallbackTest::TestStopDInputCallbackStub::OnResult(const std::string &devId, + const uint32_t &inputTypes, const int32_t &status) { devId_ = devId; inputTypes_ = inputTypes; @@ -157,7 +157,7 @@ int32_t AddWhiteListInfosCallbackTest::TestDistributedInputSinkStub::RegisterGet } int32_t AddWhiteListInfosCallbackTest::TestDistributedInputSinkStub::NotifyStartDScreen( - const SrcScreenInfo& remoteCtrlInfo) + const SrcScreenInfo &remoteCtrlInfo) { (void)remoteCtrlInfo; return DH_SUCCESS; diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h index 63f2322..624f12c 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -58,7 +58,7 @@ public: public: TestAddWhiteListInfosCallbackStub() = default; virtual ~TestAddWhiteListInfosCallbackStub() = default; - void OnResult(const std::string& deviceId, const std::string& strJson); + void OnResult(const std::string &deviceId, const std::string &strJson); std::string deviceId_; std::string strJson_; }; @@ -68,7 +68,7 @@ public: public: TestGetSinkScreenInfosCallbackStub() = default; virtual ~TestGetSinkScreenInfosCallbackStub() = default; - void OnResult(const std::string& strJson); + void OnResult(const std::string &strJson); std::string strJson_; }; @@ -93,7 +93,7 @@ public: public: TestPrepareDInputCallbackStub() = default; virtual ~TestPrepareDInputCallbackStub() = default; - void OnResult(const std::string& devId, const int32_t& status); + void OnResult(const std::string &devId, const int32_t &status); std::string devId_; int32_t status_ = 0; }; @@ -103,7 +103,7 @@ public: public: TestRegisterDInputCallbackStub() = default; virtual ~TestRegisterDInputCallbackStub() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); std::string devId_; std::string dhId_; int32_t status_ = 0; @@ -135,7 +135,7 @@ public: public: TestStartDInputCallbackStub() = default; virtual ~TestStartDInputCallbackStub() = default; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status); std::string devId_; uint32_t inputTypes_ = 0; int32_t status_ = 0; @@ -168,7 +168,7 @@ public: public: TestStopDInputCallbackStub() = default; virtual ~TestStopDInputCallbackStub() = default; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status); std::string devId_; uint32_t inputTypes_ = 0; int32_t status_ = 0; @@ -182,7 +182,7 @@ public: int32_t Init(); int32_t Release(); int32_t RegisterGetSinkScreenInfosCallback(sptr callback); - int32_t NotifyStartDScreen(const SrcScreenInfo& remoteCtrlInfo); + int32_t NotifyStartDScreen(const SrcScreenInfo &remoteCtrlInfo); int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey); int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener); }; diff --git a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp index 9a1539b..d08527b 100644 --- a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp +++ b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp @@ -44,7 +44,7 @@ void DistributedInputClientTest::TearDownTestCase() { } -int32_t DistributedInputClientTest::StructTransJson(const InputDevice& pBuf, std::string& strDescriptor) const +int32_t DistributedInputClientTest::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) const { nlohmann::json tmpJson; tmpJson["name"] = pBuf.name; @@ -82,7 +82,7 @@ int32_t DistributedInputClientTest::TestUnregisterDInputCallback::OnUnregisterRe } void DistributedInputClientTest::TestPrepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -90,7 +90,7 @@ void DistributedInputClientTest::TestPrepareDInputCallback::OnResult( } void DistributedInputClientTest::TestUnprepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -98,7 +98,7 @@ void DistributedInputClientTest::TestUnprepareDInputCallback::OnResult( } void DistributedInputClientTest::TestStartDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -107,7 +107,7 @@ void DistributedInputClientTest::TestStartDInputCallback::OnResult( } void DistributedInputClientTest::TestStopDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; diff --git a/interfaces/ipc/test/clientunittest/distributed_input_client_test.h b/interfaces/ipc/test/clientunittest/distributed_input_client_test.h index 2119f8d..09c674b 100644 --- a/interfaces/ipc/test/clientunittest/distributed_input_client_test.h +++ b/interfaces/ipc/test/clientunittest/distributed_input_client_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -66,7 +66,7 @@ public: public: TestPrepareDInputCallback() = default; virtual ~TestPrepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestUnprepareDInputCallback : public @@ -74,7 +74,7 @@ public: public: TestUnprepareDInputCallback() = default; virtual ~TestUnprepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestStartDInputCallback : public @@ -82,7 +82,7 @@ public: public: TestStartDInputCallback() = default; virtual ~TestStartDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStopDInputCallback : public @@ -90,7 +90,7 @@ public: public: TestStopDInputCallback() = default; virtual ~TestStopDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStartStopDInputCallback : public @@ -122,7 +122,7 @@ public: }; private: - int32_t StructTransJson(const InputDevice& pBuf, std::string& strDescriptor) const; + int32_t StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) const; }; } // namespace DistributedInput } // namespace DistributedHardware diff --git a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp index abbb981..383919d 100644 --- a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp +++ b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp @@ -34,7 +34,7 @@ void DelWhiteListInfosCallbackTest::TearDownTestCase() { } -void DelWhiteListInfosCallbackTest::TestDelWhiteListInfosCallbackStub::OnResult(const std::string& deviceId) +void DelWhiteListInfosCallbackTest::TestDelWhiteListInfosCallbackStub::OnResult(const std::string &deviceId) { deviceId_ = deviceId; } diff --git a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.h b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.h index e264310..56cb87c 100644 --- a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.h +++ b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -36,7 +36,7 @@ public: public: TestDelWhiteListInfosCallbackStub() = default; virtual ~TestDelWhiteListInfosCallbackStub() = default; - void OnResult(const std::string& deviceId); + void OnResult(const std::string &deviceId); std::string deviceId_; }; }; diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp index 3792a9b..a8bcb50 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp @@ -49,7 +49,7 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::Release() } int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterDistributedHardware( - const std::string& devId, const std::string& dhId, const std::string& parameters, + const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback) { (void)devId; @@ -60,7 +60,7 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterDistribu } int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterDistributedHardware( - const std::string& devId, const std::string& dhId, + const std::string &devId, const std::string &dhId, sptr callback) { (void)devId; @@ -86,7 +86,7 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnprepareRemoteI } int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { (void)deviceId; (void)inputTypes; @@ -95,7 +95,7 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StartRemoteInput } int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { (void)deviceId; (void)inputTypes; @@ -239,15 +239,15 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterSimula return DH_SUCCESS; } -void DInputSourceCallBackTest::TestDInputSourceCallBackStub::OnResult(const std::string& deviceId, - const std::string& strJson) +void DInputSourceCallBackTest::TestDInputSourceCallBackStub::OnResult(const std::string &deviceId, + const std::string &strJson) { deviceId_ = deviceId; strJson_ = strJson; } -void DInputSourceCallBackTest::TestDInputRegisterCallBack::OnResult(const std::string& devId, - const std::string& dhId, const int32_t& status) +void DInputSourceCallBackTest::TestDInputRegisterCallBack::OnResult(const std::string &devId, + const std::string &dhId, const int32_t &status) { (void)devId; (void)dhId; @@ -255,8 +255,8 @@ void DInputSourceCallBackTest::TestDInputRegisterCallBack::OnResult(const std::s return; } -void DInputSourceCallBackTest::TestDInputUnregisterCallBack::OnResult(const std::string& devId, - const std::string& dhId, const int32_t& status) +void DInputSourceCallBackTest::TestDInputUnregisterCallBack::OnResult(const std::string &devId, + const std::string &dhId, const int32_t &status) { (void)devId; (void)dhId; @@ -265,7 +265,7 @@ void DInputSourceCallBackTest::TestDInputUnregisterCallBack::OnResult(const std: } void DInputSourceCallBackTest::TestDInputPrepareCallBack::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -273,7 +273,7 @@ void DInputSourceCallBackTest::TestDInputPrepareCallBack::OnResult( } void DInputSourceCallBackTest::TestDInputUnprepareCallBack::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -281,7 +281,7 @@ void DInputSourceCallBackTest::TestDInputUnprepareCallBack::OnResult( } void DInputSourceCallBackTest::TestDInputStartCallBack::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -290,7 +290,7 @@ void DInputSourceCallBackTest::TestDInputStartCallBack::OnResult( } void DInputSourceCallBackTest::TestDInputStopCallBack::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -315,7 +315,7 @@ void DInputSourceCallBackTest::TestAddWhiteListInfosCallBack::OnResult( } void DInputSourceCallBackTest::TestDelWhiteListInfosCallBack::OnResult( - const std::string& deviceId) + const std::string &deviceId) { (void)deviceId; return; diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h index c104692..b530533 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -54,11 +54,11 @@ public: int32_t Release() ; int32_t RegisterDistributedHardware( - const std::string& devId, const std::string& dhId, const std::string& parameters, + const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback); int32_t UnregisterDistributedHardware( - const std::string& devId, const std::string& dhId, + const std::string &devId, const std::string &dhId, sptr callback); int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback); @@ -66,10 +66,10 @@ public: int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback); int32_t StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback); + const std::string &deviceId, const uint32_t &inputTypes, sptr callback); int32_t StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback); + const std::string &deviceId, const uint32_t &inputTypes, sptr callback); int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback); @@ -104,7 +104,7 @@ public: const std::string &nodeDesc); int32_t RegisterSimulationEventListener(sptr listener); int32_t UnregisterSimulationEventListener(sptr listener); - void OnResult(const std::string& deviceId, const std::string& strJson); + void OnResult(const std::string &deviceId, const std::string &strJson); std::string deviceId_; std::string strJson_; }; @@ -114,7 +114,7 @@ public: public: TestDInputRegisterCallBack() = default; virtual ~TestDInputRegisterCallBack() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); }; class TestDInputUnregisterCallBack : public @@ -122,7 +122,7 @@ public: public: TestDInputUnregisterCallBack() = default; virtual ~TestDInputUnregisterCallBack() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); }; class TestDInputPrepareCallBack : public @@ -130,7 +130,7 @@ public: public: TestDInputPrepareCallBack() = default; virtual ~TestDInputPrepareCallBack() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestDInputUnprepareCallBack : public @@ -138,7 +138,7 @@ public: public: TestDInputUnprepareCallBack() = default; virtual ~TestDInputUnprepareCallBack() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestDInputStartCallBack : public @@ -146,7 +146,7 @@ public: public: TestDInputStartCallBack() = default; virtual ~TestDInputStartCallBack() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestDInputStopCallBack : public @@ -154,7 +154,7 @@ public: public: TestDInputStopCallBack() = default; virtual ~TestDInputStopCallBack() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestVectorStartStopCallBackStub diff --git a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp index 524fe35..8b00d2e 100644 --- a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp +++ b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp @@ -34,8 +34,8 @@ void UnprepareDInputCallbackTest::TearDownTestCase() { } -void UnprepareDInputCallbackTest::TestUnprepareDInputCallbackStub::OnResult(const std::string& deviceId, - const int32_t& status) +void UnprepareDInputCallbackTest::TestUnprepareDInputCallbackStub::OnResult(const std::string &deviceId, + const int32_t &status) { deviceId_ = deviceId; status_ = status; diff --git a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.h b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.h index d43ba69..e7f1ef3 100644 --- a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.h +++ b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -36,7 +36,7 @@ public: public: TestUnprepareDInputCallbackStub() = default; virtual ~TestUnprepareDInputCallbackStub() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); std::string deviceId_; int32_t status_; }; diff --git a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp index 91176a3..01c4e21 100644 --- a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp +++ b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp @@ -34,8 +34,8 @@ void UnregisterDInputCallbackTest::TearDownTestCase() { } -void UnregisterDInputCallbackTest::TestUnregisterDInputCallbackStub::OnResult(const std::string& devId, - const std::string& dhId, const int32_t& status) +void UnregisterDInputCallbackTest::TestUnregisterDInputCallbackStub::OnResult(const std::string &devId, + const std::string &dhId, const int32_t &status) { deviceId_ = devId; dhId_ = dhId; diff --git a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.h b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.h index 350aa03..35a346a 100644 --- a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.h +++ b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -36,7 +36,7 @@ public: public: TestUnregisterDInputCallbackStub() = default; virtual ~TestUnregisterDInputCallbackStub() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); std::string deviceId_; std::string dhId_; int32_t status_; diff --git a/services/common/include/dinput_sink_trans_callback.h b/services/common/include/dinput_sink_trans_callback.h index 64d226c..d31e250 100644 --- a/services/common/include/dinput_sink_trans_callback.h +++ b/services/common/include/dinput_sink_trans_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -23,10 +23,10 @@ namespace DistributedHardware { namespace DistributedInput { class DInputSinkTransCallback { public: - virtual void OnPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) = 0; - virtual void OnUnprepareRemoteInput(const int32_t& sessionId) = 0; - virtual void OnStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; - virtual void OnStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; + virtual void OnPrepareRemoteInput(const int32_t &sessionId, const std::string &deviceId) = 0; + virtual void OnUnprepareRemoteInput(const int32_t &sessionId) = 0; + virtual void OnStartRemoteInput(const int32_t &sessionId, const uint32_t &inputTypes) = 0; + virtual void OnStopRemoteInput(const int32_t &sessionId, const uint32_t &inputTypes) = 0; virtual void OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; virtual void OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; diff --git a/services/sink/inputcollector/include/distributed_input_collector.h b/services/sink/inputcollector/include/distributed_input_collector.h index 847704a..50e7a5f 100644 --- a/services/sink/inputcollector/include/distributed_input_collector.h +++ b/services/sink/inputcollector/include/distributed_input_collector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -49,7 +49,7 @@ public: bool IsAllDevicesStoped(); int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener); void ReportDhIdSharingState(const AffectDhIds &dhIds); - void GetDeviceInfoByType(const uint32_t inputTypes, std::map& deviceInfo); + void GetDeviceInfoByType(const uint32_t inputTypes, std::map &deviceInfo); private: DistributedInputCollector(); diff --git a/services/sink/inputcollector/src/distributed_input_collector.cpp b/services/sink/inputcollector/src/distributed_input_collector.cpp index 8b91e99..822ef13 100644 --- a/services/sink/inputcollector/src/distributed_input_collector.cpp +++ b/services/sink/inputcollector/src/distributed_input_collector.cpp @@ -242,7 +242,7 @@ int32_t DistributedInputCollector::RegisterSharingDhIdListener(sptr& deviceInfo) + std::string> &deviceInfo) { if (inputHub_ == nullptr) { DHLOGE("inputHub is nullptr!"); diff --git a/services/sink/sinkmanager/include/distributed_input_sink_manager.h b/services/sink/sinkmanager/include/distributed_input_sink_manager.h index aca1378..e1ca3d5 100644 --- a/services/sink/sinkmanager/include/distributed_input_sink_manager.h +++ b/services/sink/sinkmanager/include/distributed_input_sink_manager.h @@ -57,10 +57,10 @@ public: public: explicit DInputSinkListener(DistributedInputSinkManager *manager); ~DInputSinkListener() override; - void OnPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) override; - void OnUnprepareRemoteInput(const int32_t& sessionId) override; - void OnStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) override; - void OnStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) override; + void OnPrepareRemoteInput(const int32_t &sessionId, const std::string &deviceId) override; + void OnUnprepareRemoteInput(const int32_t &sessionId) override; + void OnStartRemoteInput(const int32_t &sessionId, const uint32_t &inputTypes) override; + void OnStopRemoteInput(const int32_t &sessionId, const uint32_t &inputTypes) override; void OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) override; void OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) override; @@ -85,13 +85,13 @@ public: public: explicit ProjectWindowListener(DistributedInputSinkManager *manager); ~ProjectWindowListener() override; - void OnMessage(const DHTopic topic, const std::string& message) override; + void OnMessage(const DHTopic topic, const std::string &message) override; private: - int32_t ParseMessage(const std::string& message, std::string& srcDeviceId, uint64_t& srcWinId, - SinkScreenInfo& sinkScreenInfo); - int32_t UpdateSinkScreenInfoCache(const std::string& srcDevId, const uint64_t srcWinId, - const SinkScreenInfo& sinkScreenInfoTmp); + int32_t ParseMessage(const std::string &message, std::string &srcDeviceId, uint64_t &srcWinId, + SinkScreenInfo &sinkScreenInfo); + int32_t UpdateSinkScreenInfoCache(const std::string &srcDevId, const uint64_t srcWinId, + const SinkScreenInfo &sinkScreenInfoTmp); uint32_t GetScreenWidth(); uint32_t GetScreenHeight(); @@ -103,7 +103,7 @@ public: class DScreenSinkSvrRecipient : public IRemoteObject::DeathRecipient { public: - DScreenSinkSvrRecipient(const std::string& srcDevId, const uint64_t srcWinId); + DScreenSinkSvrRecipient(const std::string &srcDevId, const uint64_t srcWinId); ~DScreenSinkSvrRecipient() override; void OnRemoteDied(const wptr &remote) override; @@ -131,7 +131,7 @@ public: uint32_t GetInputTypes(); - void SetInputTypes(const uint32_t& inputTypes); + void SetInputTypes(const uint32_t &inputTypes); /* * GetEventHandler, get the ui_service manager service's handler. @@ -140,18 +140,18 @@ public: */ std::shared_ptr GetEventHandler(); - int32_t NotifyStartDScreen(const SrcScreenInfo& srcScreenInfo) override; + int32_t NotifyStartDScreen(const SrcScreenInfo &srcScreenInfo) override; - int32_t NotifyStopDScreen(const std::string& srcScreenInfoKey) override; + int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey) override; int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener) override; - int32_t Dump(int32_t fd, const std::vector& args) override; + int32_t Dump(int32_t fd, const std::vector &args) override; void QueryLocalWhiteList(nlohmann::json &jsonStr); private: - void CleanExceptionalInfo(const SrcScreenInfo& srcScreenInfo); + void CleanExceptionalInfo(const SrcScreenInfo &srcScreenInfo); void CallBackScreenInfoChange(); private: diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index eede391..afb209f 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -96,7 +96,7 @@ void DistributedInputSinkManager::QueryLocalWhiteList(nlohmann::json &jsonStr) } void DistributedInputSinkManager::DInputSinkListener::OnPrepareRemoteInput( - const int32_t& sessionId, const std::string &deviceId) + const int32_t &sessionId, const std::string &deviceId) { DHLOGI("OnPrepareRemoteInput called, sessionId: %d, devId: %s", sessionId, GetAnonyString(deviceId).c_str()); nlohmann::json jsonStr; @@ -120,7 +120,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnPrepareRemoteInput( DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg); } -void DistributedInputSinkManager::DInputSinkListener::OnUnprepareRemoteInput(const int32_t& sessionId) +void DistributedInputSinkManager::DInputSinkListener::OnUnprepareRemoteInput(const int32_t &sessionId) { DHLOGI("OnUnprepareRemoteInput called, sessionId: %d", sessionId); OnStopRemoteInput(sessionId, static_cast(DInputDeviceType::ALL)); @@ -178,7 +178,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayUnprepareRemoteInpu } void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( - const int32_t& sessionId, const uint32_t& inputTypes) + const int32_t &sessionId, const uint32_t &inputTypes) { DHLOGI("OnStartRemoteInput called, sessionId: %d, inputTypes: %u.", sessionId, inputTypes); // set new session @@ -218,7 +218,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( } void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInput( - const int32_t& sessionId, const uint32_t& inputTypes) + const int32_t &sessionId, const uint32_t &inputTypes) { DHLOGI("OnStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", sessionId, inputTypes, sinkManagerObj_->GetInputTypes()); @@ -698,7 +698,7 @@ uint32_t DistributedInputSinkManager::GetInputTypes() return static_cast(inputTypes_); } -void DistributedInputSinkManager::SetInputTypes(const uint32_t& inputTypes) +void DistributedInputSinkManager::SetInputTypes(const uint32_t &inputTypes) { inputTypes_ = static_cast(inputTypes); } @@ -725,7 +725,7 @@ DistributedInputSinkManager::ProjectWindowListener::~ProjectWindowListener() screen_ = nullptr; } -void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic topic, const std::string& message) +void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic topic, const std::string &message) { DHLOGI("ProjectWindowListener OnMessage!"); if (topic != DHTopic::TOPIC_SINK_PROJECT_WINDOW_INFO) { @@ -753,8 +753,8 @@ void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic DInputContext::GetInstance().AddRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, dScreenSinkSA); } -int32_t DistributedInputSinkManager::ProjectWindowListener::ParseMessage(const std::string& message, - std::string& srcDeviceId, uint64_t& srcWinId, SinkScreenInfo& sinkScreenInfo) +int32_t DistributedInputSinkManager::ProjectWindowListener::ParseMessage(const std::string &message, + std::string &srcDeviceId, uint64_t &srcWinId, SinkScreenInfo &sinkScreenInfo) { nlohmann::json jsonObj = nlohmann::json::parse(message, nullptr, false); if (jsonObj.is_discarded()) { @@ -799,8 +799,8 @@ int32_t DistributedInputSinkManager::ProjectWindowListener::ParseMessage(const s return DH_SUCCESS; } -int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfoCache(const std::string& srcDevId, - const uint64_t srcWinId, const SinkScreenInfo& sinkScreenInfoTmp) +int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfoCache(const std::string &srcDevId, + const uint64_t srcWinId, const SinkScreenInfo &sinkScreenInfoTmp) { std::string srcScreenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(srcDevId, srcWinId); SinkScreenInfo sinkScreenInfo = DInputContext::GetInstance().GetSinkScreenInfo(srcScreenInfoKey); @@ -847,7 +847,7 @@ uint32_t DistributedInputSinkManager::ProjectWindowListener::GetScreenHeight() return screen_->GetHeight(); } -DistributedInputSinkManager::DScreenSinkSvrRecipient::DScreenSinkSvrRecipient(const std::string& srcDevId, +DistributedInputSinkManager::DScreenSinkSvrRecipient::DScreenSinkSvrRecipient(const std::string &srcDevId, const uint64_t srcWinId) { DHLOGI("DScreenStatusListener ctor!"); @@ -873,7 +873,7 @@ void DistributedInputSinkManager::DScreenSinkSvrRecipient::OnRemoteDied(const wp DInputContext::GetInstance().RemoveRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); } -int32_t DistributedInputSinkManager::NotifyStartDScreen(const SrcScreenInfo& srcScreenInfo) +int32_t DistributedInputSinkManager::NotifyStartDScreen(const SrcScreenInfo &srcScreenInfo) { DHLOGI("NotifyStartDScreen start!"); @@ -917,7 +917,7 @@ void DistributedInputSinkManager::CallBackScreenInfoChange() } } -void DistributedInputSinkManager::CleanExceptionalInfo(const SrcScreenInfo& srcScreenInfo) +void DistributedInputSinkManager::CleanExceptionalInfo(const SrcScreenInfo &srcScreenInfo) { DHLOGI("CleanExceptionalInfo start!"); std::string uuid = srcScreenInfo.uuid; @@ -933,7 +933,7 @@ void DistributedInputSinkManager::CleanExceptionalInfo(const SrcScreenInfo& srcS } } -int32_t DistributedInputSinkManager::NotifyStopDScreen(const std::string& srcScreenInfoKey) +int32_t DistributedInputSinkManager::NotifyStopDScreen(const std::string &srcScreenInfoKey) { DHLOGI("NotifyStopDScreen start, srcScreenInfoKey: %s", GetAnonyString(srcScreenInfoKey).c_str()); if (srcScreenInfoKey.empty()) { @@ -950,7 +950,7 @@ int32_t DistributedInputSinkManager::RegisterSharingDhIdListener(sptr& args) +int32_t DistributedInputSinkManager::Dump(int32_t fd, const std::vector &args) { DHLOGI("DistributedInputSinkManager Dump."); std::vector argsStr(args.size()); diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp index 0806af0..3e61341 100644 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp @@ -73,7 +73,7 @@ void DistributedInputSinkManagerTest::TearDownTestCase() { } -void DistributedInputSinkManagerTest::TestGetSinkScreenInfosCb::OnResult(const std::string& strJson) +void DistributedInputSinkManagerTest::TestGetSinkScreenInfosCb::OnResult(const std::string &strJson) { (void)strJson; } diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h index bea285f..4abf048 100644 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -44,7 +44,7 @@ public: public: TestGetSinkScreenInfosCb() = default; virtual ~TestGetSinkScreenInfosCb() = default; - void OnResult(const std::string& strJson) override; + void OnResult(const std::string &strJson) override; }; class TestSharingDhIdListenerStub : public diff --git a/services/sink/transport/include/distributed_input_sink_transport.h b/services/sink/transport/include/distributed_input_sink_transport.h index 02a7f54..34b8162 100644 --- a/services/sink/transport/include/distributed_input_sink_transport.h +++ b/services/sink/transport/include/distributed_input_sink_transport.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -58,7 +58,7 @@ public: int32_t RespStartRemoteInput(const int32_t sessionId, std::string &smsg); int32_t RespStopRemoteInput(const int32_t sessionId, std::string &smsg); int32_t RespLatency(const int32_t sessionId, std::string &smsg); - void SendKeyStateNodeMsg(const int32_t sessionId, const std::string& dhId, const uint32_t btnCode); + void SendKeyStateNodeMsg(const int32_t sessionId, const std::string &dhId, const uint32_t btnCode); class DInputSinkEventHandler : public AppExecFwk::EventHandler { public: @@ -74,7 +74,7 @@ public: private: int32_t SendMessage(int32_t sessionId, std::string &message); - void HandleData(int32_t sessionId, const std::string& message); + void HandleData(int32_t sessionId, const std::string &message); void RegRespFunMap(); void NotifyPrepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); void NotifyUnprepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index abf5118..af0e0ef 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -197,7 +197,7 @@ int32_t DistributedInputSinkTransport::RespLatency(const int32_t sessionId, std: return DH_SUCCESS; } -void DistributedInputSinkTransport::SendKeyStateNodeMsg(const int32_t sessionId, const std::string& dhId, +void DistributedInputSinkTransport::SendKeyStateNodeMsg(const int32_t sessionId, const std::string &dhId, const uint32_t btnCode) { if (sessionId <= 0) { @@ -455,7 +455,7 @@ void DistributedInputSinkTransport::RegRespFunMap() &DistributedInputSinkTransport::NotifyRelayStopTypeRemoteInput; } -void DistributedInputSinkTransport::HandleData(int32_t sessionId, const std::string& message) +void DistributedInputSinkTransport::HandleData(int32_t sessionId, const std::string &message) { if (callback_ == nullptr) { DHLOGE("OnBytesReceived the callback_ is null, the message:%s abort.", SetAnonyId(message).c_str()); diff --git a/services/source/inputinject/include/distributed_input_inject.h b/services/source/inputinject/include/distributed_input_inject.h index bf28600..397e348 100644 --- a/services/source/inputinject/include/distributed_input_inject.h +++ b/services/source/inputinject/include/distributed_input_inject.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -31,18 +31,18 @@ namespace DistributedInput { class DistributedInputInject { public: static DistributedInputInject &GetInstance(); - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters); - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId); - int32_t RegisterDistributedEvent(RawEvent* buffer, size_t bufferSize); - int32_t StructTransJson(const InputDevice& pBuf, std::string& strDescriptor); + int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters); + int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId); + int32_t RegisterDistributedEvent(RawEvent *buffer, size_t bufferSize); + int32_t StructTransJson(const InputDevice &pBuf, std::string &strDescriptor); void StartInjectThread(); void StopInjectThread(); std::string GenerateVirtualTouchScreenDHId(const uint64_t sourceWinId, const uint32_t sourceWinWidth, const uint32_t sourceWinHeight); - int32_t CreateVirtualTouchScreenNode(const std::string& devId, const std::string& dhId, const uint64_t srcWinId, + int32_t CreateVirtualTouchScreenNode(const std::string &devId, const std::string &dhId, const uint64_t srcWinId, const uint32_t sourcePhyWidth, const uint32_t sourcePhyHeight); - int32_t RemoveVirtualTouchScreenNode(const std::string& dhId); + int32_t RemoveVirtualTouchScreenNode(const std::string &dhId); int32_t GetVirtualTouchScreenFd(); int32_t RegisterInputNodeListener(sptr listener); int32_t UnregisterInputNodeListener(sptr listener); diff --git a/services/source/inputinject/include/distributed_input_node_manager.h b/services/source/inputinject/include/distributed_input_node_manager.h index c900322..86c38ad 100644 --- a/services/source/inputinject/include/distributed_input_node_manager.h +++ b/services/source/inputinject/include/distributed_input_node_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -41,16 +41,16 @@ public: DistributedInputNodeManager(); ~DistributedInputNodeManager(); - int32_t OpenDevicesNode(const std::string& devId, const std::string& dhId, const std::string& parameters); + int32_t OpenDevicesNode(const std::string &devId, const std::string &dhId, const std::string ¶meters); - int32_t GetDevice(const std::string& dhId, VirtualDevice*& device); + int32_t GetDevice(const std::string &dhId, VirtualDevice *&device); void ReportEvent(const RawEvent rawEvent); - int32_t CloseDeviceLocked(const std::string& dhId); + int32_t CloseDeviceLocked(const std::string &dhId); void StartInjectThread(); void StopInjectThread(); - int32_t CreateVirtualTouchScreenNode(const std::string& devId, const std::string& dhId, const uint64_t srcWinId, + int32_t CreateVirtualTouchScreenNode(const std::string &devId, const std::string &dhId, const uint64_t srcWinId, const uint32_t sourcePhyWidth, const uint32_t sourcePhyHeight); - int32_t RemoveVirtualTouchScreenNode(const std::string& dhId); + int32_t RemoveVirtualTouchScreenNode(const std::string &dhId); int32_t GetVirtualTouchScreenFd(); int32_t GetDeviceInfo(std::string &deviceId); @@ -79,17 +79,17 @@ public: }; private: - void AddDeviceLocked(const std::string& dhId, std::unique_ptr device); - int32_t CreateHandle(const InputDevice& inputDevice, const std::string& devId, const std::string& dhId); - void ParseInputDeviceJson(const std::string& str, InputDevice& pBuf); - void VerifyInputDevice(const nlohmann::json& inputDeviceJson, InputDevice& pBuf); + void AddDeviceLocked(const std::string &dhId, std::unique_ptr device); + int32_t CreateHandle(const InputDevice &inputDevice, const std::string &devId, const std::string &dhId); + void ParseInputDeviceJson(const std::string &str, InputDevice &pBuf); + void VerifyInputDevice(const nlohmann::json &inputDeviceJson, InputDevice &pBuf); void InjectEvent(); - void ScanSinkInputDevices(const std::string& dhId); - void OpenInputDevice(const std::string& devicePath, const std::string& dhId); + void ScanSinkInputDevices(const std::string &dhId); + void OpenInputDevice(const std::string &devicePath, const std::string &dhId); bool IsVirtualDev(int fd); - bool GetDevDhIdByFd(int fd, std::string& dhId, std::string& physicalPath); - void SetPathForDevMap(std::string& dhId, const std::string& devicePath); + bool GetDevDhIdByFd(int fd, std::string &dhId, std::string &physicalPath); + void SetPathForDevMap(std::string &dhId, const std::string &devicePath); /* the key is dhId, and the value is virtualDevice */ std::map> virtualDeviceMap_; diff --git a/services/source/inputinject/include/virtual_device.h b/services/source/inputinject/include/virtual_device.h index 9dc0b36..6eb08ab 100644 --- a/services/source/inputinject/include/virtual_device.h +++ b/services/source/inputinject/include/virtual_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -34,13 +34,13 @@ namespace DistributedHardware { namespace DistributedInput { class VirtualDevice { public: - explicit VirtualDevice(const InputDevice& event); + explicit VirtualDevice(const InputDevice &event); virtual ~VirtualDevice(); bool DoIoctl(int32_t fd, int32_t request, const uint32_t value); - bool CreateKey(const InputDevice& inputDevice); - void SetABSInfo(struct uinput_user_dev& inputUserDev, const InputDevice& inputDevice); + bool CreateKey(const InputDevice &inputDevice); + void SetABSInfo(struct uinput_user_dev &inputUserDev, const InputDevice &inputDevice); bool SetPhys(const std::string deviceName, std::string dhId); - bool SetUp(const InputDevice& inputDevice, const std::string &devId, const std::string &dhId); + bool SetUp(const InputDevice &inputDevice, const std::string &devId, const std::string &dhId); bool InjectInputEvent(const input_event &event); void SetNetWorkId(const std::string netWorkId); void SetPath(const std::string path); @@ -65,7 +65,7 @@ private: const std::string pid_ = std::to_string(getpid()); private: - void RecordEventLog(const input_event& event); + void RecordEventLog(const input_event &event); }; } // namespace DistributedInput } // namespace DistributedHardware diff --git a/services/source/inputinject/src/distributed_input_inject.cpp b/services/source/inputinject/src/distributed_input_inject.cpp index 010d6d6..9db0504 100644 --- a/services/source/inputinject/src/distributed_input_inject.cpp +++ b/services/source/inputinject/src/distributed_input_inject.cpp @@ -46,8 +46,8 @@ DistributedInputInject &DistributedInputInject::GetInstance() return instance; } -int32_t DistributedInputInject::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters) +int32_t DistributedInputInject::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters) { DHLOGI("RegisterDistributedHardware called, deviceId: %s, dhId: %s, parameters: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), SetAnonyId(parameters).c_str()); @@ -70,7 +70,7 @@ int32_t DistributedInputInject::RegisterDistributedHardware(const std::string& d return DH_SUCCESS; } -int32_t DistributedInputInject::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId) +int32_t DistributedInputInject::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId) { DHLOGI("UnregisterDistributedHardware called, deviceId: %s, dhId: %s", GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str()); @@ -225,7 +225,7 @@ std::string DistributedInputInject::GenerateVirtualTouchScreenDHId(const uint64_ return DH_ID_PREFIX + Sha256(uniqueInfo); } -int32_t DistributedInputInject::CreateVirtualTouchScreenNode(const std::string& devId, const std::string& dhId, +int32_t DistributedInputInject::CreateVirtualTouchScreenNode(const std::string &devId, const std::string &dhId, const uint64_t srcWinId, const uint32_t sourcePhyWidth, const uint32_t sourcePhyHeight) { std::lock_guard lock(inputNodeManagerMutex_); @@ -236,7 +236,7 @@ int32_t DistributedInputInject::CreateVirtualTouchScreenNode(const std::string& return inputNodeManager_->CreateVirtualTouchScreenNode(devId, dhId, srcWinId, sourcePhyWidth, sourcePhyHeight); } -int32_t DistributedInputInject::RemoveVirtualTouchScreenNode(const std::string& dhId) +int32_t DistributedInputInject::RemoveVirtualTouchScreenNode(const std::string &dhId) { std::lock_guard lock(inputNodeManagerMutex_); if (inputNodeManager_ == nullptr) { diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 2c4c7aa..710f870 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -54,8 +54,8 @@ DistributedInputNodeManager::~DistributedInputNodeManager() DHLOGI("destructor end"); } -int32_t DistributedInputNodeManager::OpenDevicesNode(const std::string& devId, const std::string& dhId, - const std::string& parameters) +int32_t DistributedInputNodeManager::OpenDevicesNode(const std::string &devId, const std::string &dhId, + const std::string ¶meters) { if (devId.size() > DEV_ID_LENGTH_MAX || devId.empty() || dhId.size() > DH_ID_LENGTH_MAX || dhId.empty() || parameters.size() > STRING_MAX_SIZE || parameters.empty()) { @@ -71,7 +71,7 @@ int32_t DistributedInputNodeManager::OpenDevicesNode(const std::string& devId, c return DH_SUCCESS; } -void DistributedInputNodeManager::ParseInputDeviceJson(const std::string& str, InputDevice& pBuf) +void DistributedInputNodeManager::ParseInputDeviceJson(const std::string &str, InputDevice &pBuf) { nlohmann::json inputDeviceJson = nlohmann::json::parse(str, nullptr, false); if (inputDeviceJson.is_discarded()) { @@ -81,7 +81,7 @@ void DistributedInputNodeManager::ParseInputDeviceJson(const std::string& str, I VerifyInputDevice(inputDeviceJson, pBuf); } -void DistributedInputNodeManager::VerifyInputDevice(const nlohmann::json& inputDeviceJson, InputDevice& pBuf) +void DistributedInputNodeManager::VerifyInputDevice(const nlohmann::json &inputDeviceJson, InputDevice &pBuf) { if (IsString(inputDeviceJson, DEVICE_NAME)) { pBuf.name = inputDeviceJson[DEVICE_NAME].get(); @@ -130,7 +130,7 @@ void DistributedInputNodeManager::VerifyInputDevice(const nlohmann::json& inputD } } -void DistributedInputNodeManager::ScanSinkInputDevices(const std::string& dhId) +void DistributedInputNodeManager::ScanSinkInputDevices(const std::string &dhId) { DHLOGI("ScanSinkInputDevices enter, dhId %s.", dhId.c_str()); std::vector vecInputDevPath; @@ -210,7 +210,7 @@ bool DistributedInputNodeManager::IsVirtualDev(int fd) return true; } -bool DistributedInputNodeManager::GetDevDhIdByFd(int fd, std::string& dhId, std::string& physicalPath) +bool DistributedInputNodeManager::GetDevDhIdByFd(int fd, std::string &dhId, std::string &physicalPath) { char buffer[INPUT_EVENT_BUFFER_SIZE] = {0}; if (ioctl(fd, EVIOCGPHYS(sizeof(buffer) - 1), &buffer) < 1) { @@ -230,7 +230,7 @@ bool DistributedInputNodeManager::GetDevDhIdByFd(int fd, std::string& dhId, std: return true; } -void DistributedInputNodeManager::SetPathForDevMap(std::string& dhId, const std::string& devicePath) +void DistributedInputNodeManager::SetPathForDevMap(std::string &dhId, const std::string &devicePath) { std::lock_guard lock(virtualDeviceMapMutex_); auto iter = virtualDeviceMap_.begin(); @@ -245,7 +245,7 @@ void DistributedInputNodeManager::SetPathForDevMap(std::string& dhId, const std: } } -void DistributedInputNodeManager::OpenInputDevice(const std::string& devicePath, const std::string& dhId) +void DistributedInputNodeManager::OpenInputDevice(const std::string &devicePath, const std::string &dhId) { DHLOGI("Opening input device path: %s", devicePath.c_str()); std::string curDhId; @@ -290,8 +290,8 @@ void DistributedInputNodeManager::GetVirtualKeyboardPathsByDhIds(const std::vect } } -int32_t DistributedInputNodeManager::CreateHandle(const InputDevice& inputDevice, const std::string& devId, - const std::string& dhId) +int32_t DistributedInputNodeManager::CreateHandle(const InputDevice &inputDevice, const std::string &devId, + const std::string &dhId) { std::unique_lock my_lock(operationMutex_); std::call_once(callOnceFlag_, [this]() { inputHub_->ScanInputDevices(DEVICE_PATH); }); @@ -307,7 +307,7 @@ int32_t DistributedInputNodeManager::CreateHandle(const InputDevice& inputDevice return DH_SUCCESS; } -int32_t DistributedInputNodeManager::CreateVirtualTouchScreenNode(const std::string& devId, const std::string& dhId, +int32_t DistributedInputNodeManager::CreateVirtualTouchScreenNode(const std::string &devId, const std::string &dhId, const uint64_t srcWinId, const uint32_t sourcePhyWidth, const uint32_t sourcePhyHeight) { std::unique_lock my_lock(operationMutex_); @@ -327,7 +327,7 @@ int32_t DistributedInputNodeManager::CreateVirtualTouchScreenNode(const std::str return DH_SUCCESS; } -int32_t DistributedInputNodeManager::RemoveVirtualTouchScreenNode(const std::string& dhId) +int32_t DistributedInputNodeManager::RemoveVirtualTouchScreenNode(const std::string &dhId) { return CloseDeviceLocked(dhId); } @@ -337,7 +337,7 @@ int32_t DistributedInputNodeManager::GetVirtualTouchScreenFd() return virtualTouchScreenFd_; } -void DistributedInputNodeManager::AddDeviceLocked(const std::string& dhId, std::unique_ptr device) +void DistributedInputNodeManager::AddDeviceLocked(const std::string &dhId, std::unique_ptr device) { DHLOGI("dhId=%s", GetAnonyString(dhId).c_str()); std::lock_guard lock(virtualDeviceMapMutex_); @@ -361,7 +361,7 @@ int32_t DistributedInputNodeManager::CloseDeviceLocked(const std::string &dhId) return ERR_DH_INPUT_SERVER_SOURCE_CLOSE_DEVICE_FAIL; } -int32_t DistributedInputNodeManager::GetDevice(const std::string& dhId, VirtualDevice*& device) +int32_t DistributedInputNodeManager::GetDevice(const std::string &dhId, VirtualDevice *&device) { std::lock_guard lock(virtualDeviceMapMutex_); auto iter = virtualDeviceMap_.find(dhId); diff --git a/services/source/inputinject/src/virtual_device.cpp b/services/source/inputinject/src/virtual_device.cpp index bd114d4..c8024b3 100644 --- a/services/source/inputinject/src/virtual_device.cpp +++ b/services/source/inputinject/src/virtual_device.cpp @@ -31,7 +31,7 @@ namespace { constexpr uint32_t ABS_FUZZ_POS = 3; constexpr uint32_t ABS_FLAT_POS = 4; } -VirtualDevice::VirtualDevice(const InputDevice& event) : deviceName_(event.name), busType_(event.bus), +VirtualDevice::VirtualDevice(const InputDevice &event) : deviceName_(event.name), busType_(event.bus), vendorId_(event.vendor), productId_(event.product), version_(event.version), classes_(event.classes) { DHLOGI("VirtualDevice ctor!"); @@ -56,7 +56,7 @@ bool VirtualDevice::DoIoctl(int32_t fd, int32_t request, const uint32_t value) return true; } -bool VirtualDevice::CreateKey(const InputDevice& inputDevice) +bool VirtualDevice::CreateKey(const InputDevice &inputDevice) { auto fun = [this](int32_t uiSet, const std::vector& list) -> bool { for (uint32_t evt_type : list) { @@ -81,7 +81,7 @@ bool VirtualDevice::CreateKey(const InputDevice& inputDevice) return true; } -void VirtualDevice::SetABSInfo(struct uinput_user_dev& inputUserDev, const InputDevice& inputDevice) +void VirtualDevice::SetABSInfo(struct uinput_user_dev &inputUserDev, const InputDevice &inputDevice) { DHLOGI("SetABSInfo!"); for (const auto item : inputDevice.absInfos) { @@ -113,7 +113,7 @@ bool VirtualDevice::SetPhys(const std::string deviceName, std::string dhId) return true; } -bool VirtualDevice::SetUp(const InputDevice& inputDevice, const std::string& devId, const std::string& dhId) +bool VirtualDevice::SetUp(const InputDevice &inputDevice, const std::string &devId, const std::string &dhId) { fd_ = open("/dev/uinput", O_WRONLY | O_NONBLOCK); if (fd_ < 0) { @@ -165,7 +165,7 @@ bool VirtualDevice::SetUp(const InputDevice& inputDevice, const std::string& dev return true; } -bool VirtualDevice::InjectInputEvent(const input_event& event) +bool VirtualDevice::InjectInputEvent(const input_event &event) { DHLOGI("InjectInputEvent %d", fd_); @@ -205,7 +205,7 @@ uint16_t VirtualDevice::GetClasses() return classes_; } -void VirtualDevice::RecordEventLog(const input_event& event) +void VirtualDevice::RecordEventLog(const input_event &event) { std::string eventType = ""; switch (event.type) { diff --git a/services/source/sourcemanager/include/distributed_input_source_manager.h b/services/source/sourcemanager/include/distributed_input_source_manager.h index 9611929..d38ea60 100644 --- a/services/source/sourcemanager/include/distributed_input_source_manager.h +++ b/services/source/sourcemanager/include/distributed_input_source_manager.h @@ -129,10 +129,10 @@ public: int32_t Release() override; - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, sptr callback) override; + int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, sptr callback) override; - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, sptr callback) override; int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; @@ -140,10 +140,10 @@ public: int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; int32_t StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) override; int32_t StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) override; int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; @@ -182,7 +182,7 @@ public: const std::string ¶meters, sptr callback); bool CheckUnregisterParam(const std::string &devId, const std::string &dhId, sptr callback); - int32_t Dump(int32_t fd, const std::vector& args) override; + int32_t Dump(int32_t fd, const std::vector &args) override; class DInputSourceListener : public DInputSourceTransCallback { public: @@ -214,7 +214,7 @@ public: uint32_t inputTypes) override; void OnReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) override; - void RecordEventLog(int64_t when, int32_t type, int32_t code, int32_t value, const std::string& path); + void RecordEventLog(int64_t when, int32_t type, int32_t code, int32_t value, const std::string &path); private: DistributedInputSourceManager *sourceManagerObj_; @@ -257,40 +257,40 @@ public: public: StartDScreenListener(); ~StartDScreenListener() override; - void OnMessage(const DHTopic topic, const std::string& message) override; + void OnMessage(const DHTopic topic, const std::string &message) override; private: - int32_t ParseMessage(const std::string& message, std::string& sinkDevId, SrcScreenInfo& srcScreenInfo); - int32_t UpdateSrcScreenInfoCache(const SrcScreenInfo& tmpInfo); + int32_t ParseMessage(const std::string &message, std::string &sinkDevId, SrcScreenInfo &srcScreenInfo); + int32_t UpdateSrcScreenInfoCache(const SrcScreenInfo &tmpInfo); }; class StopDScreenListener : public PublisherListenerStub { public: StopDScreenListener(); ~StopDScreenListener() override; - void OnMessage(const DHTopic topic, const std::string& message) override; + void OnMessage(const DHTopic topic, const std::string &message) override; private: - int32_t ParseMessage(const std::string& message, std::string& sinkDevId, uint64_t& sourceWinId); + int32_t ParseMessage(const std::string &message, std::string &sinkDevId, uint64_t &sourceWinId); }; class DeviceOfflineListener : public PublisherListenerStub { public: - explicit DeviceOfflineListener(DistributedInputSourceManager* srcManagerContext); + explicit DeviceOfflineListener(DistributedInputSourceManager *srcManagerContext); ~DeviceOfflineListener() override; - void OnMessage(const DHTopic topic, const std::string& message) override; + void OnMessage(const DHTopic topic, const std::string &message) override; private: - void DeleteNodeInfoAndNotify(const std::string& offlineDevId); + void DeleteNodeInfoAndNotify(const std::string &offlineDevId); private: - DistributedInputSourceManager* sourceManagerContext_; + DistributedInputSourceManager *sourceManagerContext_; }; class DScreenSourceSvrRecipient : public IRemoteObject::DeathRecipient { public: - DScreenSourceSvrRecipient(const std::string& srcDevId, const std::string& sinkDevId, const uint64_t srcWinId); + DScreenSourceSvrRecipient(const std::string &srcDevId, const std::string &sinkDevId, const uint64_t srcWinId); ~DScreenSourceSvrRecipient() override; void OnRemoteDied(const wptr &remote) override; @@ -456,7 +456,7 @@ private: std::shared_ptr callBackHandler_; std::vector inputDevice_; bool InitAuto(); - void handleStartServerCallback(const std::string& devId); + void handleStartServerCallback(const std::string &devId); std::mutex mutex_; std::mutex operationMutex_; sptr startDScreenListener_ = nullptr; @@ -491,11 +491,11 @@ private: int32_t RelayStopRemoteInputByDhid(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback); bool IsStringDataSame(const std::vector &oldDhIds, std::vector newDhIds); - void DeleteNodeInfoAndNotify(const std::string& offlineDevId); + void DeleteNodeInfoAndNotify(const std::string &offlineDevId); void SendExistVirNodeInfos(sptr listener); - std::set GetSyncNodeInfo(const std::string& devId); - void UpdateSyncNodeInfo(const std::string& devId, const std::string& dhId, const std::string &nodeDesc); - void DeleteSyncNodeInfo(const std::string& devId); + std::set GetSyncNodeInfo(const std::string &devId); + void UpdateSyncNodeInfo(const std::string &devId, const std::string &dhId, const std::string &nodeDesc); + void DeleteSyncNodeInfo(const std::string &devId); void UnregisterDHFwkPublisher(); }; } // namespace DistributedInput diff --git a/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h b/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h index 477cb60..08dac97 100644 --- a/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h +++ b/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -40,14 +40,14 @@ public: private: class RemoteCliDeathRecipient : public IRemoteObject::DeathRecipient { public: - void OnRemoteDied(const wptr& remote) override; + void OnRemoteDied(const wptr &remote) override; }; sptr remoteCliDeathRcv; sptr GetRemoteCliFromCache(const std::string &devId); void AddRemoteCli(const std::string &devId, sptr object); void DeleteRemoteCli(const std::string &devId); void DeleteRemoteCli(const sptr remote); - void ProcRemoteCliDied(const sptr& remote); + void ProcRemoteCliDied(const sptr &remote); private: std::mutex remoteCliLock; diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index 83825a7..f682e5d 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -1073,8 +1073,8 @@ bool DistributedInputSourceManager::CheckRegisterParam(const std::string &devId, return true; } -int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, sptr callback) +int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, sptr callback) { HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_REGISTER, devId, dhId, "dinput register call."); DHLOGI("RegisterDistributedHardware called, deviceId: %s, dhId: %s, parameters: %s", @@ -1138,7 +1138,7 @@ int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::st return DH_SUCCESS; } -void DistributedInputSourceManager::handleStartServerCallback(const std::string& devId) +void DistributedInputSourceManager::handleStartServerCallback(const std::string &devId) { bool isFindDevice = false; for (auto iter = inputDevice_.begin(); iter != inputDevice_.end(); ++iter) { @@ -1257,7 +1257,7 @@ int32_t DistributedInputSourceManager::DeleteInputDeviceNodeInfo(const std::stri return DH_SUCCESS; } -int32_t DistributedInputSourceManager::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, +int32_t DistributedInputSourceManager::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, sptr callback) { HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_UNREGISTER, devId, dhId, "dinput unregister call"); @@ -1394,7 +1394,7 @@ int32_t DistributedInputSourceManager::UnprepareRemoteInput( } int32_t DistributedInputSourceManager::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { StartAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_START_START, DINPUT_START_TASK); HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_START_USE, deviceId, "Dinput start use call."); @@ -1439,7 +1439,7 @@ int32_t DistributedInputSourceManager::StartRemoteInput( } int32_t DistributedInputSourceManager::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { StartAsyncTrace(DINPUT_HITRACE_LABEL, DINPUT_STOP_START, DINPUT_STOP_TASK); HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_STOP_USE, deviceId, "Dinput stop use call"); @@ -2539,7 +2539,7 @@ void DistributedInputSourceManager::SetInputTypesMap(const std::string deviceId, InputTypesMap_[deviceId] = value; } -std::set DistributedInputSourceManager::GetSyncNodeInfo(const std::string& devId) +std::set DistributedInputSourceManager::GetSyncNodeInfo(const std::string &devId) { std::lock_guard lock(syncNodeInfoMutex_); if (syncNodeInfoMap_.find(devId) == syncNodeInfoMap_.end()) { @@ -2549,7 +2549,7 @@ std::set DistributedInputSourceManager::GetSyncNodeInfo(const std return syncNodeInfoMap_[devId]; } -void DistributedInputSourceManager::UpdateSyncNodeInfo(const std::string& userDevId, const std::string& dhId, +void DistributedInputSourceManager::UpdateSyncNodeInfo(const std::string &userDevId, const std::string &dhId, const std::string &nodeDesc) { std::lock_guard lock(syncNodeInfoMutex_); @@ -2561,7 +2561,7 @@ void DistributedInputSourceManager::UpdateSyncNodeInfo(const std::string& userDe syncNodeInfoMap_[userDevId].insert({userDevId, dhId, nodeDesc}); } -void DistributedInputSourceManager::DeleteSyncNodeInfo(const std::string& devId) +void DistributedInputSourceManager::DeleteSyncNodeInfo(const std::string &devId) { std::lock_guard lock(syncNodeInfoMutex_); syncNodeInfoMap_.erase(devId); @@ -2599,7 +2599,7 @@ DistributedInputSourceManager::StartDScreenListener::~StartDScreenListener() DHLOGI("StartDScreenListener dtor!"); } -void DistributedInputSourceManager::StartDScreenListener::OnMessage(const DHTopic topic, const std::string& message) +void DistributedInputSourceManager::StartDScreenListener::OnMessage(const DHTopic topic, const std::string &message) { DHLOGI("StartDScreenListener OnMessage!"); if (topic != DHTopic::TOPIC_START_DSCREEN) { @@ -2650,8 +2650,8 @@ void DistributedInputSourceManager::StartDScreenListener::OnMessage(const DHTopi DInputContext::GetInstance().AddRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, dScreenSrcSA); } -int32_t DistributedInputSourceManager::StartDScreenListener::ParseMessage(const std::string& message, - std::string& sinkDevId, SrcScreenInfo& srcScreenInfo) +int32_t DistributedInputSourceManager::StartDScreenListener::ParseMessage(const std::string &message, + std::string &sinkDevId, SrcScreenInfo &srcScreenInfo) { nlohmann::json jsonObj = nlohmann::json::parse(message, nullptr, false); if (jsonObj.is_discarded()) { @@ -2681,7 +2681,7 @@ int32_t DistributedInputSourceManager::StartDScreenListener::ParseMessage(const return DH_SUCCESS; } -int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfoCache(const SrcScreenInfo& tmpInfo) +int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfoCache(const SrcScreenInfo &tmpInfo) { std::string srcDevId = GetLocalNetworkId(); std::string srcScreenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(srcDevId, tmpInfo.sourceWinId); @@ -2720,7 +2720,7 @@ DistributedInputSourceManager::StopDScreenListener::~StopDScreenListener() DHLOGI("StopDScreenListener dtor!"); } -void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic topic, const std::string& message) +void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic topic, const std::string &message) { DHLOGI("StopDScreenListener OnMessage!"); if (topic != DHTopic::TOPIC_STOP_DSCREEN) { @@ -2760,8 +2760,8 @@ void DistributedInputSourceManager::StopDScreenListener::OnMessage(const DHTopic } } -int32_t DistributedInputSourceManager::StopDScreenListener::ParseMessage(const std::string& message, - std::string& sinkDevId, uint64_t& sourceWinId) +int32_t DistributedInputSourceManager::StopDScreenListener::ParseMessage(const std::string &message, + std::string &sinkDevId, uint64_t &sourceWinId) { nlohmann::json jsonObj = nlohmann::json::parse(message, nullptr, false); if (jsonObj.is_discarded()) { @@ -2807,7 +2807,7 @@ void DistributedInputSourceManager::DeviceOfflineListener::OnMessage(const DHTop DeleteNodeInfoAndNotify(message); } -void DistributedInputSourceManager::DeviceOfflineListener::DeleteNodeInfoAndNotify(const std::string& offlineDevId) +void DistributedInputSourceManager::DeviceOfflineListener::DeleteNodeInfoAndNotify(const std::string &offlineDevId) { DHLOGI("DeviceOfflineListener DeleteNodeInfoAndNotify!"); if (sourceManagerContext_ == nullptr) { @@ -2826,8 +2826,8 @@ void DistributedInputSourceManager::DeviceOfflineListener::DeleteNodeInfoAndNoti sourceManagerContext_->DeleteSyncNodeInfo(offlineDevId); } -DistributedInputSourceManager::DScreenSourceSvrRecipient::DScreenSourceSvrRecipient(const std::string& srcDevId, - const std::string& sinkDevId, const uint64_t srcWinId) +DistributedInputSourceManager::DScreenSourceSvrRecipient::DScreenSourceSvrRecipient(const std::string &srcDevId, + const std::string &sinkDevId, const uint64_t srcWinId) { DHLOGI("DScreenStatusListener ctor!"); this->srcDevId_ = srcDevId; @@ -2872,7 +2872,7 @@ void DistributedInputSourceManager::DScreenSourceSvrRecipient::OnRemoteDied(cons DInputContext::GetInstance().RemoveRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID); } -int32_t DistributedInputSourceManager::Dump(int32_t fd, const std::vector& args) +int32_t DistributedInputSourceManager::Dump(int32_t fd, const std::vector &args) { DHLOGI("DistributedInputSourceManager Dump."); std::vector argsStr(args.size()); diff --git a/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp b/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp index 118c19b..41aeef7 100644 --- a/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp @@ -47,7 +47,7 @@ DInputSourceSACliMgr::~DInputSourceSACliMgr() DHLOGI("Dtor DInputSourceSACliMgr"); } -void DInputSourceSACliMgr::RemoteCliDeathRecipient::OnRemoteDied(const wptr& remote) +void DInputSourceSACliMgr::RemoteCliDeathRecipient::OnRemoteDied(const wptr &remote) { DHLOGI("RemoteCliDeathRecipient::OnRemoteDied received died notify!"); sptr diedRemote = remote.promote(); @@ -151,7 +151,7 @@ void DInputSourceSACliMgr::DeleteRemoteCli(const sptr remote) remoteCliMap.erase(iter); } -void DInputSourceSACliMgr::ProcRemoteCliDied(const sptr& remote) +void DInputSourceSACliMgr::ProcRemoteCliDied(const sptr &remote) { auto remoteCliDiedProc = [this, remote]() { DeleteRemoteCli(remote); diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp index 9419859..7921c96 100644 --- a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp +++ b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp @@ -72,7 +72,7 @@ void DistributedInputSourceManagerTest::RegisterSourceRespCallback(std::shared_p } void DistributedInputSourceManagerTest::TestRegisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { (void)devId; (void)dhId; @@ -81,7 +81,7 @@ void DistributedInputSourceManagerTest::TestRegisterDInputCb::OnResult( } void DistributedInputSourceManagerTest::TestUnregisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { (void)devId; (void)dhId; @@ -90,7 +90,7 @@ void DistributedInputSourceManagerTest::TestUnregisterDInputCb::OnResult( } void DistributedInputSourceManagerTest::TestPrepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -98,7 +98,7 @@ void DistributedInputSourceManagerTest::TestPrepareDInputCallback::OnResult( } void DistributedInputSourceManagerTest::TestUnprepareDInputCallback::OnResult( - const std::string& deviceId, const int32_t& status) + const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -106,7 +106,7 @@ void DistributedInputSourceManagerTest::TestUnprepareDInputCallback::OnResult( } void DistributedInputSourceManagerTest::TestStartDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -115,7 +115,7 @@ void DistributedInputSourceManagerTest::TestStartDInputCallback::OnResult( } void DistributedInputSourceManagerTest::TestStopDInputCallback::OnResult( - const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status) + const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status) { (void)deviceId; (void)inputTypes; @@ -140,7 +140,7 @@ void DistributedInputSourceManagerTest::TestAddWhiteListInfosCb::OnResult( } void DistributedInputSourceManagerTest::TestDelWhiteListInfosCb::OnResult( - const std::string& deviceId) + const std::string &deviceId) { (void)deviceId; return; @@ -200,7 +200,7 @@ void DistributedInputSourceManagerTest::TestStartStopDInputsCb::OnResultDhids(co return; } -int32_t DistributedInputSourceManagerTest::StructTransJson(const InputDevice& pBuf, std::string& strDescriptor) const +int32_t DistributedInputSourceManagerTest::StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) const { nlohmann::json tmpJson; tmpJson["name"] = pBuf.name; diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h index e96dcbb..c1f1804 100644 --- a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h +++ b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -55,7 +55,7 @@ public: public: TestPrepareDInputCallback() = default; virtual ~TestPrepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestUnprepareDInputCallback : public @@ -63,7 +63,7 @@ public: public: TestUnprepareDInputCallback() = default; virtual ~TestUnprepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status); + void OnResult(const std::string &deviceId, const int32_t &status); }; class TestStartDInputCallback : public @@ -71,7 +71,7 @@ public: public: TestStartDInputCallback() = default; virtual ~TestStartDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStopDInputCallback : public @@ -79,7 +79,7 @@ public: public: TestStopDInputCallback() = default; virtual ~TestStopDInputCallback() = default; - void OnResult(const std::string& deviceId, const uint32_t& inputTypes, const int32_t& status); + void OnResult(const std::string &deviceId, const uint32_t &inputTypes, const int32_t &status); }; class TestStartStopVectorCallbackStub @@ -94,14 +94,14 @@ public: public: TestRegisterDInputCb() = default; virtual ~TestRegisterDInputCb() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); }; class TestUnregisterDInputCb : public OHOS::DistributedHardware::DistributedInput::UnregisterDInputCallbackStub { public: TestUnregisterDInputCb() = default; virtual ~TestUnregisterDInputCb() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status); }; class TestAddWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::AddWhiteListInfosCallbackStub { @@ -154,7 +154,7 @@ public: void RegisterSourceRespCallback(std::shared_ptr callback); private: - int32_t StructTransJson(const InputDevice& pBuf, std::string& strDescriptor) const; + int32_t StructTransJson(const InputDevice &pBuf, std::string &strDescriptor) const; DistributedInputSourceManager* sourceManager_; std::shared_ptr statuslistener_; std::shared_ptr callback_; diff --git a/services/source/transport/include/distributed_input_source_transport.h b/services/source/transport/include/distributed_input_source_transport.h index 6979d94..dd7f680 100644 --- a/services/source/transport/include/distributed_input_source_transport.h +++ b/services/source/transport/include/distributed_input_source_transport.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -60,13 +60,13 @@ public: void RegisterSourceRespCallback(std::shared_ptr callback); - int32_t PrepareRemoteInput(const std::string& deviceId); - int32_t UnprepareRemoteInput(const std::string& deviceId); - int32_t StartRemoteInput(const std::string& deviceId, const uint32_t& inputTypes); - int32_t StopRemoteInput(const std::string& deviceId, const uint32_t& inputTypes); - int32_t LatencyCount(const std::string& deviceId); - void StartLatencyCount(const std::string& deviceId); - void StartLatencyThread(const std::string& deviceId); + int32_t PrepareRemoteInput(const std::string &deviceId); + int32_t UnprepareRemoteInput(const std::string &deviceId); + int32_t StartRemoteInput(const std::string &deviceId, const uint32_t &inputTypes); + int32_t StopRemoteInput(const std::string &deviceId, const uint32_t &inputTypes); + int32_t LatencyCount(const std::string &deviceId); + void StartLatencyCount(const std::string &deviceId); + void StartLatencyThread(const std::string &deviceId); void StopLatencyThread(); int32_t StartRemoteInput(const std::string &deviceId, const std::vector &dhids); @@ -85,13 +85,13 @@ public: const std::vector &dhids); int32_t SendRelayStopDhidRequest(const std::string &srcId, const std::string &sinkId, const std::vector &dhids); - int32_t SendRelayStartTypeRequest(const std::string &srcId, const std::string &sinkId, const uint32_t& inputTypes); - int32_t SendRelayStopTypeRequest(const std::string &srcId, const std::string &sinkId, const uint32_t& inputTypes); + int32_t SendRelayStartTypeRequest(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes); + int32_t SendRelayStopTypeRequest(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes); int32_t GetCurrentSessionId(); private: int32_t SendMessage(int32_t sessionId, std::string &message); - void HandleData(int32_t sessionId, const std::string& message); + void HandleData(int32_t sessionId, const std::string &message); void SessionClosed(); void NotifyResponsePrepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); void NotifyResponseUnprepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); @@ -123,8 +123,8 @@ private: void ReceiveSrcTSrcRelayStartType(int32_t sessionId, const nlohmann::json &recMsg); void ReceiveSrcTSrcRelayStopType(int32_t sessionId, const nlohmann::json &recMsg); - int32_t StartRemoteInputType(int32_t sessionId, const std::string &deviceId, const uint32_t& inputTypes); - int32_t StopRemoteInputType(int32_t sessionId, const std::string &deviceId, const uint32_t& inputTypes); + int32_t StartRemoteInputType(int32_t sessionId, const std::string &deviceId, const uint32_t &inputTypes); + int32_t StopRemoteInputType(int32_t sessionId, const std::string &deviceId, const uint32_t &inputTypes); void NotifyResponseRelayStartTypeRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); void NotifyResponseRelayStopTypeRemoteInput(int32_t sessionId, const nlohmann::json &recMsg); int32_t NotifyOriginStartTypeResult(int32_t sessionId, const std::string &srcId, const std::string &sinkId, diff --git a/services/source/transport/src/distributed_input_source_transport.cpp b/services/source/transport/src/distributed_input_source_transport.cpp index 91d616d..c037f18 100644 --- a/services/source/transport/src/distributed_input_source_transport.cpp +++ b/services/source/transport/src/distributed_input_source_transport.cpp @@ -186,7 +186,7 @@ void DistributedInputSourceTransport::RegisterSourceRespCallback(std::shared_ptr * @param deviceId is remote device * @return Returns 0 is success, other is fail. */ -int32_t DistributedInputSourceTransport::PrepareRemoteInput(const std::string& deviceId) +int32_t DistributedInputSourceTransport::PrepareRemoteInput(const std::string &deviceId) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { @@ -211,7 +211,7 @@ int32_t DistributedInputSourceTransport::PrepareRemoteInput(const std::string& d return DH_SUCCESS; } -int32_t DistributedInputSourceTransport::UnprepareRemoteInput(const std::string& deviceId) +int32_t DistributedInputSourceTransport::UnprepareRemoteInput(const std::string &deviceId) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { @@ -345,7 +345,7 @@ int32_t DistributedInputSourceTransport::StopRemoteInputDhids(int32_t srcTsrcSeI } int32_t DistributedInputSourceTransport::StartRemoteInputType(int32_t srcTsrcSeId, const std::string &deviceId, - const uint32_t& inputTypes) + const uint32_t &inputTypes) { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { @@ -372,7 +372,7 @@ int32_t DistributedInputSourceTransport::StartRemoteInputType(int32_t srcTsrcSeI } int32_t DistributedInputSourceTransport::StopRemoteInputType(int32_t srcTsrcSeId, const std::string &deviceId, - const uint32_t& inputTypes) + const uint32_t &inputTypes) { int32_t sinkSessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sinkSessionId < 0) { @@ -576,7 +576,7 @@ int32_t DistributedInputSourceTransport::NotifyOriginStopTypeResult(int32_t srcT return DH_SUCCESS; } -int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string& deviceId, const uint32_t& inputTypes) +int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string &deviceId, const uint32_t &inputTypes) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { @@ -603,7 +603,7 @@ int32_t DistributedInputSourceTransport::StartRemoteInput(const std::string& dev } int32_t DistributedInputSourceTransport::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes) + const std::string &deviceId, const uint32_t &inputTypes) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { @@ -629,7 +629,7 @@ int32_t DistributedInputSourceTransport::StopRemoteInput( return DH_SUCCESS; } -int32_t DistributedInputSourceTransport::LatencyCount(const std::string& deviceId) +int32_t DistributedInputSourceTransport::LatencyCount(const std::string &deviceId) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(deviceId); if (sessionId < 0) { @@ -654,7 +654,7 @@ int32_t DistributedInputSourceTransport::LatencyCount(const std::string& deviceI return DH_SUCCESS; } -void DistributedInputSourceTransport::StartLatencyCount(const std::string& deviceId) +void DistributedInputSourceTransport::StartLatencyCount(const std::string &deviceId) { int32_t ret = pthread_setname_np(pthread_self(), LATENCY_COUNT_THREAD_NAME); if (ret != 0) { @@ -680,7 +680,7 @@ void DistributedInputSourceTransport::StartLatencyCount(const std::string& devic DHLOGI("end"); } -void DistributedInputSourceTransport::StartLatencyThread(const std::string& deviceId) +void DistributedInputSourceTransport::StartLatencyThread(const std::string &deviceId) { DHLOGI("start"); isLatencyThreadRunning_.store(true); @@ -835,7 +835,7 @@ int32_t DistributedInputSourceTransport::SendRelayStopDhidRequest(const std::str } int32_t DistributedInputSourceTransport::SendRelayStartTypeRequest(const std::string &srcId, const std::string &sinkId, - const uint32_t& inputTypes) + const uint32_t &inputTypes) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { @@ -861,7 +861,7 @@ int32_t DistributedInputSourceTransport::SendRelayStartTypeRequest(const std::st } int32_t DistributedInputSourceTransport::SendRelayStopTypeRequest(const std::string &srcId, const std::string &sinkId, - const uint32_t& inputTypes) + const uint32_t &inputTypes) { int32_t sessionId = DistributedInputTransportBase::GetInstance().GetSessionIdByDevId(srcId); if (sessionId < 0) { @@ -1468,7 +1468,7 @@ void DistributedInputSourceTransport::DInputTransbaseSourceListener::HandleSessi DistributedInputSourceTransport::GetInstance().HandleData(sessionId, message); } -void DistributedInputSourceTransport::HandleData(int32_t sessionId, const std::string& message) +void DistributedInputSourceTransport::HandleData(int32_t sessionId, const std::string &message) { if (callback_ == nullptr) { DHLOGE("OnBytesReceived the callback_ is null, the message:%s abort.", SetAnonyId(message).c_str()); diff --git a/sinkhandler/include/distributed_input_sink_handler.h b/sinkhandler/include/distributed_input_sink_handler.h index e4e4569..58477d3 100644 --- a/sinkhandler/include/distributed_input_sink_handler.h +++ b/sinkhandler/include/distributed_input_sink_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -34,17 +34,17 @@ namespace DistributedInput { class DistributedInputSinkHandler : public IDistributedHardwareSink { DECLARE_SINGLE_INSTANCE_BASE(DistributedInputSinkHandler); public: - int32_t InitSink(const std::string& params) override; + int32_t InitSink(const std::string ¶ms) override; int32_t ReleaseSink() override; - int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& params) override; - int32_t UnsubscribeLocalHardware(const std::string& dhId) override; + int32_t SubscribeLocalHardware(const std::string &dhId, const std::string ¶ms) override; + int32_t UnsubscribeLocalHardware(const std::string &dhId) override; void FinishStartSA(const std::string ¶ms, const sptr &remoteObject); public: class SALoadSinkCb : public OHOS::SystemAbilityLoadCallbackStub { public: void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, - const OHOS::sptr& remoteObject) override; + const OHOS::sptr &remoteObject) override; void OnLoadSystemAbilityFail(int32_t systemAbilityId) override; diff --git a/sinkhandler/src/distributed_input_sink_handler.cpp b/sinkhandler/src/distributed_input_sink_handler.cpp index 723a71c..a6a49f5 100644 --- a/sinkhandler/src/distributed_input_sink_handler.cpp +++ b/sinkhandler/src/distributed_input_sink_handler.cpp @@ -87,7 +87,7 @@ int32_t DistributedInputSinkHandler::UnsubscribeLocalHardware(const std::string } void DistributedInputSinkHandler::SALoadSinkCb::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, - const OHOS::sptr& remoteObject) + const OHOS::sptr &remoteObject) { currSystemAbilityId = systemAbilityId; currRemoteObject = remoteObject; diff --git a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp index fd2fb38..8a5e798 100644 --- a/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sinkhandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -31,7 +31,7 @@ DistributedInputClient &DistributedInputClient::GetInstance() } void DistributedInputClient::RegisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkRstInfos.end(); ++iter) { @@ -44,7 +44,7 @@ void DistributedInputClient::RegisterDInputCb::OnResult( } void DistributedInputClient::UnregisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.end(); ++iter) { @@ -73,7 +73,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } -void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId) +void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string &deviceId) { WhiteListUtil::GetInstance().ClearWhiteList(deviceId); } @@ -98,43 +98,43 @@ int32_t DistributedInputClient::ReleaseSink() return DH_SUCCESS; } -int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, const std::shared_ptr& callback) +int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, const std::shared_ptr &callback) { return DH_SUCCESS; } -int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::shared_ptr& callback) +int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::shared_ptr &callback) { return DH_SUCCESS; } int32_t DistributedInputClient::PrepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::UnprepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } -bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event) +bool DistributedInputClient::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { return true; } diff --git a/sourcehandler/include/distributed_input_source_handler.h b/sourcehandler/include/distributed_input_source_handler.h index 6e8947f..3a2e634 100644 --- a/sourcehandler/include/distributed_input_source_handler.h +++ b/sourcehandler/include/distributed_input_source_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -35,14 +35,14 @@ namespace DistributedInput { class DistributedInputSourceHandler : public IDistributedHardwareSource { DECLARE_SINGLE_INSTANCE_BASE(DistributedInputSourceHandler); public: - int32_t InitSource(const std::string& params) override; + int32_t InitSource(const std::string ¶ms) override; int32_t ReleaseSource() override; - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const EnableParam& param, std::shared_ptr callback) override; - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const EnableParam ¶m, std::shared_ptr callback) override; + int32_t UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, std::shared_ptr callback) override; - int32_t ConfigDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& key, - const std::string& value) override; + int32_t ConfigDistributedHardware(const std::string &devId, const std::string &dhId, const std::string &key, + const std::string &value) override; void FinishStartSA(const std::string ¶ms, const sptr &remoteObject); public: @@ -50,7 +50,7 @@ public: class SALoadSourceCb : public OHOS::SystemAbilityLoadCallbackStub { public: void OnLoadSystemAbilitySuccess(int32_t systemAbilityId, - const OHOS::sptr& remoteObject) override; + const OHOS::sptr &remoteObject) override; void OnLoadSystemAbilityFail(int32_t systemAbilityId) override; diff --git a/sourcehandler/src/distributed_input_source_handler.cpp b/sourcehandler/src/distributed_input_source_handler.cpp index ddf38ff..55267c8 100644 --- a/sourcehandler/src/distributed_input_source_handler.cpp +++ b/sourcehandler/src/distributed_input_source_handler.cpp @@ -94,7 +94,7 @@ int32_t DistributedInputSourceHandler::ConfigDistributedHardware(const std::stri } void DistributedInputSourceHandler::SALoadSourceCb::OnLoadSystemAbilitySuccess(int32_t systemAbilityId, - const OHOS::sptr& remoteObject) + const OHOS::sptr &remoteObject) { currSystemAbilityId = systemAbilityId; currRemoteObject = remoteObject; diff --git a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp index b9d626a..ae72613 100644 --- a/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp +++ b/sourcehandler/test/unittest/mock/mock_distributed_input_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -32,7 +32,7 @@ DistributedInputClient &DistributedInputClient::GetInstance() } void DistributedInputClient::RegisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkRstInfos.end(); ++iter) { @@ -45,7 +45,7 @@ void DistributedInputClient::RegisterDInputCb::OnResult( } void DistributedInputClient::UnregisterDInputCb::OnResult( - const std::string& devId, const std::string& dhId, const int32_t& status) + const std::string &devId, const std::string &dhId, const int32_t &status) { auto iter = DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.begin(); for (; iter != DistributedInputClient::GetInstance().dHardWareFwkUnRstInfos.end(); ++iter) { @@ -74,7 +74,7 @@ void DistributedInputClient::AddWhiteListInfosCb::OnResult(const std::string &de WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList); } -void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& deviceId) +void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string &deviceId) { WhiteListUtil::GetInstance().ClearWhiteList(deviceId); } @@ -99,43 +99,43 @@ int32_t DistributedInputClient::ReleaseSink() return DH_SUCCESS; } -int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::string& parameters, const std::shared_ptr& callback) +int32_t DistributedInputClient::RegisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::string ¶meters, const std::shared_ptr &callback) { return DH_SUCCESS; } -int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, - const std::shared_ptr& callback) +int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string &devId, const std::string &dhId, + const std::shared_ptr &callback) { return DH_SUCCESS; } int32_t DistributedInputClient::PrepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::UnprepareRemoteInput( - const std::string& deviceId, sptr callback) + const std::string &deviceId, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::StartRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } int32_t DistributedInputClient::StopRemoteInput( - const std::string& deviceId, const uint32_t& inputTypes, sptr callback) + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) { return DH_SUCCESS; } -bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event) +bool DistributedInputClient::IsNeedFilterOut(const std::string &deviceId, const BusinessEvent &event) { return true; } diff --git a/test/fuzztest/dinputconfigdh_fuzzer/dinputconfigdh_fuzzer.cpp b/test/fuzztest/dinputconfigdh_fuzzer/dinputconfigdh_fuzzer.cpp index fcf9cfb..89965ef 100644 --- a/test/fuzztest/dinputconfigdh_fuzzer/dinputconfigdh_fuzzer.cpp +++ b/test/fuzztest/dinputconfigdh_fuzzer/dinputconfigdh_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void ConfigDistributedHardwareFuzzTest(const uint8_t* data, size_t size) +void ConfigDistributedHardwareFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -46,7 +46,7 @@ void ConfigDistributedHardwareFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::ConfigDistributedHardwareFuzzTest(data, size); diff --git a/test/fuzztest/dinputinitsink_fuzzer/dinputinitsink_fuzzer.cpp b/test/fuzztest/dinputinitsink_fuzzer/dinputinitsink_fuzzer.cpp index 81a4b6b..fe87f39 100644 --- a/test/fuzztest/dinputinitsink_fuzzer/dinputinitsink_fuzzer.cpp +++ b/test/fuzztest/dinputinitsink_fuzzer/dinputinitsink_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void InitSinkFuzzTest(const uint8_t* data, size_t size) +void InitSinkFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -43,7 +43,7 @@ void InitSinkFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::InitSinkFuzzTest(data, size); diff --git a/test/fuzztest/dinputinitsource_fuzzer/dinputinitsource_fuzzer.cpp b/test/fuzztest/dinputinitsource_fuzzer/dinputinitsource_fuzzer.cpp index a8489ab..98d7120 100644 --- a/test/fuzztest/dinputinitsource_fuzzer/dinputinitsource_fuzzer.cpp +++ b/test/fuzztest/dinputinitsource_fuzzer/dinputinitsource_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void InitSourceFuzzTest(const uint8_t* data, size_t size) +void InitSourceFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -43,7 +43,7 @@ void InitSourceFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::InitSourceFuzzTest(data, size); diff --git a/test/fuzztest/dinputonsessionclosed_fuzzer/dinputonsessionclosed_fuzzer.cpp b/test/fuzztest/dinputonsessionclosed_fuzzer/dinputonsessionclosed_fuzzer.cpp index ce9992a..3ddaec7 100644 --- a/test/fuzztest/dinputonsessionclosed_fuzzer/dinputonsessionclosed_fuzzer.cpp +++ b/test/fuzztest/dinputonsessionclosed_fuzzer/dinputonsessionclosed_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { -void OnSessionClosedFuzzTest(const uint8_t* data, size_t size) +void OnSessionClosedFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -39,7 +39,7 @@ void OnSessionClosedFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::OnSessionClosedFuzzTest(data, size); diff --git a/test/fuzztest/dinputonsessionopend_fuzzer/dinputonsessionopend_fuzzer.cpp b/test/fuzztest/dinputonsessionopend_fuzzer/dinputonsessionopend_fuzzer.cpp index 7abc03a..8bf4312 100644 --- a/test/fuzztest/dinputonsessionopend_fuzzer/dinputonsessionopend_fuzzer.cpp +++ b/test/fuzztest/dinputonsessionopend_fuzzer/dinputonsessionopend_fuzzer.cpp @@ -27,7 +27,7 @@ namespace OHOS { namespace DistributedHardware { -void OnSessionOpenedFuzzTest(const uint8_t* data, size_t size) +void OnSessionOpenedFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -40,7 +40,7 @@ void OnSessionOpenedFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::OnSessionOpenedFuzzTest(data, size); diff --git a/test/fuzztest/dinputreleasesink_fuzzer/dinputreleasesink_fuzzer.cpp b/test/fuzztest/dinputreleasesink_fuzzer/dinputreleasesink_fuzzer.cpp index 24500c9..233bf56 100644 --- a/test/fuzztest/dinputreleasesink_fuzzer/dinputreleasesink_fuzzer.cpp +++ b/test/fuzztest/dinputreleasesink_fuzzer/dinputreleasesink_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void ReleaseSinkFuzzTest(const uint8_t* data, size_t size) +void ReleaseSinkFuzzTest(const uint8_t *data, size_t size) { (void)data; (void)size; @@ -41,7 +41,7 @@ void ReleaseSinkFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::ReleaseSinkFuzzTest(data, size); diff --git a/test/fuzztest/dinputreleasesource_fuzzer/dinputreleasesource_fuzzer.cpp b/test/fuzztest/dinputreleasesource_fuzzer/dinputreleasesource_fuzzer.cpp index d5376fa..c78d456 100644 --- a/test/fuzztest/dinputreleasesource_fuzzer/dinputreleasesource_fuzzer.cpp +++ b/test/fuzztest/dinputreleasesource_fuzzer/dinputreleasesource_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void ReleaseSourceFuzzTest(const uint8_t* data, size_t size) +void ReleaseSourceFuzzTest(const uint8_t *data, size_t size) { (void)data; (void)size; @@ -41,7 +41,7 @@ void ReleaseSourceFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::ReleaseSourceFuzzTest(data, size); diff --git a/test/fuzztest/dinputsubscribelocaldh_fuzzer/dinputsubscribelocaldh_fuzzer.cpp b/test/fuzztest/dinputsubscribelocaldh_fuzzer/dinputsubscribelocaldh_fuzzer.cpp index 1f10ac3..ce72b99 100644 --- a/test/fuzztest/dinputsubscribelocaldh_fuzzer/dinputsubscribelocaldh_fuzzer.cpp +++ b/test/fuzztest/dinputsubscribelocaldh_fuzzer/dinputsubscribelocaldh_fuzzer.cpp @@ -31,7 +31,7 @@ namespace OHOS { namespace DistributedHardware { -void SubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) +void SubscribeLocalHardwareFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -46,7 +46,7 @@ void SubscribeLocalHardwareFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::SubscribeLocalHardwareFuzzTest(data, size); diff --git a/test/fuzztest/distributedinputclient_fuzzer/distributed_input_client_fuzzer.cpp b/test/fuzztest/distributedinputclient_fuzzer/distributed_input_client_fuzzer.cpp index 816d3fa..737864a 100644 --- a/test/fuzztest/distributedinputclient_fuzzer/distributed_input_client_fuzzer.cpp +++ b/test/fuzztest/distributedinputclient_fuzzer/distributed_input_client_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -55,7 +55,7 @@ public: } }; -void RegisterDistributedHardwareFuzzTest(const uint8_t* data, size_t size) +void RegisterDistributedHardwareFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -81,7 +81,7 @@ void RegisterDistributedHardwareFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::RegisterDistributedHardwareFuzzTest(data, size); diff --git a/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp b/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp index 4448659..30217ec 100644 --- a/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp +++ b/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp @@ -42,7 +42,7 @@ public OHOS::DistributedHardware::DistributedInput::PrepareDInputCallbackStub { public: TestPrepareDInputCallback() = default; virtual ~TestPrepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status) + void OnResult(const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -54,7 +54,7 @@ public OHOS::DistributedHardware::DistributedInput::UnprepareDInputCallbackStub public: TestUnprepareDInputCallback() = default; virtual ~TestUnprepareDInputCallback() = default; - void OnResult(const std::string& deviceId, const int32_t& status) + void OnResult(const std::string &deviceId, const int32_t &status) { (void)deviceId; (void)status; @@ -64,7 +64,7 @@ public: class TestStartDInputCallback : public OHOS::DistributedHardware::DistributedInput::StartDInputCallbackStub { public: - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) { (void)devId; (void)inputTypes; @@ -77,7 +77,7 @@ public OHOS::DistributedHardware::DistributedInput::StopDInputCallbackStub { public: TestStopDInputCallback() = default; virtual ~TestStopDInputCallback() = default; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) { (void)devId; (void)inputTypes; @@ -100,7 +100,7 @@ public: } }; -void PrepareInputFuzzTest(const uint8_t* data, size_t size) +void PrepareInputFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size == 0)) { return; @@ -114,7 +114,7 @@ void PrepareInputFuzzTest(const uint8_t* data, size_t size) DistributedInput::DistributedInputKit::UnprepareRemoteInput(networkId, unprepareCb); } -void StartRemoteInputFuzzTest(const uint8_t* data, size_t size) +void StartRemoteInputFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(uint32_t))) { return; @@ -133,7 +133,7 @@ void StartRemoteInputFuzzTest(const uint8_t* data, size_t size) DistributedInput::DistributedInputKit::StartRemoteInput(srcId, sinkId, dhIds, callback); } -void IsNeedFilterOutFuzzTest(const uint8_t* data, size_t size) +void IsNeedFilterOutFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -169,7 +169,7 @@ void StopRemoteInputFuzzTest(const uint8_t* data, size_t size) DistributedInput::DistributedInputKit::StopRemoteInput(srcId, sinkId, dhIds, callback); } -void IsTouchEventNeedFilterOutFuzzTest(const uint8_t* data, size_t size) +void IsTouchEventNeedFilterOutFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(uint32_t))) { return; @@ -187,7 +187,7 @@ void IsTouchEventNeedFilterOutFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::PrepareInputFuzzTest(data, size); diff --git a/test/fuzztest/distributedinputsinktransport_fuzzer/distributed_input_sink_transport_fuzzer.cpp b/test/fuzztest/distributedinputsinktransport_fuzzer/distributed_input_sink_transport_fuzzer.cpp index eac97f1..80e5f06 100644 --- a/test/fuzztest/distributedinputsinktransport_fuzzer/distributed_input_sink_transport_fuzzer.cpp +++ b/test/fuzztest/distributedinputsinktransport_fuzzer/distributed_input_sink_transport_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -26,7 +26,7 @@ namespace OHOS { namespace DistributedHardware { -void RespPrepareRemoteInputFuzzTest(const uint8_t* data, size_t size) +void RespPrepareRemoteInputFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -39,7 +39,7 @@ void RespPrepareRemoteInputFuzzTest(const uint8_t* data, size_t size) DistributedInput::DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg); } -void RespStartRemoteInputFuzzTest(const uint8_t* data, size_t size) +void RespStartRemoteInputFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -55,7 +55,7 @@ void RespStartRemoteInputFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Run your code on data */ OHOS::DistributedHardware::RespPrepareRemoteInputFuzzTest(data, size); diff --git a/test/fuzztest/distributedinputsourcetransport_fuzzer/distributed_input_source_transport_fuzzer.cpp b/test/fuzztest/distributedinputsourcetransport_fuzzer/distributed_input_source_transport_fuzzer.cpp index 36f301d..452f36c 100644 --- a/test/fuzztest/distributedinputsourcetransport_fuzzer/distributed_input_source_transport_fuzzer.cpp +++ b/test/fuzztest/distributedinputsourcetransport_fuzzer/distributed_input_source_transport_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -30,7 +30,7 @@ namespace OHOS { namespace DistributedHardware { -void OpenInputSoftbusFuzzTest(const uint8_t* data, size_t size) +void OpenInputSoftbusFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -47,7 +47,7 @@ void OpenInputSoftbusFuzzTest(const uint8_t* data, size_t size) } // namespace OHOS /* Fuzzer entry point */ -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { OHOS::DistributedHardware::DistributedInput::DistributedInputInject::GetInstance(); /* Run your code on data */ diff --git a/test/fuzztest/distributedinputtransportbase_fuzzer/distributed_input_transport_base_fuzzer.cpp b/test/fuzztest/distributedinputtransportbase_fuzzer/distributed_input_transport_base_fuzzer.cpp index 5ee56dc..ffeac36 100644 --- a/test/fuzztest/distributedinputtransportbase_fuzzer/distributed_input_transport_base_fuzzer.cpp +++ b/test/fuzztest/distributedinputtransportbase_fuzzer/distributed_input_transport_base_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -29,7 +29,7 @@ namespace OHOS { namespace DistributedHardware { -void StartSessionFuzzTest(const uint8_t* data, size_t size) +void StartSessionFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; @@ -43,7 +43,7 @@ void StartSessionFuzzTest(const uint8_t* data, size_t size) DistributedInput::DistributedInputTransportBase::GetInstance().StopSession(remoteDevId); } -void OnBytesReceivedFuzzTest(const uint8_t* data, size_t size) +void OnBytesReceivedFuzzTest(const uint8_t *data, size_t size) { if ((data == nullptr) || (size < sizeof(int32_t))) { return; diff --git a/utils/include/dinput_context.h b/utils/include/dinput_context.h index 4dcf248..7e10294 100644 --- a/utils/include/dinput_context.h +++ b/utils/include/dinput_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -57,7 +57,7 @@ public: int32_t RemoveSinkScreenInfo(const std::string &screenInfoKey); int32_t UpdateSinkScreenInfo(const std::string &screenInfoKey, const SinkScreenInfo &sinkScreenInfo); SinkScreenInfo GetSinkScreenInfo(const std::string &screenInfoKey); - const std::unordered_map& GetAllSinkScreenInfo(); + const std::unordered_map &GetAllSinkScreenInfo(); int32_t RemoveSrcScreenInfo(const std::string &screenInfoKey); int32_t UpdateSrcScreenInfo(const std::string &screenInfoKey, const SrcScreenInfo &srcScreenInfo); @@ -67,7 +67,7 @@ public: LocalTouchScreenInfo GetLocalTouchScreenInfo(); std::shared_ptr GetDHFwkKit(); sptr GetRemoteObject(const int32_t saId); - void AddRemoteObject(const int32_t saId, const sptr& remoteObject); + void AddRemoteObject(const int32_t saId, const sptr &remoteObject); void RemoveRemoteObject(const int32_t saId); private: diff --git a/utils/include/dinput_utils_tool.h b/utils/include/dinput_utils_tool.h index bb79969..d055a7c 100644 --- a/utils/include/dinput_utils_tool.h +++ b/utils/include/dinput_utils_tool.h @@ -38,24 +38,24 @@ std::string GetUUIDBySoftBus(const std::string &networkId); uint64_t GetCurrentTime(); std::string SetAnonyId(const std::string &message); /* IsString, IsUInt32 and IsUInt64 are used to valid json key */ -bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key); -bool IsString(const nlohmann::json& jsonObj, const std::string& key); -bool IsInt32(const nlohmann::json& jsonObj, const std::string& key); -bool IsInt64(const nlohmann::json& jsonObj, const std::string& key); -bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key); -bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key); -bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key); -bool IsArray(const nlohmann::json& jsonObj, const std::string& key); +bool IsBoolean(const nlohmann::json &jsonObj, const std::string &key); +bool IsString(const nlohmann::json &jsonObj, const std::string &key); +bool IsInt32(const nlohmann::json &jsonObj, const std::string &key); +bool IsInt64(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt16(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key); +bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key); +bool IsArray(const nlohmann::json &jsonObj, const std::string &key); std::string GetNodeDesc(std::string parameters); std::string GetAnonyString(const std::string &value); std::string GetAnonyInt32(const int32_t value); -std::string Sha256(const std::string& string); -void CloseFd(int& fd); +std::string Sha256(const std::string &string); +void CloseFd(int &fd); int BitIsSet(const unsigned long *array, int bit); -void StringSplitToVector(const std::string& str, const char split, std::vector& vecStr); +void StringSplitToVector(const std::string &str, const char split, std::vector &vecStr); int OpenInputDeviceFdByPath(const std::string &devicePath); std::string ConvertErrNo(); -void ScanInputDevicesPath(const std::string &dirName, std::vector& vecInputDevPath); +void ScanInputDevicesPath(const std::string &dirName, std::vector &vecInputDevPath); } // namespace DistributedInput } // namespace DistributedHardware } // namespace OHOS diff --git a/utils/src/dinput_context.cpp b/utils/src/dinput_context.cpp index 2635d97..201399f 100644 --- a/utils/src/dinput_context.cpp +++ b/utils/src/dinput_context.cpp @@ -76,7 +76,7 @@ SinkScreenInfo DInputContext::GetSinkScreenInfo(const std::string &screenInfoKey return sinkScreenInfoMap_[screenInfoKey]; } -const std::unordered_map& DInputContext::GetAllSinkScreenInfo() +const std::unordered_map &DInputContext::GetAllSinkScreenInfo() { std::lock_guard lock(sinkMapMutex_); return sinkScreenInfoMap_; @@ -195,7 +195,7 @@ sptr DInputContext::GetRemoteObject(const int32_t saId) return remoteObject; } -void DInputContext::AddRemoteObject(const int32_t saId, const sptr& remoteObject) +void DInputContext::AddRemoteObject(const int32_t saId, const sptr &remoteObject) { std::lock_guard lock(remoteObjectsMutex_); remoteObjects_[saId] = remoteObject; diff --git a/utils/src/dinput_utils_tool.cpp b/utils/src/dinput_utils_tool.cpp index 51a1b40..95a6700 100644 --- a/utils/src/dinput_utils_tool.cpp +++ b/utils/src/dinput_utils_tool.cpp @@ -137,7 +137,7 @@ std::string SetAnonyId(const std::string &message) return jsonObj.dump(); } -bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key) +bool IsBoolean(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_boolean(); if (!res) { @@ -146,7 +146,7 @@ bool IsBoolean(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsString(const nlohmann::json& jsonObj, const std::string& key) +bool IsString(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_string(); if (!res) { @@ -155,7 +155,7 @@ bool IsString(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsInt32(const nlohmann::json& jsonObj, const std::string& key) +bool IsInt32(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && INT32_MIN <= jsonObj[key] && jsonObj[key] <= INT32_MAX; @@ -165,7 +165,7 @@ bool IsInt32(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsInt64(const nlohmann::json& jsonObj, const std::string& key) +bool IsInt64(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && INT64_MIN <= jsonObj[key] && jsonObj[key] <= INT64_MAX; @@ -175,7 +175,7 @@ bool IsInt64(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key) +bool IsUInt16(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT16_MAX; if (!res) { @@ -184,7 +184,7 @@ bool IsUInt16(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key) +bool IsUInt32(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT32_MAX; if (!res) { @@ -193,7 +193,7 @@ bool IsUInt32(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key) +bool IsUInt64(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] <= UINT64_MAX; if (!res) { @@ -202,7 +202,7 @@ bool IsUInt64(const nlohmann::json& jsonObj, const std::string& key) return res; } -bool IsArray(const nlohmann::json& jsonObj, const std::string& key) +bool IsArray(const nlohmann::json &jsonObj, const std::string &key) { bool res = jsonObj.contains(key) && jsonObj[key].is_array(); if (!res) { @@ -274,7 +274,7 @@ std::string GetAnonyInt32(const int32_t value) return tempString; } -std::string Sha256(const std::string& in) +std::string Sha256(const std::string &in) { unsigned char out[SHA256_DIGEST_LENGTH * HEX_TO_UINT8 + 1] = {0}; SHA256_CTX ctx; @@ -293,7 +293,7 @@ std::string Sha256(const std::string& in) return reinterpret_cast(out); } -void CloseFd(int& fd) +void CloseFd(int &fd) { if (fd < 0) { DHLOGE("No fd need to beclosed."); @@ -308,7 +308,7 @@ int BitIsSet(const unsigned long *array, int bit) return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); } -void StringSplitToVector(const std::string& str, const char split, std::vector& vecStr) +void StringSplitToVector(const std::string &str, const char split, std::vector &vecStr) { if (str.empty()) { DHLOGE("StringSplitToVector param str is error."); @@ -362,7 +362,7 @@ std::string ConvertErrNo() return errNoMsg; } -void ScanInputDevicesPath(const std::string &dirName, std::vector& vecInputDevPath) +void ScanInputDevicesPath(const std::string &dirName, std::vector &vecInputDevPath) { DIR *dir; struct dirent *de; -- Gitee