1 /*
2  * Copyright (c) 2021 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_WINDOW_ZORDER_POLICY_H
17 #define OHOS_ROSEN_WINDOW_ZORDER_POLICY_H
18 
19 #include <map>
20 #include <refbase.h>
21 
22 #include "wm_common.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class WindowZorderPolicy : public RefBase {
27 public:
28     WindowZorderPolicy() = default;
29     ~WindowZorderPolicy() = default;
30 
31     int32_t GetWindowPriority(WindowType type) const;
32 
33 private:
34     const std::map<WindowType, int32_t> windowPriorityMap_ {
35         // sub-windows types
36         { WindowType::WINDOW_TYPE_MEDIA,                 -1 },
37         { WindowType::WINDOW_TYPE_APP_SUB_WINDOW,         2 },
38         { WindowType::WINDOW_TYPE_SYSTEM_SUB_WINDOW,      2 },
39         { WindowType::WINDOW_TYPE_APP_COMPONENT,          2 },
40 
41         // main window
42         { WindowType::WINDOW_TYPE_APP_MAIN_WINDOW,        1 },
43 
44         // system-specific window
45         { WindowType::WINDOW_TYPE_WALLPAPER,            0 },
46         { WindowType::WINDOW_TYPE_DESKTOP,              1 },
47         { WindowType::WINDOW_TYPE_DIALOG,               3 },
48         { WindowType::WINDOW_TYPE_APP_LAUNCHING,        101 },
49         { WindowType::WINDOW_TYPE_DOCK_SLICE,           1 },
50         { WindowType::WINDOW_TYPE_PLACEHOLDER,          1 },
51         { WindowType::WINDOW_TYPE_LAUNCHER_RECENT,      102 },
52         { WindowType::WINDOW_TYPE_LAUNCHER_DOCK,        103 },
53         { WindowType::WINDOW_TYPE_INCOMING_CALL,        104 },
54         { WindowType::WINDOW_TYPE_SEARCHING_BAR,        105 },
55         { WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW,  106 },
56         { WindowType::WINDOW_TYPE_FLOAT,                107 },
57         { WindowType::WINDOW_TYPE_SYSTEM_FLOAT,         107 },
58         { WindowType::WINDOW_TYPE_GLOBAL_SEARCH,        107 },
59         { WindowType::WINDOW_TYPE_FLOAT_CAMERA,         107 },
60         { WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT,   108 },
61         { WindowType::WINDOW_TYPE_TOAST,                109 },
62         { WindowType::WINDOW_TYPE_STATUS_BAR,           110 },
63         { WindowType::WINDOW_TYPE_PANEL,                111 },
64         { WindowType::WINDOW_TYPE_VOLUME_OVERLAY,       112 },
65         { WindowType::WINDOW_TYPE_NAVIGATION_BAR,       113 },
66         { WindowType::WINDOW_TYPE_KEYGUARD,             114 },
67         // reserve 115 for app window above keyguard, 116 for input method window above keyguard
68         { WindowType::WINDOW_TYPE_SCREENSHOT,           117 },
69         { WindowType::WINDOW_TYPE_VOICE_INTERACTION,    117 },
70         { WindowType::WINDOW_TYPE_DRAGGING_EFFECT,      118 },
71         { WindowType::WINDOW_TYPE_SYSTEM_TOAST,         119 },
72         { WindowType::WINDOW_TYPE_POINTER,              120 },
73         { WindowType::WINDOW_TYPE_BOOT_ANIMATION,       121 },
74         { WindowType::WINDOW_TYPE_FREEZE_DISPLAY,       122 },
75     };
76 };
77 }
78 }
79 #endif // OHOS_ROSEN_WINDOW_STATE_H
80