Description:fix code style

Match-id-a6b9da56ad53fe963954281dd9230d15af6fc03a
This commit is contained in:
xxxx
2022-06-21 14:53:26 +08:00
parent bc5172c2d7
commit 7581288c5c
15 changed files with 19 additions and 29 deletions
+1 -3
View File
@@ -98,9 +98,7 @@ namespace DistributedInput {
*/
constexpr uint32_t INPUT_TYPE_ALL = INPUT_TYPE_MOUSE | INPUT_TYPE_KEYBOARD | INPUT_TYPE_TOUCH;
constexpr int32_t INPUT_SUBSCRIBESA_DELAY_MS = 5;
constexpr int32_t INPUT_LOADSA_TIMEOUT_MS = 10000;
constexpr int32_t INPUT_LOAD_SA_TIMEOUT_MS = 10000;
constexpr int32_t SESSION_WAIT_TIMEOUT_SECOND = 5;
+3 -3
View File
@@ -43,8 +43,8 @@ const uint32_t ERROR_MSG_MAX_LEN = 256;
}
InputHub::InputHub() : epollFd_(0), iNotifyFd_(0), inputWd_(0), needToScanDevices_(true), nextDeviceId_(1),
mPendingEventItems{0x00}, pendingEventCount_(0), pendingEventIndex_(0), pendingINotify_(false),
deviceChanged_(false), inputTypes_(0), isStartCollectEvent_(false), isStartCollectHandler_(false)
mPendingEventItems{}, pendingEventCount_(0), pendingEventIndex_(0), pendingINotify_(false), deviceChanged_(false),
inputTypes_(0), isStartCollectEvent_(false), isStartCollectHandler_(false)
{
Initialize();
}
@@ -388,7 +388,7 @@ void InputHub::ScanInputDevices(const std::string& dirname)
size_t dirNameThirdPos = 2;
while ((de = readdir(dir))) {
/*
* The maximum value of d_name defined in the Linux kernel is 260. Therefore,
* The maximum value of d_name defined in the linux kernel is 260. Therefore,
* The d_name length does not need to be verified.
*/
if (de->d_name[dirNameFirstPos] == '.' && (de->d_name[dirNameSecondPos] == '\0' ||
+1
View File
@@ -31,6 +31,7 @@ namespace {
const char* const SPLIT_LINE = "|";
const char* const SPLIT_COMMA = ",";
}
WhiteListUtil::WhiteListUtil()
{
}
@@ -26,9 +26,7 @@ namespace DistributedHardware {
namespace DistributedInput {
std::shared_ptr<DistributedInputClient> DistributedInputClient::instance(new DistributedInputClient());
DistributedInputClient::DistributedInputClient()
{
}
DistributedInputClient::DistributedInputClient() {}
DistributedInputClient &DistributedInputClient::GetInstance()
{
@@ -139,39 +139,30 @@ int32_t DistributedInputSourceStub::OnRemoteRequest(uint32_t code, MessageParcel
switch (code) {
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::INIT): {
return HandleInitDistributedHardware(reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::RELEASE): {
return HandleReleaseDistributedHardware(reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_REMOTE_INPUT): {
return HandleRegisterDistributedHardware(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNREGISTER_REMOTE_INPUT): {
return HandleUnregisterDistributedHardware(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::PREPARE_REMOTE_INPUT): {
return HandlePrepareRemoteInput(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNPREPARE_REMOTE_INPUT): {
return HandleUnprepareRemoteInput(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::START_REMOTE_INPUT): {
return HandleStartRemoteInput(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::STOP_REMOTE_INPUT): {
return HandleStopRemoteInput(data, reply);
break;
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::ISSTART_REMOTE_INPUT): {
return HandleIsStartDistributedInput(data, reply);
break;
}
default:
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
@@ -33,9 +33,8 @@
namespace OHOS {
namespace DistributedHardware {
namespace DistributedInput {
DistributedInputCollector::DistributedInputCollector()
: mEventBuffer{0x00}, collectThreadID_(-1), isCollectingEvents_(false),
isStartGetDeviceHandlerThread(false), inputTypes_(0)
DistributedInputCollector::DistributedInputCollector() : mEventBuffer{0x00}, collectThreadID_(-1),
isCollectingEvents_(false), isStartGetDeviceHandlerThread(false), inputTypes_(0)
{
inputHub_ = std::make_unique<InputHub>();
}
@@ -350,6 +350,7 @@ uint32_t DistributedInputSinkManager::GetInputTypes()
{
return inputTypes_;
}
void DistributedInputSinkManager::SetInputTypes(const uint32_t& inputTypess)
{
inputTypes_ = inputTypess;
@@ -122,6 +122,7 @@ HWTEST_F(DistributedInputSinkTransTest, StartSwitch01, testing::ext::TestSize.Le
int32_t ret = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId);
EXPECT_EQ(SUCCESS, ret);
}
HWTEST_F(DistributedInputSinkTransTest, StartSwitch02, testing::ext::TestSize.Level1)
{
int32_t sessionId = 1000;
@@ -146,6 +146,7 @@ void DistributedInputNodeManager::StartInjectThread()
DHLOGI("start");
isInjectThreadRunning_.store(true);
eventInjectThread_ = std::thread(&DistributedInputNodeManager::InjectEvent, this);
DHLOGI("end");
}
void DistributedInputNodeManager::StopInjectThread()
@@ -156,7 +157,7 @@ void DistributedInputNodeManager::StopInjectThread()
if (eventInjectThread_.joinable()) {
eventInjectThread_.join();
}
DHLOGI("stop");
DHLOGI("end");
}
void DistributedInputNodeManager::ReportEvent(const RawEvent rawEvent)
@@ -189,7 +190,7 @@ void DistributedInputNodeManager::InjectEvent()
DHLOGD("process event, inject queue size: %zu", injectQueue_.size());
ProcessInjectEvent(event);
}
DHLOGI("stop");
DHLOGI("end");
}
void DistributedInputNodeManager::ProcessInjectEvent(const std::shared_ptr<RawEvent> &rawEvent)
@@ -180,7 +180,7 @@ void VirtualDevice::RecordEventLog(const input_event& event)
eventType = "other type";
break;
}
DHLOGD("4.E2E-Test Source write event into input driver, EventType: %s Code: %d, Value: %d, Sec: %ld, Sec1: %ld",
DHLOGD("4.E2E-Test Source write event into input driver, EventType: %s, Code: %d, Value: %d, Sec: %ld, Sec1: %ld",
eventType.c_str(), event.code, event.value, event.input_event_sec, event.input_event_usec);
}
} // namespace DistributedInput
@@ -1146,7 +1146,7 @@ void DistributedInputSourceManager::DInputSourceListener::RecordEventLog(int64_t
eventType = "other type";
break;
}
DHLOGD("3.E2E-Test Source softBus receive event, EventType: %s Code: %d, Value: %d, Path: %s, When: " PRId64"",
DHLOGD("3.E2E-Test Source softBus receive event, EventType: %s, Code: %d, Value: %d, Path: %s, When: " PRId64"",
eventType.c_str(), code, value, path.c_str(), when);
}
} // namespace DistributedInput
@@ -59,8 +59,6 @@ ohos_unittest("distributed_input_sourcemanager_test") {
"//foundation/distributedhardware/distributed_input/services/source/inputinject/src/virtual_mouse.cpp",
"//foundation/distributedhardware/distributed_input/services/source/inputinject/src/virtual_touchpad.cpp",
"//foundation/distributedhardware/distributed_input/services/source/transport/src/distributed_input_source_transport.cpp",
"${ipc_path}/src/add_white_list_infos_call_back_proxy.cpp",
"${ipc_path}/src/add_white_list_infos_call_back_stub.cpp",
"${ipc_path}/src/del_white_list_infos_call_back_proxy.cpp",
@@ -158,10 +158,12 @@ int32_t DistributedInputSourceTransport::OpenInputSoftbus(const std::string &rem
GetAnonyString(remoteDevId).c_str(), GetAnonyInt32(sessionId).c_str());
return ERR_DH_INPUT_SERVER_SOURCE_TRANSPORT_OPEN_SESSION_FAIL;
}
{
std::unique_lock<std::mutex> sessionLock(operationMutex_);
sessionDevMap_[remoteDevId] = sessionId;
}
DHLOGI("Wait for channel session opened.");
{
std::unique_lock<std::mutex> waitLock(operationMutex_);
@@ -53,7 +53,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string &params)
}
}
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOADSA_TIMEOUT_MS),
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS),
[this]() { return (DistributedInputClient::GetInstance().HasDInputSinkProxy()); });
if (!waitStatus) {
DHLOGE("dinput load sa timeout.");
@@ -52,7 +52,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string &params)
}
}
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOADSA_TIMEOUT_MS),
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS),
[this]() { return (DistributedInputClient::GetInstance().HasDInputSourceProxy()); });
if (!waitStatus) {
DHLOGE("dinput load sa timeout.");