adapt to master

Signed-off-by: qpzeng <zengqingpeng6@huawei.com>
Change-Id: Ia7db1af893299ef97bfa622e1863fb7987116cba
This commit is contained in:
qpzeng 2023-02-28 10:03:22 +08:00
parent 3a63a25d6d
commit ce61f02bf9
21 changed files with 60 additions and 120 deletions

View File

@ -81,6 +81,8 @@ jsoncpp_root = "//third_party/jsoncpp"
ark_tools_root = "//prebuilts/ace-toolkit/ace-loader/panda"
node_js_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/"
ark_toolchain_path = "//arkcompiler/toolchain"
window_manager_path = "//foundation/window/window_manager"
graphic_standard_path = "//foundation/graphic/graphic_2d"
# Config toolchain
windows_buildtool = "//build/toolchain/mingw:mingw_x86_64"

View File

@ -58,9 +58,9 @@
#include "core/components/theme/theme_constants.h"
#include "core/components/theme/theme_manager_impl.h"
#include "core/components_ng/pattern/text_field/text_field_manager.h"
#include "core/components_ng/pattern/window_scene/scene/container/window_pattern.h"
#include "core/components_ng/render/adapter/form_render_window.h"
#include "core/components_ng/render/adapter/rosen_window.h"
#include "core/components_ng/pattern/window_scene/scene/container/window_pattern.h"
#include "core/pipeline/pipeline_context.h"
#include "core/pipeline_ng/pipeline_context.h"

View File

@ -325,7 +325,7 @@ void UIContentImpl::Restore(OHOS::Rosen::Window* window, const std::string& cont
LOGI("Restore UIContentImpl done.");
}
void UIContentImpl::Initialize(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage)
void UIContentImpl::Initialize(NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage)
{
windowPattern_ = windowPattern;
if (windowPattern_ && StringUtils::StartWith(windowPattern_->GetWindowName(), SUBWINDOW_TOAST_DIALOG_PREFIX)) {
@ -341,20 +341,6 @@ void UIContentImpl::Initialize(OHOS::Ace::NG::WindowPattern* windowPattern, cons
LOGI("Initialize UIContentImpl done");
}
void UIContentImpl::Restore(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage)
{
windowPattern_ = windowPattern;
CommonInitialize(nullptr, url, storage);
startUrl_ = Platform::AceContainer::RestoreRouterStack(instanceId_, url);
if (startUrl_.empty()) {
LOGW("UIContent Restore start url is empty");
}
LOGI("Restore startUrl = %{public}s", startUrl_.c_str());
Platform::AceContainer::RunPage(
instanceId_, Platform::AceContainer::GetContainer(instanceId_)->GeneratePageId(), startUrl_, "");
LOGI("Restore UIContentImpl done");
}
std::string UIContentImpl::GetContentInfo() const
{
LOGI("UIContent GetContentInfo");
@ -840,14 +826,16 @@ void UIContentImpl::CommonInitialize(OHOS::Rosen::Window* window, const std::str
ACE_FUNCTION_TRACE();
window_ = window;
startUrl_ = contentInfo;
CHECK_NULL_VOID(window_);
if (StringUtils::StartWith(window->GetWindowName(), SUBWINDOW_TOAST_DIALOG_PREFIX)) {
InitializeSubWindow(window_, true);
return;
}
if (StringUtils::StartWith(window->GetWindowName(), SUBWINDOW_PREFIX)) {
InitializeSubWindow(window_);
return;
if (!windowPattern_) {
CHECK_NULL_VOID(window_);
if (StringUtils::StartWith(window->GetWindowName(), SUBWINDOW_TOAST_DIALOG_PREFIX)) {
InitializeSubWindow(window_, true);
return;
}
if (StringUtils::StartWith(window->GetWindowName(), SUBWINDOW_PREFIX)) {
InitializeSubWindow(window_);
return;
}
}
auto context = context_.lock();
CHECK_NULL_VOID(context);
@ -1181,23 +1169,11 @@ void UIContentImpl::CommonInitialize(OHOS::Rosen::Window* window, const std::str
LOGI("Container modal is enabled.");
container->SetWindowModal(WindowModal::CONTAINER_MODAL);
}
if (windowPattern_->IsFocused()) {
LOGI("UIContentImpl: focus again");
Focus();
}
// dragWindowListener_ = new DragWindowListener(instanceId_);
// windowPattern_->RegisterDragListener(dragWindowListener_);
// occupiedAreaChangeListener_ = new OccupiedAreaChangeListener(instanceId_);
// windowPattern_->RegisterOccupiedAreaChangeListener(occupiedAreaChangeListener_);
} else {
if (window_->IsDecorEnable()) {
LOGI("Container modal is enabled.");
container->SetWindowModal(WindowModal::CONTAINER_MODAL);
}
if (window_->IsFocused()) {
LOGI("UIContentImpl: focus again");
Focus();
}
dragWindowListener_ = new DragWindowListener(instanceId_);
window_->RegisterDragListener(dragWindowListener_);
occupiedAreaChangeListener_ = new OccupiedAreaChangeListener(instanceId_);
@ -1234,16 +1210,23 @@ void UIContentImpl::CommonInitialize(OHOS::Rosen::Window* window, const std::str
Platform::AceContainer::SetView(aceView, density, 0, 0, window_, callback);
} else {
if (windowPattern_) {
Platform::AceContainer::SetViewNew(aceView, density, 0, 0, AceType::Claim(windowPattern_));
Platform::AceContainer::SetView(aceView, density, 0, 0, AceType::Claim(windowPattern_));
} else {
Platform::AceContainer::SetViewNew(aceView, density, 0, 0, window_);
}
}
// after frontend initialize
if (window_->IsFocused()) {
LOGI("UIContentImpl: focus again");
Focus();
if (windowPattern_) {
if (windowPattern_->IsFocused()) {
LOGI("UIContentImpl: focus again");
Focus();
}
} else {
// after frontend initialize
if (window_->IsFocused()) {
LOGI("UIContentImpl: focus again");
Focus();
}
}
Platform::AceViewOhos::SurfaceChanged(aceView, 0, 0, deviceHeight >= deviceWidth ? 0 : 1);
@ -1553,44 +1536,6 @@ void UIContentImpl::InitializeSubWindow(OHOS::Rosen::Window* window, bool isDial
window_->RegisterDragListener(dragWindowListener_);
}
void UIContentImpl::InitializeSubWindow(bool isDialog)
{
if (!windowPattern_) {
LOGE("Null window, can't initialize UI content");
return;
}
LOGI("The window name is %{public}s", windowPattern_->GetWindowName().c_str());
RefPtr<Container> container;
instanceId_ = gSubInstanceId.fetch_add(1, std::memory_order_relaxed);
std::weak_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo;
std::weak_ptr<OHOS::AbilityRuntime::Context> runtimeContext;
if (isDialog) {
container = AceType::MakeRefPtr<Platform::DialogContainer>(instanceId_, FrontendType::DECLARATIVE_JS);
} else {
if (Container::IsCurrentUseNewPipeline()) {
container = AceType::MakeRefPtr<Platform::AceContainer>(instanceId_, FrontendType::DECLARATIVE_JS,
runtimeContext, abilityInfo, std::make_unique<ContentEventCallback>([] {
// Sub-window, just return.
LOGI("Content event callback");
}),
false, true, true);
} else {
container = AceType::MakeRefPtr<Platform::AceContainer>(instanceId_, FrontendType::DECLARATIVE_JS,
runtimeContext, abilityInfo, std::make_unique<ContentEventCallback>([] {
// Sub-window, just return.
LOGI("Content event callback");
}),
false, true);
}
}
SubwindowManager::GetInstance()->AddContainerId(windowPattern_->GetWindowId(), instanceId_);
AceEngine::Get().AddContainer(instanceId_, container);
// touchOutsideListener_ = new TouchOutsideListener(instanceId_);
// windowPattern_->RegisterTouchOutsideListener(touchOutsideListener_);
}
void UIContentImpl::SetNextFrameLayoutCallback(std::function<void()>&& callback)
{
CHECK_NULL_VOID(callback);

View File

@ -49,7 +49,7 @@ public:
// UI content lifecycles
void Initialize(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage) override;
void Initialize(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage) override;
void Initialize(NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage) override;
void Foreground() override;
void Background() override;
void Focus() override;
@ -59,7 +59,6 @@ public:
// distribute
void Restore(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage) override;
void Restore(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& contentInfo, NativeValue* storage) override;
std::string GetContentInfo() const override;
void DestroyUIDirector() override;
@ -71,7 +70,7 @@ public:
bool ProcessVsyncEvent(uint64_t timeStampNanos) override;
void UpdateConfiguration(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config) override;
void UpdateViewportConfig(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason,
const std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction) override;
const std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction = nullptr) override;
void UpdateWindowMode(OHOS::Rosen::WindowMode mode, bool hasDeco = true) override;
void HideWindowTitleButton(bool hideSplit, bool hideMaximize, bool hideMinimize) override;
@ -123,7 +122,6 @@ private:
void CommonInitialize(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage);
void CommonInitializeForm(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage);
void InitializeSubWindow(OHOS::Rosen::Window* window, bool isDialog = false);
void InitializeSubWindow(bool isDialog = false);
void DestroyCallback() const;
std::weak_ptr<OHOS::AbilityRuntime::Context> context_;
void* runtime_ = nullptr;

View File

@ -472,13 +472,8 @@ template("declarative_js_engine") {
}
if (defined(config.window_scene_support) && config.window_scene_support) {
external_deps += [
"window_manager:scene_session",
"window_manager:screen_session",
]
deps += [
"//foundation/window/window_manager/window_scene/interfaces/kits/napi/scene_session_manager:scenesessionmanager_napi",
"//foundation/window/window_manager/window_scene/interfaces/kits/napi/screen_session_manager:screensessionmanager_napi",
"$window_manager_path/window_scene/session:scene_session",
]
}
}

View File

@ -510,12 +510,10 @@ template("ace_core_source_set") {
deps += [ "//third_party/libuv:uv" ]
}
if (defined(config.window_scene_support) && config.window_scene_support) {
deps += [
"$ace_root/frameworks/core/components_ng/pattern/window_scene:ace_core_components_window_scene_$platform",
"//foundation/arkui/ace_engine/interfaces/inner_api/ace:ace_uicontent",
]
}
deps += [
"$ace_root/frameworks/core/components_ng/pattern/window_scene:ace_core_components_window_scene_$platform",
"$ace_root/interfaces/inner_api/ace:ace_uicontent",
]
cflags_cc = []
cflags_cc += invoker.cflags_cc

View File

@ -1,4 +1,4 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -16,8 +16,8 @@ import("//foundation/arkui/ace_engine/frameworks/core/components_ng/components.g
if (is_standard_system) {
config("ohos_window_scene_config") {
include_dirs = [
"//foundation/window/window_manager/interfaces/innerkits",
"//foundation/window/window_manager/wm",
"$window_manager_path/interfaces/innerkits",
"$window_manager_path/wm",
]
}
}
@ -48,10 +48,10 @@ build_component_ng("window_scene") {
configs = [ ":ohos_window_scene_config" ]
deps = [
"//foundation/arkui/ace_engine/interfaces/inner_api/ace:ace_uicontent",
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
"//foundation/window/window_manager/wm:libwm",
"//foundation/window/window_manager/dm:libdm",
"$ace_root/interfaces/inner_api/ace:ace_uicontent",
"$graphic_standard_path/rosen/modules/render_service_client:librender_service_client",
"$window_manager_path/wm:libwm",
"$window_manager_path/dm:libdm",
"$ability_runtime_path/frameworks/native/ability/native:abilitykit_native",
]

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -77,7 +77,7 @@ template("ace_core_pipeline_source_set") {
if (defined(config.window_scene_support) && config.window_scene_support) {
deps += [
"//foundation/arkui/ace_engine/interfaces/inner_api/ace:ace_uicontent",
"$ace_root/interfaces/inner_api/ace:ace_uicontent",
]
}

View File

@ -54,7 +54,7 @@ template("ace_core_pipeline_ng_source_set") {
if (defined(config.window_scene_support) && config.window_scene_support) {
deps += [
"//foundation/arkui/ace_engine/interfaces/inner_api/ace:ace_uicontent",
"$ace_root/interfaces/inner_api/ace:ace_uicontent",
]
}
}

View File

@ -1271,14 +1271,16 @@ void PipelineContext::SetContainerWindow(bool isShow)
if (windowPattern_) {
auto rsUIDirector = windowPattern_->GetRSUIDirector();
if (rsUIDirector) {
rsUIDirector->SetContainerWindow(isShow); // set container window show state to render service
// set container window show state to render service
rsUIDirector->SetContainerWindow(isShow, density_);
}
} else {
auto rsWindow = static_cast<RosenWindow*>(GetWindow());
if (rsWindow) {
auto rsUIDirector = rsWindow->GetRsUIDirector();
if (rsUIDirector) {
rsUIDirector->SetContainerWindow(isShow, density_); // set container window show state to render service
// set container window show state to render service
rsUIDirector->SetContainerWindow(isShow, density_);
}
}
}

View File

@ -80,7 +80,7 @@ public:
// UI content life-cycles
virtual void Initialize(OHOS::Rosen::Window* window, const std::string& url, NativeValue* storage) = 0;
virtual void Initialize(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage) = 0;
virtual void Initialize(NG::WindowPattern* windowPattern, const std::string& url, NativeValue* storage) = 0;
virtual void Foreground() = 0;
virtual void Background() = 0;
virtual void Focus() = 0;
@ -90,7 +90,6 @@ public:
// distribute
virtual void Restore(OHOS::Rosen::Window* window, const std::string& contentInfo, NativeValue* storage) = 0;
virtual void Restore(OHOS::Ace::NG::WindowPattern* windowPattern, const std::string& contentInfo, NativeValue* storage) = 0;
virtual std::string GetContentInfo() const = 0;
virtual void DestroyUIDirector() = 0;
@ -102,7 +101,7 @@ public:
virtual bool ProcessVsyncEvent(uint64_t timeStampNanos) = 0;
virtual void UpdateConfiguration(const std::shared_ptr<OHOS::AppExecFwk::Configuration>& config) = 0;
virtual void UpdateViewportConfig(const ViewportConfig& config, OHOS::Rosen::WindowSizeChangeReason reason,
const std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction) = 0;
const std::shared_ptr<OHOS::Rosen::RSTransaction> rsTransaction = nullptr) = 0;
virtual void UpdateWindowMode(OHOS::Rosen::WindowMode mode, bool hasDeco = true) = 0;
virtual void HideWindowTitleButton(bool hideSplit, bool hideMaximize, bool hideMinimize) = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -44,7 +44,8 @@ public:
AbilityRuntime::Context* context = nullptr) = 0;
// for lifecycle
virtual void RegisterSessionStageStateListener(const std::shared_ptr<Rosen::ISessionStageStateListener>& listener) = 0;
virtual void RegisterSessionStageStateListener(
const std::shared_ptr<Rosen::ISessionStageStateListener>& listener) = 0;
virtual void Connect() = 0;
virtual void Foreground() = 0;