From 0cbc19fb68950136e41a294b4402c9dc36e0fbd7 Mon Sep 17 00:00:00 2001 From: njupthan Date: Sat, 15 Jan 2022 15:24:08 +0000 Subject: [PATCH] Fix atomic ability part name change Signed-off-by: njupthan --- interfaces/kits/napi/window/BUILD.gn | 2 +- interfaces/kits/napi/window_runtime/BUILD.gn | 4 +- wm/BUILD.gn | 4 +- wm/test/systemtest/BUILD.gn | 22 +- wm/test/systemtest/window_immersive_test.cpp | 239 ------------------- wm/test/unittest/BUILD.gn | 2 +- wmserver/src/window_manager_stub.cpp | 4 +- wmserver/src/window_root.cpp | 1 - 8 files changed, 14 insertions(+), 264 deletions(-) delete mode 100644 wm/test/systemtest/window_immersive_test.cpp diff --git a/interfaces/kits/napi/window/BUILD.gn b/interfaces/kits/napi/window/BUILD.gn index 449bfb7fb4..93c5e88f38 100644 --- a/interfaces/kits/napi/window/BUILD.gn +++ b/interfaces/kits/napi/window/BUILD.gn @@ -28,7 +28,7 @@ ohos_shared_library("window") { deps = [ "../common:wm_napi_common", "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native", - "//foundation/appexecfwk/standard/kits:appkit_native", + "//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native", "//foundation/windowmanager/wm:libwm", "//foundation/windowmanager/wmserver:libwms", ] diff --git a/interfaces/kits/napi/window_runtime/BUILD.gn b/interfaces/kits/napi/window_runtime/BUILD.gn index 4c58fe36ec..4109529575 100644 --- a/interfaces/kits/napi/window_runtime/BUILD.gn +++ b/interfaces/kits/napi/window_runtime/BUILD.gn @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//ark/ts2abc/ts2panda/ts2abc_config.gni") import("//build/ohos.gni") @@ -43,7 +43,7 @@ ohos_shared_library("windowmanager_napi") { ] external_deps = [ - "aafwk_standard:runtime", + "ability_runtime:runtime", "hiviewdfx_hilog_native:libhilog", "napi:ace_napi", ] diff --git a/wm/BUILD.gn b/wm/BUILD.gn index 42dcfa781a..bdc183f76e 100644 --- a/wm/BUILD.gn +++ b/wm/BUILD.gn @@ -26,6 +26,7 @@ config("libwm_config") { # for abilityContext "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime/include", + "//foundation/aafwk/standard/interfaces/innerkits/app_manager/include/appmgr", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include", "//base/global/resmgr_standard/interfaces/innerkits/include", "//third_party/node/deps/icu-small/source/common", @@ -93,6 +94,7 @@ ohos_shared_library("libwmutil") { deps = [ "//utils/native/base:utils" ] external_deps = [ + "ability_runtime:app_manager", "bytrace_standard:bytrace_core", "hilog_native:libhilog", "ipc:ipc_core", @@ -173,7 +175,7 @@ ohos_shared_library("libwm") { ] external_deps = [ - "aafwk_standard:ability_context_native", + "ability_runtime:ability_context_native", "bytrace_standard:bytrace_core", "ipc:ipc_core", ] diff --git a/wm/test/systemtest/BUILD.gn b/wm/test/systemtest/BUILD.gn index 84b5b6172a..0056321617 100644 --- a/wm/test/systemtest/BUILD.gn +++ b/wm/test/systemtest/BUILD.gn @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/test.gni") @@ -19,7 +19,6 @@ group("systemtest") { testonly = true deps = [ - ":wm_window_immersive_test", ":wm_window_layout_test", ":wm_window_multi_ability_test", ":wm_window_subwindow_test", @@ -35,7 +34,7 @@ ohos_systemtest("wm_window_layout_test") { deps = [ ":wm_systemtest_common" ] } -## SystemTest wm_window_layout_test }}} +## SystemTest wm_window_layout_test }}} ## SystemTest wm_window_multi_ability_test {{{ ohos_systemtest("wm_window_multi_ability_test") { @@ -46,7 +45,7 @@ ohos_systemtest("wm_window_multi_ability_test") { deps = [ ":wm_systemtest_common" ] } -## SystemTest wm_window_multi_ability_test }}} +## SystemTest wm_window_multi_ability_test }}} ## SystemTest wm_window_subwindow_test {{{ ohos_systemtest("wm_window_subwindow_test") { @@ -57,18 +56,7 @@ ohos_systemtest("wm_window_subwindow_test") { deps = [ ":wm_systemtest_common" ] } -## SystemTest wm_window_subwindow_test }}} - -## SystemTest wm_window_immersive_test {{{ -ohos_systemtest("wm_window_immersive_test") { - module_out_path = module_out_path - - sources = [ "window_immersive_test.cpp" ] - - deps = [ ":wm_systemtest_common" ] -} - -## SystemTest wm_window_immersive_test }}} +## SystemTest wm_window_subwindow_test }}} ## Build wm_systemtest_common.a {{{ config("wm_systemtest_common_public_config") { @@ -124,6 +112,6 @@ ohos_static_library("wm_systemtest_common") { "//utils/native/base:utils", ] - external_deps = [ "aafwk_standard:ability_context_native" ] + external_deps = [ "ability_runtime:ability_context_native" ] } ## Build wm_systemtest_common.a }}} diff --git a/wm/test/systemtest/window_immersive_test.cpp b/wm/test/systemtest/window_immersive_test.cpp deleted file mode 100644 index 4865ad6c60..0000000000 --- a/wm/test/systemtest/window_immersive_test.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2022 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// gtest -#include -#include "window_manager.h" -#include "window_test_utils.h" -using namespace testing; -using namespace testing::ext; - -namespace OHOS { -namespace Rosen { -namespace { - const SystemBarProperty SYS_BAR_PROP_DEFAULT; - const SystemBarProperty SYS_BAR_PROP_1(true, 0xE5111111, 0xE5222222); - const SystemBarProperty SYS_BAR_PROP_2(false, 0xE5222222, 0xE5333333); - const SystemBarProperty SYS_BAR_PROP_3(false, 0xE5333333, 0xE5444444); - const SystemBarProperty SYS_BAR_PROP_4(true, 0xE5444444, 0x66555555); - const SystemBarProps TEST_PROPS_DEFAULT = { - { WindowType::WINDOW_TYPE_STATUS_BAR, SYS_BAR_PROP_DEFAULT }, - { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SYS_BAR_PROP_DEFAULT }, - }; - const SystemBarProps TEST_PROPS_1 = { - { WindowType::WINDOW_TYPE_STATUS_BAR, SYS_BAR_PROP_1 }, - { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SYS_BAR_PROP_2 }, - }; - const SystemBarProps TEST_PROPS_2 = { - { WindowType::WINDOW_TYPE_STATUS_BAR, SYS_BAR_PROP_1 }, - { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SYS_BAR_PROP_3 }, - }; - const SystemBarProps TEST_DIFF_PROPS_1_2 = { - { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SYS_BAR_PROP_3 }, - }; - const SystemBarProps TEST_DIFF_PROPS_2_1 = { - { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SYS_BAR_PROP_2 }, - }; -} -using utils = WindowTestUtils; -class TestSystemBarChangedListener : public ISystemBarChangedListener { -public: - SystemBarProps props_; - void OnSystemBarPropertyChange(uint64_t displayId, const SystemBarProps& props) override; -}; - -class WindowImmersiveTest : public testing::Test { -public: - static void SetUpTestCase(); - static void TearDownTestCase(); - virtual void SetUp() override; - virtual void TearDown() override; - void SetWindowSystemProps(const sptr& window, const SystemBarProps& props); - bool SystemBarPropsEqualsTo(const SystemBarProps& expect); - void DumpFailedInfo(const SystemBarProps& expect); - int displayId_ = 0; - std::vector> activeWindows_; - static vector fullScreenExpecteds_; - static sptr testSystemBarChangedListener_; -}; - -vector WindowImmersiveTest::fullScreenExpecteds_; -sptr WindowImmersiveTest::testSystemBarChangedListener_ = - new TestSystemBarChangedListener(); - -void WindowImmersiveTest::SetWindowSystemProps(const sptr& window, const SystemBarProps& props) -{ - for (auto prop : props) { - window->SetSystemBarProperty(prop.first, prop.second); - } -} - -void WindowImmersiveTest::DumpFailedInfo(const SystemBarProps& expect) -{ - auto act = testSystemBarChangedListener_->props_; - printf("WindowImmersiveTest Expected: \n"); - for (auto prop : expect) { - printf("WindowType: %4d, Enable: %4d, Color: %x | %x\n", static_cast(prop.first), - prop.second.enable_, prop.second.backgroundColor_, prop.second.contentColor_); - } - printf("WindowImmersiveTest Act: \n"); - for (auto prop : act) { - printf("WindowType: %4d, Enable: %4d, Color: %x | %x\n", static_cast(prop.first), - prop.second.enable_, prop.second.backgroundColor_, prop.second.contentColor_); - } -} - -bool WindowImmersiveTest::SystemBarPropsEqualsTo(const SystemBarProps& expect) -{ - auto act = testSystemBarChangedListener_->props_; - if (act.size() != expect.size()) { - DumpFailedInfo(expect); - return false; - } - for (auto item : expect) { - if (std::find(act.begin(), act.end(), item) == act.end()) { - DumpFailedInfo(expect); - return false; - } - } - return true; -} - -void TestSystemBarChangedListener::OnSystemBarPropertyChange(uint64_t displayId, const SystemBarProps& props) -{ - printf("TestSystemBarChangedListener Display ID: %llu\n", displayId); - props_ = props; -} - -void WindowImmersiveTest::SetUpTestCase() -{ -} - -void WindowImmersiveTest::TearDownTestCase() -{ -} - -void WindowImmersiveTest::SetUp() -{ - WindowManager::GetInstance().RegisterSystemBarChangedListener(testSystemBarChangedListener_); - activeWindows_.clear(); -} - -void WindowImmersiveTest::TearDown() -{ - while (!activeWindows_.empty()) { - ASSERT_EQ(WMError::WM_OK, activeWindows_.back()->Destroy()); - activeWindows_.pop_back(); - } - WindowManager::GetInstance().UnregisterSystemBarChangedListener(testSystemBarChangedListener_); -} - -namespace { -/** - * @tc.name: ImmersiveTest01 - * @tc.desc: Add one immersive window and hide - * @tc.type: FUNC - * @tc.require: AR000GGTVD - */ -HWTEST_F(WindowImmersiveTest, ImmersiveTest01, Function | MediumTest | Level3) -{ - utils::TestWindowInfo info = { - .name = "main", - .rect = utils::defaultAppRect_, - .type = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, - .mode = WindowMode::WINDOW_MODE_FULLSCREEN, // immersive setting - .needAvoid = false, // immersive setting - .parentLimit = false, - .parentName = "", - }; - const sptr& window = utils::CreateTestWindow(info); - activeWindows_.push_back(window); - SetWindowSystemProps(window, TEST_PROPS_1); - ASSERT_EQ(WMError::WM_OK, window->Show()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_1)); - ASSERT_EQ(WMError::WM_OK, window->Hide()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_DEFAULT)); -} - -/** - * @tc.name: ImmersiveTest02 - * @tc.desc: Add two immersive window and switch - * @tc.type: FUNC - * @tc.require: AR000GGTVD - */ -HWTEST_F(WindowImmersiveTest, ImmersiveTest02, Function | MediumTest | Level3) -{ - utils::TestWindowInfo info = { - .name = "main", - .rect = utils::defaultAppRect_, - .type = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, - .mode = WindowMode::WINDOW_MODE_FULLSCREEN, // immersive setting - .needAvoid = false, // immersive setting - .parentLimit = false, - .parentName = "", - }; - const sptr& window1 = utils::CreateTestWindow(info); - activeWindows_.push_back(window1); - SetWindowSystemProps(window1, TEST_PROPS_1); - info.name = "main2"; - const sptr& window2 = utils::CreateTestWindow(info); - activeWindows_.push_back(window2); - SetWindowSystemProps(window2, TEST_PROPS_2); - ASSERT_EQ(WMError::WM_OK, window1->Show()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_1)); - ASSERT_EQ(WMError::WM_OK, window2->Show()); - - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_DIFF_PROPS_1_2)); - ASSERT_EQ(WMError::WM_OK, window2->Hide()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_DIFF_PROPS_2_1)); - ASSERT_EQ(WMError::WM_OK, window1->Hide()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_DEFAULT)); -} - -/** - * @tc.name: ImmersiveTest03 - * @tc.desc: Add one no immersive window - * @tc.type: FUNC - * @tc.require: AR000GGTVD - */ -HWTEST_F(WindowImmersiveTest, ImmersiveTest03, Function | MediumTest | Level3) -{ - utils::TestWindowInfo info = { - .name = "main", - .rect = utils::defaultAppRect_, - .type = WindowType::WINDOW_TYPE_APP_MAIN_WINDOW, - .mode = WindowMode::WINDOW_MODE_FULLSCREEN, // immersive setting - .needAvoid = false, // immersive setting - .parentLimit = false, - .parentName = "", - }; - const sptr& window1 = utils::CreateTestWindow(info); - activeWindows_.push_back(window1); - SetWindowSystemProps(window1, TEST_PROPS_1); - info.name = "main2"; - info.needAvoid = true; // no immersive setting - const sptr& window2 = utils::CreateTestWindow(info); - activeWindows_.push_back(window2); - SetWindowSystemProps(window2, TEST_PROPS_2); - ASSERT_EQ(WMError::WM_OK, window1->Show()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_1)); - ASSERT_EQ(WMError::WM_OK, window2->Show()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_1)); - ASSERT_EQ(WMError::WM_OK, window1->Hide()); - ASSERT_TRUE(SystemBarPropsEqualsTo(TEST_PROPS_DEFAULT)); -} -} -} // namespace Rosen -} // namespace OHOS diff --git a/wm/test/unittest/BUILD.gn b/wm/test/unittest/BUILD.gn index 144000bc2b..a7800e8d9b 100644 --- a/wm/test/unittest/BUILD.gn +++ b/wm/test/unittest/BUILD.gn @@ -145,6 +145,6 @@ ohos_static_library("wm_unittest_common") { "//utils/native/base:utils", ] - external_deps = [ "aafwk_standard:ability_context_native" ] + external_deps = [ "ability_runtime:ability_context_native" ] } ## Build wm_unittest_common.a }}} diff --git a/wmserver/src/window_manager_stub.cpp b/wmserver/src/window_manager_stub.cpp index 35bf06a4cc..a321f55c07 100644 --- a/wmserver/src/window_manager_stub.cpp +++ b/wmserver/src/window_manager_stub.cpp @@ -119,16 +119,16 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M break; } case TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT: { - WindowManagerAgentType type = static_cast(data.ReadUint32()); sptr windowManagerAgentObject = data.ReadRemoteObject(); + WindowManagerAgentType type = static_cast(data.ReadUint32()); sptr windowManagerAgentProxy = iface_cast(windowManagerAgentObject); RegisterWindowManagerAgent(type, windowManagerAgentProxy); break; } case TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT: { - WindowManagerAgentType type = static_cast(data.ReadUint32()); sptr windowManagerAgentObject = data.ReadRemoteObject(); + WindowManagerAgentType type = static_cast(data.ReadUint32()); sptr windowManagerAgentProxy = iface_cast(windowManagerAgentObject); UnregisterWindowManagerAgent(type, windowManagerAgentProxy); diff --git a/wmserver/src/window_root.cpp b/wmserver/src/window_root.cpp index fcc6997678..b724c8a1ee 100644 --- a/wmserver/src/window_root.cpp +++ b/wmserver/src/window_root.cpp @@ -254,7 +254,6 @@ WMError WindowRoot::RequestFocus(uint32_t windowId) void WindowRoot::RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) { - WLOGFI("RegisterWindowManagerAgent Type:%{public}u", static_cast(type)); windowManagerAgents_[type].push_back(windowManagerAgent); if (windowManagerAgentDeath_ == nullptr) { WLOGFI("failed to create death Recipient ptr WindowManagerAgentDeathRecipient"); -- Gitee