mirror of
https://gitee.com/openharmony/msdp_device_status
synced 2024-11-23 07:29:52 +00:00
20231213Modify
Signed-off-by: yangjintao <yangjintao16@huawei.com> Change-Id: I1ba1a8d40b2a7ad4b49dae6ef4879e98bbd5520a
This commit is contained in:
parent
1fa3a67bcf
commit
2f2c251f7b
@ -82,7 +82,7 @@ bool DeviceStatusEvent::SaveCallbackByEvent(int32_t eventType, napi_value handle
|
||||
}
|
||||
auto iter = events_.find(eventType);
|
||||
if (iter == events_.end()) {
|
||||
FI_HILOGE("EventType:%{public}d not exists", eventType);
|
||||
FI_HILOGE("eventType:%{public}d not exists", eventType);
|
||||
events_[eventType] = std::list<std::shared_ptr<DeviceStatusEventListener>>();
|
||||
}
|
||||
if (events_[eventType].empty()) {
|
||||
|
@ -121,6 +121,7 @@ public:
|
||||
static void SimulateDownKeyEvent(int32_t key);
|
||||
static void SimulateUpKeyEvent(int32_t key);
|
||||
static void PrintDragAction(DragAction dragAction);
|
||||
static void AssignToAnimationIn(PreviewAnimation &animationIn);
|
||||
};
|
||||
|
||||
void InteractionManagerTest::SetPermission(const std::string &level, const char** perms, size_t permAmount)
|
||||
@ -555,6 +556,13 @@ void InteractionManagerTest::PrintDragAction(DragAction dragAction)
|
||||
}
|
||||
}
|
||||
|
||||
void InteractionManagerTest::AssignToAnimationIn(PreviewAnimation &animationIn)
|
||||
{
|
||||
animationIn.duration = 500;
|
||||
animationIn.curveName = CURVE_NAME;
|
||||
animationIn.curve = { 0.33, 0, 0.67, 1 };
|
||||
}
|
||||
|
||||
class InputEventCallbackTest : public MMI::IInputEventConsumer {
|
||||
public:
|
||||
InputEventCallbackTest() {}
|
||||
@ -1911,9 +1919,7 @@ HWTEST_F(InteractionManagerTest, InteractionManagerTest_UpdatePreviewStyleWithAn
|
||||
previewStyleIn.foregroundColor = FOREGROUND_COLOR_IN;
|
||||
previewStyleIn.radius = RADIUS_IN;
|
||||
PreviewAnimation animationIn;
|
||||
animationIn.duration = 500;
|
||||
animationIn.curveName = CURVE_NAME;
|
||||
animationIn.curve = { 0.33, 0, 0.67, 1 };
|
||||
AssignToAnimationIn(animationIn);
|
||||
ret = InteractionManager::GetInstance()->UpdatePreviewStyleWithAnimation(previewStyleIn, animationIn);
|
||||
EXPECT_EQ(ret, RET_OK);
|
||||
SimulateMovePointerEvent({ enterPos.first, enterPos.second }, { leavePos.first, leavePos.second },
|
||||
@ -1923,9 +1929,7 @@ HWTEST_F(InteractionManagerTest, InteractionManagerTest_UpdatePreviewStyleWithAn
|
||||
previewStyleOut.foregroundColor = FOREGROUND_COLOR_OUT;
|
||||
previewStyleOut.radius = RADIUS_OUT;
|
||||
PreviewAnimation animationOut;
|
||||
animationOut.duration = 500;
|
||||
animationOut.curveName = CURVE_NAME;
|
||||
animationOut.curve = { 0.33, 0, 0.67, 1 };
|
||||
AssignToAnimationIn(animationIn);
|
||||
ret = InteractionManager::GetInstance()->UpdatePreviewStyleWithAnimation(previewStyleOut, animationOut);
|
||||
EXPECT_EQ(ret, RET_OK);
|
||||
SimulateMovePointerEvent({ leavePos.first, leavePos.second }, { DRAG_DST_X, DRAG_DST_Y },
|
||||
|
@ -491,13 +491,13 @@ int32_t CooperateSoftbusAdapter::StartCooperateOtherResult(const std::string &or
|
||||
void CooperateSoftbusAdapter::HandleSessionData(int32_t sessionId, const std::string &message)
|
||||
{
|
||||
if (message.empty()) {
|
||||
FI_HILOGE("Message is empty");
|
||||
FI_HILOGE("message is empty");
|
||||
return;
|
||||
}
|
||||
JsonParser parser;
|
||||
parser.json = cJSON_Parse(message.c_str());
|
||||
if (!cJSON_IsObject(parser.json)) {
|
||||
FI_HILOGI("Parser json is not object");
|
||||
FI_HILOGI("parser json is not object");
|
||||
if (message.size() < sizeof(DataPacket)) {
|
||||
FI_HILOGE("Data packet is incomplete");
|
||||
return;
|
||||
@ -508,10 +508,10 @@ void CooperateSoftbusAdapter::HandleSessionData(int32_t sessionId, const std::st
|
||||
return;
|
||||
}
|
||||
if (registerRecvs_.find(dataPacket->messageId) == registerRecvs_.end()) {
|
||||
FI_HILOGW("Message:%{public}d does not register", dataPacket->messageId);
|
||||
FI_HILOGW("message:%{public}d does not register", dataPacket->messageId);
|
||||
return;
|
||||
}
|
||||
FI_HILOGI("Message:%{public}d", dataPacket->messageId);
|
||||
FI_HILOGI("message:%{public}d", dataPacket->messageId);
|
||||
if ((dataPacket->messageId == DRAGGING_DATA) ||
|
||||
(dataPacket->messageId == STOPDRAG_DATA) ||
|
||||
(dataPacket->messageId == IS_PULL_UP) ||
|
||||
|
@ -31,7 +31,7 @@ int32_t CooperateStateFree::ActivateCooperate(
|
||||
{
|
||||
CALL_INFO_TRACE;
|
||||
if (remoteNetworkId.empty()) {
|
||||
FI_HILOGE("RemoteNetworkId is empty");
|
||||
FI_HILOGE("remoteNetworkId is empty");
|
||||
return static_cast<int32_t>(CoordinationMessage::PARAMETER_ERROR);
|
||||
}
|
||||
std::string localNetworkId = COOPERATE::GetLocalNetworkId();
|
||||
|
@ -36,7 +36,7 @@ int32_t CooperateStateIn::ActivateCooperate(const std::string &remoteNetworkId,
|
||||
{
|
||||
CALL_INFO_TRACE;
|
||||
if (remoteNetworkId.empty()) {
|
||||
FI_HILOGE("RemoteNetworkId is empty");
|
||||
FI_HILOGE("remoteNetworkId is empty");
|
||||
return static_cast<int32_t>(CoordinationMessage::PARAMETER_ERROR);
|
||||
}
|
||||
std::string localNetworkId = COOPERATE::GetLocalNetworkId();
|
||||
|
@ -104,12 +104,12 @@ bool DeviceProfileAdapter::GetCrossingSwitchState(const std::string &networkId)
|
||||
JsonParser parser;
|
||||
parser.json = cJSON_Parse(jsonData.c_str());
|
||||
if (!cJSON_IsObject(parser.json)) {
|
||||
FI_HILOGE("Parser json is not object");
|
||||
FI_HILOGE("parser json is not object");
|
||||
return false;
|
||||
}
|
||||
cJSON* state = cJSON_GetObjectItemCaseSensitive(parser.json, characteristicsName_.c_str());
|
||||
if (!cJSON_IsNumber(state)) {
|
||||
FI_HILOGE("State is not number type");
|
||||
FI_HILOGE("state is not number type");
|
||||
return false;
|
||||
}
|
||||
return (static_cast<bool>(state->valueint));
|
||||
|
@ -34,7 +34,7 @@ void CooperateOut::OnEvent(Context &context, CooperateEvent &event)
|
||||
if (current_ != nullptr) {
|
||||
current_->OnEvent(context, event);
|
||||
} else {
|
||||
FI_HILOGE("Current step is null");
|
||||
FI_HILOGE("current_ step is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ void Monitor::Disable()
|
||||
}
|
||||
if (inotifyFd_ >= 0) {
|
||||
if (close(inotifyFd_) < 0) {
|
||||
FI_HILOGE("Close inotify fd failed, error:%{public}s, inotifyFd_:%{public}d", strerror(errno), inotifyFd_);
|
||||
FI_HILOGE("close inotify fd failed, error:%{public}s, inotifyFd_:%{public}d", strerror(errno), inotifyFd_);
|
||||
}
|
||||
inotifyFd_ = -1;
|
||||
}
|
||||
|
@ -44,20 +44,20 @@ int32_t DeviceStatusDataParse::CreateJsonFile()
|
||||
{
|
||||
int32_t fd = open(MSDP_DATA_PATH.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||
if (fd < 0) {
|
||||
FI_HILOGE("Open failed");
|
||||
FI_HILOGE("open failed");
|
||||
return DEVICESTATUS_FAILED;
|
||||
}
|
||||
if (close(fd) < 0) {
|
||||
FI_HILOGE("Close fd failed, error:%{public}s, fd:%{public}d", strerror(errno), fd);
|
||||
FI_HILOGE("close fd failed, error:%{public}s, fd:%{public}d", strerror(errno), fd);
|
||||
}
|
||||
|
||||
struct stat buf;
|
||||
if (stat(MSDP_DATA_DIR.c_str(), &buf) != 0) {
|
||||
FI_HILOGE("Start folder path is invalid %{public}d", errno);
|
||||
FI_HILOGE("start folder path is invalid %{public}d", errno);
|
||||
return DEVICESTATUS_FAILED;
|
||||
}
|
||||
if (chown(MSDP_DATA_PATH.c_str(), buf.st_uid, buf.st_gid) != 0) {
|
||||
FI_HILOGE("Chown failed, errno:%{public}d", errno);
|
||||
FI_HILOGE("chown failed, errno:%{public}d", errno);
|
||||
return DEVICESTATUS_FAILED;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ bool FusionDeviceProfileAdapter::GetCrossSwitchState(const std::string &deviceId
|
||||
JsonParser parser;
|
||||
parser.json = cJSON_Parse(jsonData.c_str());
|
||||
if (!cJSON_IsObject(parser.json)) {
|
||||
FI_HILOGE("Parser json is not object");
|
||||
FI_HILOGE("parser json is not object");
|
||||
return false;
|
||||
}
|
||||
cJSON* state = cJSON_GetObjectItemCaseSensitive(parser.json, characteristicsName_.c_str());
|
||||
|
@ -186,9 +186,9 @@ int32_t CoordinationSoftbusAdapter::Init()
|
||||
};
|
||||
int32_t ret = InitSocket(info, SOCKET_SERVER, socketFd_);
|
||||
if (ret == RET_OK && socketFd_ != -1) {
|
||||
FI_HILOGI("server set ok");
|
||||
FI_HILOGI("Server set ok");
|
||||
} else {
|
||||
FI_HILOGE("server set failed, ret:%{public}d", ret);
|
||||
FI_HILOGE("Server set failed, ret:%{public}d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -271,7 +271,7 @@ int32_t CoordinationSoftbusAdapter::OpenInputSoftbus(const std::string &remoteNe
|
||||
sessionDevs_[remoteNetworkId] = socket;
|
||||
ConfigTcpAlive(socket);
|
||||
} else {
|
||||
FI_HILOGE("bind failed, ret:%{public}d", ret);
|
||||
FI_HILOGE("Bind failed, ret:%{public}d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ int32_t CoordinationStateIn::ActivateCoordination(const std::string &remoteNetwo
|
||||
{
|
||||
CALL_INFO_TRACE;
|
||||
if (remoteNetworkId.empty()) {
|
||||
FI_HILOGE("RemoteNetworkId is empty");
|
||||
FI_HILOGE("remoteNetworkId is empty");
|
||||
return static_cast<int32_t>(CoordinationMessage::PARAMETER_ERROR);
|
||||
}
|
||||
std::string localNetworkId = COORDINATION::GetLocalNetworkId();
|
||||
|
@ -393,7 +393,7 @@ void DragManager::OnDragUp(std::shared_ptr<MMI::PointerEvent> pointerEvent)
|
||||
MMI::InputManager::GetInstance()->SetPointerVisible(true);
|
||||
}
|
||||
int32_t targetTid = DRAG_DATA_MGR.GetTargetTid();
|
||||
FI_HILOGD("SourceType:%{public}d, pointerId:%{public}d,Target window drag tid:%{public}d",
|
||||
FI_HILOGD("sourceType:%{public}d, pointerId:%{public}d,Target window drag tid:%{public}d",
|
||||
targetTid, pointerEvent->GetSourceType(), pointerEvent->GetPointerId());
|
||||
SendDragData(targetTid, dragData.udKey);
|
||||
CHKPV(context_);
|
||||
|
@ -141,7 +141,7 @@ int32_t DeviceStatusManager::NotifyDeviceStatusChange(const Data &devicestatusDa
|
||||
listeners = (std::set<const sptr<IRemoteDevStaCallback>, classcomp>)(iter->second);
|
||||
for (const auto &listener : listeners) {
|
||||
if (listener == nullptr) {
|
||||
FI_HILOGE("Listener is nullptr");
|
||||
FI_HILOGE("listener is nullptr");
|
||||
return false;
|
||||
}
|
||||
FI_HILOGI("type:%{public}d, arrs_:%{public}d", devicestatusData.type, arrs_[devicestatusData.type]);
|
||||
|
@ -73,7 +73,7 @@ std::shared_ptr<Media::PixelMap> DragDataManagerTest::CreatePixelMap(int32_t wid
|
||||
int32_t colorLen = width * height;
|
||||
uint32_t *colorPixels = new (std::nothrow) uint32_t[colorLen];
|
||||
if (colorPixels == nullptr) {
|
||||
FI_HILOGE("ColorPixels is nullptr");
|
||||
FI_HILOGE("colorPixels is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
int32_t colorByteCount = colorLen * INT32_BYTE;
|
||||
|
@ -50,14 +50,14 @@ std::shared_ptr<Media::PixelMap> CreatePixelMap(int32_t width, int32_t height)
|
||||
int32_t colorLen = width * height;
|
||||
uint32_t* colorPixels = new (std::nothrow) uint32_t[colorLen];
|
||||
if (colorPixels == nullptr) {
|
||||
FI_HILOGE("ColorPixels is nullptr");
|
||||
FI_HILOGE("colorPixels is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
int32_t colorByteCount = colorLen * INT32_BYTE;
|
||||
auto ret = memset_s(colorPixels, colorByteCount, DEFAULT_ICON_COLOR, colorByteCount);
|
||||
if (ret != EOK) {
|
||||
delete[] colorPixels;
|
||||
FI_HILOGE("Memset_s failed");
|
||||
FI_HILOGE("memset_s failed");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<Media::PixelMap> pixelMap = Media::PixelMap::Create(colorPixels, colorLen, opts);
|
||||
|
@ -50,13 +50,13 @@ std::shared_ptr<Media::PixelMap> CreatePixelMap(int32_t width, int32_t height)
|
||||
int32_t colorLen = width * height;
|
||||
uint32_t* colors = new (std::nothrow) uint32_t[colorLen];
|
||||
if (colors == nullptr) {
|
||||
FI_HILOGE("ColorPixels is nullptr");
|
||||
FI_HILOGE("colorPixels is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
int32_t colorByteCount = colorLen * INT32_BYTE;
|
||||
auto ret = memset_s(colors, colorByteCount, DEFAULT_ICON_COLOR, colorByteCount);
|
||||
if (ret != EOK) {
|
||||
FI_HILOGE("Memset_s failed");
|
||||
FI_HILOGE("memset_s failed");
|
||||
delete[] colors;
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user