!42154 [UEC]fix uec拉起优化

Merge pull request !42154 from dujingcheng/uec0902
This commit is contained in:
openharmony_ci 2024-09-02 06:14:14 +00:00 committed by Gitee
commit 9886f240d2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 35 additions and 6 deletions

View File

@ -41,6 +41,7 @@
#include "core/components_ng/pattern/ui_extension/ui_extension_layout_algorithm.h"
#include "core/components_ng/pattern/ui_extension/ui_extension_surface_pattern.h"
#include "core/components_ng/pattern/ui_extension/ui_extension_proxy.h"
#include "core/components_ng/pattern/window_scene/helper/window_scene_helper.h"
#include "core/components_ng/pattern/window_scene/scene/window_pattern.h"
#include "core/components_ng/render/adapter/rosen_render_context.h"
#include "core/components_ng/render/adapter/rosen_window.h"
@ -376,6 +377,7 @@ void UIExtensionPattern::OnConnect()
uiExtensionManager->RegisterUIExtensionInFocus(WeakClaim(this), sessionWrapper_);
}
InitializeAccessibility();
ReDispatchDisplayArea();
}
void UIExtensionPattern::OnAccessibilityEvent(
@ -405,9 +407,24 @@ void UIExtensionPattern::OnDisconnect(bool isAbnormal)
void UIExtensionPattern::OnSyncGeometryNode(const DirtySwapConfig& config)
{
if (needReNotifyForeground_) {
needReNotifyForeground_ = false;
UIEXT_LOGI("NotifyForeground onSyncGeometryNode first.");
NotifyForeground();
needReDispatchDisplayArea_ = true;
}
DispatchDisplayArea(true);
}
void UIExtensionPattern::ReDispatchDisplayArea()
{
if (needReDispatchDisplayArea_) {
UIEXT_LOGI("ReDispatchDisplayArea.");
DispatchDisplayArea(true);
needReDispatchDisplayArea_ = false;
}
}
void UIExtensionPattern::OnWindowShow()
{
UIEXT_LOGI("The window is being shown and the component is %{public}s.", isVisible_ ? "visible" : "invisible");
@ -1103,9 +1120,14 @@ void UIExtensionPattern::OnMountToParentDone()
UIEXT_LOGI("OnMountToParentDone.");
hasMountToParent_ = true;
if (needReNotifyForeground_) {
needReNotifyForeground_ = false;
UIEXT_LOGI("NotifyForeground OnMountToParentDone.");
NotifyForeground();
auto hostWindowNode = WindowSceneHelper::FindWindowScene(GetHost());
if (hostWindowNode) {
needReNotifyForeground_ = false;
UIEXT_LOGI("NotifyForeground OnMountToParentDone.");
NotifyForeground();
} else {
UIEXT_LOGI("No WindowScene When OnMountToParentDone, wait.");
}
}
auto frameNode = frameNode_.Upgrade();
CHECK_NULL_VOID(frameNode);
@ -1124,9 +1146,14 @@ void UIExtensionPattern::AfterMountToParent()
UIEXT_LOGI("AfterMountToParent.");
hasMountToParent_ = true;
if (needReNotifyForeground_) {
needReNotifyForeground_ = false;
UIEXT_LOGI("NotifyForeground AfterMountToParent.");
NotifyForeground();
auto hostWindowNode = WindowSceneHelper::FindWindowScene(GetHost());
if (hostWindowNode) {
needReNotifyForeground_ = false;
UIEXT_LOGI("NotifyForeground AfterMountToParent.");
NotifyForeground();
} else {
UIEXT_LOGI("No WindowScene When AfterMountToParent, wait.");
}
}
}

View File

@ -239,6 +239,7 @@ private:
void MountPlaceholderNode();
void RemovePlaceholderNode();
UIExtensionUsage GetUIExtensionUsage(const AAFwk::Want& want);
void ReDispatchDisplayArea();
RefPtr<TouchEventImpl> touchEvent_;
RefPtr<InputEvent> mouseEvent_;
@ -284,6 +285,7 @@ private:
// StartUIExtension should after mountToParent
bool hasMountToParent_ = false;
bool needReNotifyForeground_ = false;
bool needReDispatchDisplayArea_ = false;
SessionType sessionType_ = SessionType::UI_EXTENSION_ABILITY;
UIExtensionUsage usage_ = UIExtensionUsage::EMBEDDED;