mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 15:00:12 +00:00
!7489 修复photoPicker uiextension多发问题
Merge pull request !7489 from MoonPie/wentao
This commit is contained in:
commit
5522de5b90
@ -89,6 +89,7 @@ public:
|
||||
WMError HideNonSecureWindows(bool shouldHide) override;
|
||||
WMError SetWaterMarkFlag(bool isEnable) override;
|
||||
Rect GetHostWindowRect(int32_t hostWindowId) override;
|
||||
bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override;
|
||||
|
||||
protected:
|
||||
NotifyTransferComponentDataFunc notifyTransferComponentDataFunc_;
|
||||
|
@ -346,6 +346,10 @@ void WindowExtensionSessionImpl::NotifyFocusStateEvent(bool focusState)
|
||||
NotifyWindowAfterUnfocused();
|
||||
}
|
||||
focusState_ = focusState;
|
||||
if (focusState_ != std::nullopt) {
|
||||
TLOGI(WmsLogTag::WMS_FOCUS, "persistentId:%{public}d focusState:%{public}d",
|
||||
GetPersistentId(), static_cast<int32_t>(focusState_.value()));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowExtensionSessionImpl::NotifyFocusActiveEvent(bool isFocusActive)
|
||||
@ -969,5 +973,32 @@ void WindowExtensionSessionImpl::ConsumePointerEvent(const std::shared_ptr<MMI::
|
||||
}
|
||||
NotifyPointerEvent(pointerEvent);
|
||||
}
|
||||
|
||||
bool WindowExtensionSessionImpl::PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
|
||||
{
|
||||
if (keyEvent == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_EVENT, "keyEvent is nullptr");
|
||||
return false;
|
||||
}
|
||||
RefreshNoInteractionTimeoutMonitor();
|
||||
if (property_->GetUIExtensionUsage() == UIExtensionUsage::CONSTRAINED_EMBEDDED) {
|
||||
if (focusState_ == std::nullopt) {
|
||||
TLOGW(WmsLogTag::WMS_EVENT, "focusState is null");
|
||||
keyEvent->MarkProcessed();
|
||||
return true;
|
||||
}
|
||||
if (!focusState_.value()) {
|
||||
keyEvent->MarkProcessed();
|
||||
return true;
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_EVENT, "InputTracking:%{public}d wid:%{public}d",
|
||||
keyEvent->GetId(), keyEvent->GetAgentWindowId());
|
||||
}
|
||||
std::shared_ptr<Ace::UIContent> uiContent = GetUIContentSharedPtr();
|
||||
if (uiContent != nullptr) {
|
||||
return uiContent->ProcessKeyEvent(keyEvent, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -1384,6 +1384,33 @@ HWTEST_F(WindowExtensionSessionImplTest, ConsumePointerEvent, Function | SmallTe
|
||||
pointerEvent->UpdatePointerItem(0, item);
|
||||
window_->ConsumePointerEvent(pointerEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: PreNotifyKeyEvent
|
||||
* @tc.desc: PreNotifyKeyEvent Test
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(WindowExtensionSessionImplTest, PreNotifyKeyEvent, Function | SmallTest | Level3)
|
||||
{
|
||||
std::shared_ptr<MMI::KeyEvent> keyEvent = MMI::KeyEvent::Create();
|
||||
ASSERT_NE(nullptr, keyEvent);
|
||||
ASSERT_NE(nullptr, window_->property_);
|
||||
window_->property_->SetUIExtensionUsage(UIExtensionUsage::MODAL);
|
||||
bool ret = window_->PreNotifyKeyEvent(keyEvent);
|
||||
ASSERT_EQ(ret, false);
|
||||
|
||||
window_->property_->SetUIExtensionUsage(UIExtensionUsage::CONSTRAINED_EMBEDDED);
|
||||
ret = window_->PreNotifyKeyEvent(keyEvent);
|
||||
ASSERT_EQ(ret, true);
|
||||
|
||||
window_->focusState_ = false;
|
||||
ret = window_->PreNotifyKeyEvent(keyEvent);
|
||||
ASSERT_EQ(ret, true);
|
||||
|
||||
window_->focusState_ = true;
|
||||
ret = window_->PreNotifyKeyEvent(keyEvent);
|
||||
ASSERT_EQ(ret, false);
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user