1/*
2 * Copyright (c) 2022 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#ifndef OHOS_ROSEN_STARTING_WINDOW_H
17#define OHOS_ROSEN_STARTING_WINDOW_H
18
19#include <refbase.h>
20#include "pixel_map.h"
21#include "animation_config.h"
22#include "surface_draw.h"
23#include "wm_common.h"
24#include "window_node.h"
25#include "window_root.h"
26#include "window_transition_info.h"
27
28namespace OHOS {
29namespace Rosen {
30
31class StartingWindow : public RefBase {
32public:
33    StartingWindow() = delete;
34    ~StartingWindow() = default;
35
36    static sptr<WindowNode> CreateWindowNode(const sptr<WindowTransitionInfo>& info, uint32_t winId);
37    static void HandleClientWindowCreate(sptr<WindowNode>& node, sptr<IWindow>& window,
38        uint32_t& windowId, const std::shared_ptr<RSSurfaceNode>& surfaceNode, sptr<WindowProperty>& property,
39        int32_t pid, int32_t uid);
40    static WMError DrawStartingWindow(sptr<WindowNode>& node, std::shared_ptr<Media::PixelMap> pixelMap,
41        uint32_t bkgColor, bool isColdStart);
42    static void AddNodeOnRSTree(sptr<WindowNode>& node, bool isMultiDisplay);
43    static void ReleaseStartWinSurfaceNode(sptr<WindowNode>& node);
44    static void SetDefaultWindowMode(WindowMode defaultMode);
45    static void SetAnimationConfig(AnimationConfig config);
46    static bool transAnimateEnable_;
47    static WindowUIType windowUIType_;
48
49private:
50    static WMError CreateLeashAndStartingSurfaceNode(sptr<WindowNode>& node);
51    static WMError SetStartingWindowAnimation(wptr<WindowNode> weak);
52    static void ChangePropertyByApiVersion(const sptr<WindowTransitionInfo>& info,
53        const Orientation orientation, sptr<WindowProperty>& property);
54    static std::recursive_mutex mutex_;
55    static WindowMode defaultMode_;
56    static AnimationConfig animationConfig_;
57    static bool IsWindowFollowParent(WindowType type);
58    static sptr<WindowProperty> InitializeWindowProperty(const sptr<WindowTransitionInfo>& info, uint32_t winId);
59    static void UpdateRSTree(sptr<WindowNode>& node, bool isMultiDisplay);
60};
61} // Rosen
62} // OHOS
63#endif // OHOS_ROSEN_STARTING_WINDOW_H
64