1 /*
2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "window.h"
17
18 #include "window_impl.h"
19 #include "window_manager_hilog.h"
20
21 namespace OHOS {
22 namespace Rosen {
23 namespace {
24 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "Window"};
25 }
Create(const std::string & windowName,sptr<WindowOption> & option,const std::shared_ptr<OHOS::AbilityRuntime::Context> & context,WMError & errCode)26 sptr<Window> Window::Create(const std::string& windowName, sptr<WindowOption>& option,
27 const std::shared_ptr<OHOS::AbilityRuntime::Context>& context, WMError& errCode)
28 {
29 if (option == nullptr) {
30 option = new(std::nothrow) WindowOption();
31 if (option == nullptr) {
32 WLOGFE("alloc WindowOption failed");
33 return nullptr;
34 }
35 }
36 sptr<WindowImpl> windowImpl = new(std::nothrow) WindowImpl(option);
37 if (windowImpl == nullptr) {
38 WLOGFE("alloc WindowImpl failed");
39 return nullptr;
40 }
41 WMError error = windowImpl->Create(option->GetParentId(), context);
42 if (error != WMError::WM_OK) {
43 WLOGFE("error unequal to WMError::WM_OK");
44 errCode = error;
45 return nullptr;
46 }
47 return windowImpl;
48 }
49
Find(const std::string & windowName)50 sptr<Window> Window::Find(const std::string& windowName)
51 {
52 return nullptr;
53 }
54
GetSubWindow(uint32_t parentId)55 std::vector<sptr<Window>> Window::GetSubWindow(uint32_t parentId)
56 {
57 return std::vector<sptr<Window>>();
58 }
59
GetTopWindowWithId(uint32_t mainWinId)60 sptr<Window> Window::GetTopWindowWithId(uint32_t mainWinId)
61 {
62 return WindowImpl::GetTopWindowWithId(mainWinId);
63 }
64
GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context> & context)65 sptr<Window> Window::GetTopWindowWithContext(const std::shared_ptr<AbilityRuntime::Context>& context)
66 {
67 return nullptr;
68 }
69
UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration> & configuration)70 void Window::UpdateConfigurationForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration)
71 {
72 return WindowImpl::UpdateConfigurationForAll(configuration);
73 }
74
UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration> & configuration)75 void Window::UpdateConfigurationSyncForAll(const std::shared_ptr<AppExecFwk::Configuration>& configuration)
76 {
77 return WindowImpl::UpdateConfigurationSyncForAll(configuration);
78 }
79
Marshalling(Parcel & parcel) const80 bool OccupiedAreaChangeInfo::Marshalling(Parcel& parcel) const
81 {
82 return true;
83 }
84
Unmarshalling(Parcel & parcel)85 OccupiedAreaChangeInfo* OccupiedAreaChangeInfo::Unmarshalling(Parcel& parcel)
86 {
87 return nullptr;
88 }
89 } // namespace Rosen
90 } // namespace OHOS
91