alarm fix

Signed-off-by: lwx1285820 <lishaoxiong10@huawei.com>
This commit is contained in:
lwx1285820 2024-07-16 03:53:48 +00:00
parent 8e2498559b
commit aeeb5745f9
5 changed files with 12 additions and 9 deletions

View File

@ -1310,6 +1310,7 @@ HWTEST_F(InteractionManagerTest, InteractionManagerTest_StartDrag_Mouse, TestSiz
std::make_shared<UnitTestStartDragListener>(callback));
ASSERT_EQ(ret, RET_OK);
ret = InteractionManager::GetInstance()->SetDragWindowVisible(true);
InteractionManager::GetInstance()->SetDragWindowScreenId(TOUCH_POINTER_ID, TOUCH_POINTER_ID);
EXPECT_EQ(ret, RET_OK);
SimulateMovePointerEvent({ DRAG_SRC_X, DRAG_SRC_Y }, { DRAG_DST_X, DRAG_DST_Y },
MMI::PointerEvent::SOURCE_TYPE_MOUSE, MOUSE_POINTER_ID, true);

View File

@ -60,11 +60,11 @@ void CooperateFree::OnLeaveState(Context &context)
void CooperateFree::SetPointerVisible(Context &context)
{
CHKPV(env_);
bool hasLocalPointerDevice = env_->GetDeviceManager().HasLocalPointerDevice();
bool visible = !context.NeedHideCursor() && hasLocalPointerDevice;
FI_HILOGI("Set pointer visible:%{public}s, HasLocalPointerDevice:%{public}s",
visible ? "true" : "false", hasLocalPointerDevice ? "true" : "false");
CHKPV(env_);
env_->GetInput().SetPointerVisibility(visible, PRIORITY);
}

View File

@ -58,11 +58,11 @@ void CooperateOut::OnLeaveState(Context &context)
void CooperateOut::SetPointerVisible(Context &context)
{
CHKPV(env_);
bool hasLocalPointerDevice = env_->GetDeviceManager().HasLocalPointerDevice();
bool visible = !context.NeedHideCursor() && hasLocalPointerDevice;
FI_HILOGI("Set pointer visible:%{public}s, HasLocalPointerDevice:%{public}s",
visible ? "true" : "false", hasLocalPointerDevice ? "true" : "false");
CHKPV(env_);
env_->GetInput().SetPointerVisibility(visible, PRIORITY);
}

View File

@ -197,12 +197,16 @@ int32_t DragManager::StartDrag(const DragData &dragData, int32_t pid)
}
std::string packageName = std::string();
CHKPR(context_, RET_ERR);
dragOutSession_ = context_->GetSocketSessionManager().FindSessionByPid(pid);
if (dragOutSession_ != nullptr) {
if (pid == -1) {
packageName = "Cross-device drag";
} else {
context_->GetSocketSessionManager().AddSessionDeletedCallback(pid,
[this](SocketSessionPtr session) { this->OnSessionLost(session); });
dragOutSession_ = context_->GetSocketSessionManager().FindSessionByPid(pid);
if (dragOutSession_ != nullptr) {
packageName = dragOutSession_->GetProgramName();
}
}
packageName = (pid == -1) ? "Cross-device drag" : dragOutSession_->GetProgramName();
PrintDragData(dragData, packageName);
if (InitDataManager(dragData) != RET_OK) {
FI_HILOGE("Failed to init data manager");

View File

@ -66,9 +66,7 @@ void DragVSyncStation::StopVSyncRequest()
handler_->RemoveAllFileDescriptorListeners();
handler_ = nullptr;
}
if (receiver_ != nullptr) {
receiver_ = nullptr;
}
receiver_ = nullptr;
vSyncPeriod_ = 0;
if (mmiHandleTid_ > 0) {
OHOS::QOS::ResetQosForOtherThread(mmiHandleTid_);
@ -157,7 +155,7 @@ void DragVSyncStation::OnVSyncInner(uint64_t nanoTimestamp)
std::lock_guard<std::mutex> lock(mtx_);
vSyncCallbacks.swap(vSyncCallbacks_);
}
for (auto &callback : vSyncCallbacks) {
for (auto const &callback : vSyncCallbacks) {
if (callback.second != nullptr) {
(*callback.second)(nanoTimestamp);
}