mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-19 17:43:35 -04:00
Description:fix code style
Match-id-367e11f0b17000d1487945d1f290ab2c5f5e0ec8
This commit is contained in:
@@ -274,7 +274,7 @@ bool WhiteListUtil::IsNeedFilterOut(const std::string &deviceId, const BusinessE
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (combKeysHashMap_.empty()) {
|
||||
DHLOGE("%s called, whilte list is empty!", __func__);
|
||||
DHLOGE("%s called, white list is empty!", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,5 +59,4 @@ ohos_shared_library("libdinput_dfx_utils") {
|
||||
subsystem_name = "distributedhardware"
|
||||
|
||||
part_name = "distributed_input"
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "single_instance.h"
|
||||
#include "hisysevent.h"
|
||||
#include "constants_dinput.h"
|
||||
@@ -52,8 +53,7 @@ private:
|
||||
HisyseventUtil() = default;
|
||||
~HisyseventUtil() = default;
|
||||
};
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_DISTRIBUTED_INPUT_HISYSEVENT_UTILS_H
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
||||
@@ -175,11 +175,11 @@ int32_t HiDumper::ShowHelp(std::string &result)
|
||||
{
|
||||
DHLOGI("ShowHelp Dump.");
|
||||
result.append("Usage:dump <command> [options]\n")
|
||||
.append("Description:\n")
|
||||
.append("-nodeinfo ")
|
||||
.append("dump all input node information in the system\n")
|
||||
.append("-sessioninfo ")
|
||||
.append("dump all input session information in the system\n");
|
||||
.append("Description:\n")
|
||||
.append("-nodeinfo ")
|
||||
.append("dump all input node information in the system\n")
|
||||
.append("-sessioninfo ")
|
||||
.append("dump all input session information in the system\n");
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ void HiDumper::SetSessionStatus(const std::string& remoteDevId, const SessionSta
|
||||
}
|
||||
sessionInfos_[remoteDevId].sessionStatus_ = sessionStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ private:
|
||||
void StopInputMonitorDeviceThread();
|
||||
|
||||
// The event queue.
|
||||
static const int INPUT_DEVICR_BUFFER_SIZE = 32;
|
||||
InputDeviceEvent mEventBuffer[INPUT_DEVICR_BUFFER_SIZE] = {};
|
||||
static const int INPUT_DEVICE_BUFFER_SIZE = 32;
|
||||
InputDeviceEvent mEventBuffer[INPUT_DEVICE_BUFFER_SIZE] = {};
|
||||
std::mutex operationMutex_;
|
||||
std::unique_ptr<InputHub> inputHub_;
|
||||
};
|
||||
|
||||
@@ -166,7 +166,7 @@ void *DistributedInputHandler::CollectEventsThread(void *param)
|
||||
void DistributedInputHandler::StartInputMonitorDeviceThread(const std::string deviceId)
|
||||
{
|
||||
while (isCollectingEvents_) {
|
||||
size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICR_BUFFER_SIZE);
|
||||
size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICE_BUFFER_SIZE);
|
||||
if (count > 0) {
|
||||
DHLOGI("Count: %zu", count);
|
||||
for (size_t iCnt = 0; iCnt < count; iCnt++) {
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
class DinputSAManager {
|
||||
DECLARE_SINGLE_INSTANCE_BASE(DinputSAManager);
|
||||
class DInputSAManager {
|
||||
DECLARE_SINGLE_INSTANCE_BASE(DInputSAManager);
|
||||
public:
|
||||
void Init();
|
||||
bool GetDInputSourceProxy();
|
||||
@@ -43,14 +43,14 @@ public:
|
||||
|
||||
public:
|
||||
class SystemAbilityListener : public SystemAbilityStatusChangeStub {
|
||||
public:
|
||||
void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
|
||||
void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
|
||||
public:
|
||||
void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
|
||||
void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
|
||||
};
|
||||
|
||||
private:
|
||||
DinputSAManager() = default;
|
||||
~DinputSAManager() = default;
|
||||
DInputSAManager() = default;
|
||||
~DInputSAManager() = default;
|
||||
|
||||
public:
|
||||
std::atomic<bool> dInputSourceSAOnline = false;
|
||||
@@ -67,5 +67,4 @@ public:
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // DINPUT_SA_MANAGER_H
|
||||
#endif
|
||||
@@ -25,34 +25,33 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
namespace DistributedInput {
|
||||
IMPLEMENT_SINGLE_INSTANCE(DinputSAManager);
|
||||
IMPLEMENT_SINGLE_INSTANCE(DInputSAManager);
|
||||
|
||||
void DinputSAManager::SystemAbilityListener::OnRemoveSystemAbility(int32_t systemAbilityId,
|
||||
const std::string& deviceId)
|
||||
void DInputSAManager::SystemAbilityListener::OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId)
|
||||
{
|
||||
if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID) {
|
||||
DinputSAManager::GetInstance().dInputSourceSAOnline.store(false);
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
DinputSAManager::GetInstance().dInputSourceProxy_ = nullptr;
|
||||
DInputSAManager::GetInstance().dInputSourceSAOnline.store(false);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
DInputSAManager::GetInstance().dInputSourceProxy_ = nullptr;
|
||||
} else if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID) {
|
||||
DinputSAManager::GetInstance().dInputSinkSAOnline.store(false);
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
DinputSAManager::GetInstance().dInputSinkProxy_ = nullptr;
|
||||
DInputSAManager::GetInstance().dInputSinkSAOnline.store(false);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
DInputSAManager::GetInstance().dInputSinkProxy_ = nullptr;
|
||||
}
|
||||
DHLOGI("sa %d is removed.", systemAbilityId);
|
||||
}
|
||||
|
||||
void DinputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
|
||||
void DInputSAManager::SystemAbilityListener::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId)
|
||||
{
|
||||
if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID) {
|
||||
DinputSAManager::GetInstance().dInputSourceSAOnline.store(true);
|
||||
DInputSAManager::GetInstance().dInputSourceSAOnline.store(true);
|
||||
} else if (systemAbilityId == DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID) {
|
||||
DinputSAManager::GetInstance().dInputSinkSAOnline.store(true);
|
||||
DInputSAManager::GetInstance().dInputSinkSAOnline.store(true);
|
||||
}
|
||||
DHLOGI("sa %d is added.", systemAbilityId);
|
||||
}
|
||||
|
||||
void DinputSAManager::Init()
|
||||
void DInputSAManager::Init()
|
||||
{
|
||||
saListenerCallback = new(std::nothrow) SystemAbilityListener();
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
@@ -86,10 +85,10 @@ void DinputSAManager::Init()
|
||||
}
|
||||
}
|
||||
|
||||
bool DinputSAManager::GetDInputSourceProxy()
|
||||
bool DInputSAManager::GetDInputSourceProxy()
|
||||
{
|
||||
if (!isSubscribeSrcSAChangeListener.load()) {
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
if (!isSubscribeSrcSAChangeListener.load()) {
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
@@ -110,7 +109,7 @@ bool DinputSAManager::GetDInputSourceProxy()
|
||||
}
|
||||
|
||||
if (dInputSourceSAOnline.load() && !dInputSourceProxy_) {
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
if (dInputSourceProxy_ != nullptr) {
|
||||
DHLOGI("dinput source proxy has already got.");
|
||||
return true;
|
||||
@@ -135,19 +134,19 @@ bool DinputSAManager::GetDInputSourceProxy()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
return dInputSourceProxy_ != nullptr;
|
||||
}
|
||||
|
||||
bool DinputSAManager::HasDInputSourceProxy()
|
||||
bool DInputSAManager::HasDInputSourceProxy()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
return dInputSourceProxy_ != nullptr;
|
||||
}
|
||||
|
||||
bool DinputSAManager::SetDInputSourceProxy(const sptr<IRemoteObject> &remoteObject)
|
||||
bool DInputSAManager::SetDInputSourceProxy(const sptr<IRemoteObject> &remoteObject)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sourceMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sourceMutex_);
|
||||
dInputSourceProxy_ = iface_cast<IDistributedSourceInput>(remoteObject);
|
||||
|
||||
if ((!dInputSourceProxy_) || (!dInputSourceProxy_->AsObject())) {
|
||||
@@ -157,10 +156,10 @@ bool DinputSAManager::SetDInputSourceProxy(const sptr<IRemoteObject> &remoteObje
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DinputSAManager::GetDInputSinkProxy()
|
||||
bool DInputSAManager::GetDInputSinkProxy()
|
||||
{
|
||||
if (!isSubscribeSinkSAChangeListener.load()) {
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
if (!isSubscribeSinkSAChangeListener.load()) {
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
@@ -181,7 +180,7 @@ bool DinputSAManager::GetDInputSinkProxy()
|
||||
}
|
||||
|
||||
if (dInputSinkSAOnline.load() && !dInputSinkProxy_) {
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
if (dInputSinkProxy_ != nullptr) {
|
||||
DHLOGI("dinput sink proxy has already got.");
|
||||
return true;
|
||||
@@ -205,19 +204,19 @@ bool DinputSAManager::GetDInputSinkProxy()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
return dInputSinkProxy_ != nullptr;
|
||||
}
|
||||
|
||||
bool DinputSAManager::HasDInputSinkProxy()
|
||||
bool DInputSAManager::HasDInputSinkProxy()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
return dInputSinkProxy_ != nullptr;
|
||||
}
|
||||
|
||||
bool DinputSAManager::SetDInputSinkProxy(const sptr<IRemoteObject> &remoteObject)
|
||||
bool DInputSAManager::SetDInputSinkProxy(const sptr<IRemoteObject> &remoteObject)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(DinputSAManager::GetInstance().sinkMutex_);
|
||||
std::lock_guard<std::mutex> lock(DInputSAManager::GetInstance().sinkMutex_);
|
||||
dInputSinkProxy_ = iface_cast<IDistributedSinkInput>(remoteObject);
|
||||
|
||||
if ((!dInputSinkProxy_) || (!dInputSinkProxy_->AsObject())) {
|
||||
|
||||
@@ -33,7 +33,7 @@ std::shared_ptr<DistributedInputClient> DistributedInputClient::instance(new Dis
|
||||
|
||||
DistributedInputClient::DistributedInputClient()
|
||||
{
|
||||
DinputSAManager::GetInstance().Init();
|
||||
DInputSAManager::GetInstance().Init();
|
||||
}
|
||||
|
||||
DistributedInputClient &DistributedInputClient::GetInstance()
|
||||
@@ -102,23 +102,23 @@ void DistributedInputClient::DelWhiteListInfosCb::OnResult(const std::string& de
|
||||
|
||||
int32_t DistributedInputClient::InitSource()
|
||||
{
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->Init();
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->Init();
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::InitSink()
|
||||
{
|
||||
if (!DinputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
return ERR_DH_INPUT_CLIENT_GET_SINK_PROXY_FAIL;
|
||||
}
|
||||
return DinputSAManager::GetInstance().dInputSinkProxy_->Init();
|
||||
return DInputSAManager::GetInstance().dInputSinkProxy_->Init();
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::ReleaseSource()
|
||||
{
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
|
||||
@@ -129,19 +129,19 @@ int32_t DistributedInputClient::ReleaseSource()
|
||||
addWhiteListCallback = nullptr;
|
||||
delWhiteListCallback = nullptr;
|
||||
WhiteListUtil::GetInstance().ClearWhiteList();
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->Release();
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->Release();
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::ReleaseSink()
|
||||
{
|
||||
if (!DinputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
return ERR_DH_INPUT_CLIENT_GET_SINK_PROXY_FAIL;
|
||||
}
|
||||
serverType = DInputServerType::NULL_SERVER_TYPE;
|
||||
inputTypes_ = DInputDeviceType::NONE;
|
||||
sinkTypeCallback = nullptr;
|
||||
WhiteListUtil::GetInstance().ClearWhiteList();
|
||||
return DinputSAManager::GetInstance().dInputSinkProxy_->Release();
|
||||
return DInputSAManager::GetInstance().dInputSinkProxy_->Release();
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
|
||||
@@ -150,7 +150,7 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& d
|
||||
DHLOGI("%s called, deviceId: %s, dhId: %s, parameters: %s",
|
||||
__func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str(), parameters.c_str());
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("RegisterDistributedHardware client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -174,17 +174,16 @@ int32_t DistributedInputClient::RegisterDistributedHardware(const std::string& d
|
||||
dHardWareFwkRstInfos.push_back(info);
|
||||
}
|
||||
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->RegisterDistributedHardware(devId, dhId, parameters,
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->RegisterDistributedHardware(devId, dhId, parameters,
|
||||
new(std::nothrow) RegisterDInputCb());
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string& devId, const std::string& dhId,
|
||||
const std::shared_ptr<UnregisterCallback>& callback)
|
||||
{
|
||||
DHLOGI("%s called, deviceId: %s, dhId: %s",
|
||||
__func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str());
|
||||
DHLOGI("%s called, deviceId: %s, dhId: %s", __func__, GetAnonyString(devId).c_str(), GetAnonyString(dhId).c_str());
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("UnregisterDistributedHardware client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -208,7 +207,7 @@ int32_t DistributedInputClient::UnregisterDistributedHardware(const std::string&
|
||||
dHardWareFwkUnRstInfos.push_back(info);
|
||||
}
|
||||
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->UnregisterDistributedHardware(devId, dhId,
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->UnregisterDistributedHardware(devId, dhId,
|
||||
new(std::nothrow) UnregisterDInputCb());
|
||||
}
|
||||
|
||||
@@ -217,7 +216,7 @@ int32_t DistributedInputClient::PrepareRemoteInput(
|
||||
{
|
||||
DHLOGI("%s called, deviceId: %s", __func__, GetAnonyString(deviceId).c_str());
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("PrepareRemoteInput client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -227,16 +226,16 @@ int32_t DistributedInputClient::PrepareRemoteInput(
|
||||
}
|
||||
|
||||
addWhiteListCallback = new(std::nothrow) AddWhiteListInfosCb();
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->PrepareRemoteInput(deviceId, callback,
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->PrepareRemoteInput(deviceId, callback,
|
||||
addWhiteListCallback);
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::UnprepareRemoteInput(
|
||||
const std::string& deviceId, sptr<IUnprepareDInputCallback> callback)
|
||||
int32_t DistributedInputClient::UnprepareRemoteInput(const std::string& deviceId,
|
||||
sptr<IUnprepareDInputCallback> callback)
|
||||
{
|
||||
DHLOGI("%s called, deviceId: %s", __func__, GetAnonyString(deviceId).c_str());
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("PrepareRemoteInput client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -246,7 +245,7 @@ int32_t DistributedInputClient::UnprepareRemoteInput(
|
||||
}
|
||||
|
||||
delWhiteListCallback = new(std::nothrow) DelWhiteListInfosCb();
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->UnprepareRemoteInput(deviceId, callback,
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->UnprepareRemoteInput(deviceId, callback,
|
||||
delWhiteListCallback);
|
||||
}
|
||||
|
||||
@@ -255,7 +254,7 @@ int32_t DistributedInputClient::StartRemoteInput(
|
||||
{
|
||||
DHLOGI("%s called, deviceId: %s, inputTypes: %d", __func__, GetAnonyString(deviceId).c_str(), inputTypes);
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("StartRemoteInput client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -267,15 +266,15 @@ int32_t DistributedInputClient::StartRemoteInput(
|
||||
return ERR_DH_INPUT_CLIENT_START_FAIL;
|
||||
}
|
||||
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->StartRemoteInput(deviceId, inputTypes, callback);
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->StartRemoteInput(deviceId, inputTypes, callback);
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::StopRemoteInput(
|
||||
const std::string& deviceId, const uint32_t& inputTypes, sptr<IStopDInputCallback> callback)
|
||||
int32_t DistributedInputClient::StopRemoteInput(const std::string& deviceId, const uint32_t& inputTypes,
|
||||
sptr<IStopDInputCallback> callback)
|
||||
{
|
||||
DHLOGI("%s called, deviceId: %s, inputTypes: %d", __func__, GetAnonyString(deviceId).c_str(), inputTypes);
|
||||
|
||||
if (!DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("StopRemoteInput client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
@@ -287,7 +286,7 @@ int32_t DistributedInputClient::StopRemoteInput(
|
||||
return ERR_DH_INPUT_CLIENT_STOP_FAIL;
|
||||
}
|
||||
|
||||
return DinputSAManager::GetInstance().dInputSourceProxy_->StopRemoteInput(deviceId, inputTypes, callback);
|
||||
return DInputSAManager::GetInstance().dInputSourceProxy_->StopRemoteInput(deviceId, inputTypes, callback);
|
||||
}
|
||||
|
||||
bool DistributedInputClient::IsNeedFilterOut(const std::string& deviceId, const BusinessEvent& event)
|
||||
@@ -302,17 +301,17 @@ DInputServerType DistributedInputClient::IsStartDistributedInput(const uint32_t&
|
||||
int32_t retSource = 0;
|
||||
int32_t retSink = 0;
|
||||
|
||||
if (sourceTypeCallback == nullptr && DinputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
if (sourceTypeCallback == nullptr && DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGI("Init sourceTypeCallback");
|
||||
sourceTypeCallback = new(std::nothrow) StartDInputServerCb();
|
||||
retSource = DinputSAManager::GetInstance().dInputSourceProxy_->IsStartDistributedInput(inputType,
|
||||
retSource = DInputSAManager::GetInstance().dInputSourceProxy_->IsStartDistributedInput(inputType,
|
||||
sourceTypeCallback);
|
||||
}
|
||||
|
||||
if (sinkTypeCallback == nullptr && DinputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
if (sinkTypeCallback == nullptr && DInputSAManager::GetInstance().GetDInputSinkProxy()) {
|
||||
DHLOGI("Init sinkTypeCallback");
|
||||
sinkTypeCallback = new(std::nothrow) StartDInputServerCb();
|
||||
retSink = DinputSAManager::GetInstance().dInputSinkProxy_->IsStartDistributedInput(inputType, sinkTypeCallback);
|
||||
retSink = DInputSAManager::GetInstance().dInputSinkProxy_->IsStartDistributedInput(inputType, sinkTypeCallback);
|
||||
}
|
||||
|
||||
if (static_cast<DInputServerType>(retSource) != DInputServerType::NULL_SERVER_TYPE) {
|
||||
@@ -349,8 +348,7 @@ bool DistributedInputClient::IsJsonData(std::string strData) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void DistributedInputClient::AddWhiteListInfos(
|
||||
const std::string &deviceId, const std::string &strJson) const
|
||||
void DistributedInputClient::AddWhiteListInfos(const std::string &deviceId, const std::string &strJson) const
|
||||
{
|
||||
nlohmann::json inputData = nlohmann::json::parse(strJson);
|
||||
size_t jsonSize = inputData.size();
|
||||
@@ -360,8 +358,7 @@ void DistributedInputClient::AddWhiteListInfos(
|
||||
WhiteListUtil::GetInstance().SyncWhiteList(deviceId, vecWhiteList);
|
||||
}
|
||||
|
||||
void DistributedInputClient::DelWhiteListInfos(
|
||||
const std::string &deviceId) const
|
||||
void DistributedInputClient::DelWhiteListInfos(const std::string &deviceId) const
|
||||
{
|
||||
WhiteListUtil::GetInstance().ClearWhiteList(deviceId);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &
|
||||
case static_cast<uint32_t>(IDistributedSinkInput::MessageCode::INIT): {
|
||||
int32_t ret = Init();
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("DistributedInputSourceStub init write ret failed");
|
||||
DHLOGE("DistributedInputSinkStub write ret failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
break;
|
||||
@@ -49,7 +49,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &
|
||||
case static_cast<uint32_t>(IDistributedSinkInput::MessageCode::RELEASE): {
|
||||
int32_t ret = Release();
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("DistributedInputSourceStub release write ret failed");
|
||||
DHLOGE("DistributedInputSinkStub write ret failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
break;
|
||||
@@ -61,7 +61,7 @@ int32_t DistributedInputSinkStub::OnRemoteRequest(uint32_t code, MessageParcel &
|
||||
iface_cast<IStartDInputServerCallback>(data.ReadRemoteObject());
|
||||
int32_t ret = IsStartDistributedInput(inputType, callback);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("DistributedInputSourceStub isStartDistributedInput write ret failed");
|
||||
DHLOGE("DistributedInputSinkStub write ret failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,7 @@ int32_t UnregisterDInputCallbackStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
if (data.ReadInterfaceToken() != GetDescriptor()) {
|
||||
DHLOGE("UnRegisterDInputCallbackStub read token valid failed");
|
||||
DHLOGE("UnregisterDInputCallbackStub read token valid failed");
|
||||
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
|
||||
}
|
||||
IUnregisterDInputCallback::Message msgCode = static_cast<IUnregisterDInputCallback::Message>(code);
|
||||
|
||||
@@ -368,6 +368,6 @@ int32_t DistributedInputSinkManager::Dump(int32_t fd, const std::vector<std::u16
|
||||
}
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
} // namespace DistributedInputanager
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -461,7 +461,7 @@ void DistributedInputSinkTransport::DInputSinkEventHandler::RecordEventLog(
|
||||
int32_t code = event[INPUT_KEY_CODE];
|
||||
int32_t value = event[INPUT_KEY_VALUE];
|
||||
std::string path = event[INPUT_KEY_PATH];
|
||||
DHLOGD("2.E2E-Test Sink softBus send, EventType:%s, Code: %d, Value: %d, Path: %s, When: %" PRId64 "",
|
||||
DHLOGD("2.E2E-Test Sink softBus send, EventType: %s, Code: %d, Value: %d, Path: %s, When: %" PRId64 "",
|
||||
eventType.c_str(), code, value, path.c_str(), when);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string ¶ms)
|
||||
{
|
||||
DHLOGD("InitSource");
|
||||
std::unique_lock<std::mutex> lock(proxyMutex_);
|
||||
if (!DinputSAManager::GetInstance().HasDInputSinkProxy()) {
|
||||
if (!DInputSAManager::GetInstance().HasDInputSinkProxy()) {
|
||||
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!samgr) {
|
||||
DHLOGE("Failed to get system ability mgr.");
|
||||
@@ -54,7 +54,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string ¶ms)
|
||||
}
|
||||
|
||||
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS),
|
||||
[this]() { return (DinputSAManager::GetInstance().HasDInputSinkProxy()); });
|
||||
[this]() { return (DInputSAManager::GetInstance().HasDInputSinkProxy()); });
|
||||
if (!waitStatus) {
|
||||
DHLOGE("dinput load sa timeout.");
|
||||
return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL;
|
||||
@@ -67,7 +67,7 @@ void DistributedInputSinkHandler::FinishStartSA(const std::string ¶ms, const
|
||||
{
|
||||
DHLOGD("FinishStartSA");
|
||||
std::unique_lock<std::mutex> lock(proxyMutex_);
|
||||
DinputSAManager::GetInstance().SetDInputSinkProxy(remoteObject);
|
||||
DInputSAManager::GetInstance().SetDInputSinkProxy(remoteObject);
|
||||
DistributedInputClient::GetInstance().InitSink();
|
||||
proxyConVar_.notify_all();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms)
|
||||
{
|
||||
DHLOGD("InitSource");
|
||||
std::unique_lock<std::mutex> lock(proxyMutex_);
|
||||
if (!DinputSAManager::GetInstance().HasDInputSourceProxy()) {
|
||||
if (!DInputSAManager::GetInstance().HasDInputSourceProxy()) {
|
||||
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (!samgr) {
|
||||
DHLOGE("Failed to get system ability mgr.");
|
||||
@@ -53,7 +53,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms)
|
||||
}
|
||||
|
||||
auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(INPUT_LOAD_SA_TIMEOUT_MS),
|
||||
[this]() { return (DinputSAManager::GetInstance().HasDInputSourceProxy()); });
|
||||
[this]() { return (DInputSAManager::GetInstance().HasDInputSourceProxy()); });
|
||||
if (!waitStatus) {
|
||||
DHLOGE("dinput load sa timeout.");
|
||||
return ERR_DH_INPUT_SINK_HANDLER_INIT_SOURCE_SA_FAIL;
|
||||
@@ -66,7 +66,7 @@ void DistributedInputSourceHandler::FinishStartSA(const std::string ¶ms, con
|
||||
{
|
||||
DHLOGD("FinishStartSA");
|
||||
std::unique_lock<std::mutex> lock(proxyMutex_);
|
||||
DinputSAManager::GetInstance().SetDInputSourceProxy(remoteObject);
|
||||
DInputSAManager::GetInstance().SetDInputSourceProxy(remoteObject);
|
||||
DistributedInputClient::GetInstance().InitSource();
|
||||
proxyConVar_.notify_all();
|
||||
}
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos.gni")
|
||||
import(
|
||||
"//foundation/distributedhardware/distributed_input/distributedinput.gni")
|
||||
import("//foundation/distributedhardware/distributed_input/distributedinput.gni")
|
||||
|
||||
ohos_shared_library("libdinput_utils") {
|
||||
include_dirs = [
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace {
|
||||
|
||||
DevInfo GetLocalDeviceInfo()
|
||||
{
|
||||
DevInfo devInfo { "", "", 0 };
|
||||
DevInfo devInfo{"", "", 0};
|
||||
auto info = std::make_unique<NodeBasicInfo>();
|
||||
auto ret = GetLocalNodeDeviceInfo(DINPUT_PKG_NAME.c_str(), info.get());
|
||||
if (ret != 0) {
|
||||
|
||||
Reference in New Issue
Block a user