• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_DISPLAY_NODE_COMMAND_H
17 #define ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_DISPLAY_NODE_COMMAND_H
18 
19 #include "command/rs_command_templates.h"
20 #include "screen_manager/screen_types.h"
21 #include "common/rs_macros.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 
26 //Each command HAVE TO have UNIQUE ID in ALL HISTORY
27 //If a command is not used and you want to delete it,
28 //just COMMENT it - and never use this value anymore
29 enum RSDisplayNodeCommandType : uint16_t {
30     DISPLAY_NODE_CREATE = 0,
31     DISPLAY_NODE_SET_SCREEN_ID = 1,
32     DISPLAY_NODE_SET_SECURITY_DISPLAY = 3,
33     DISPLAY_NODE_SET_DISPLAY_MODE = 4,
34     DISPLAY_NODE_SET_SCREEN_ROTATION = 5,
35     DISPLAY_NODE_SET_BOOT_ANIMATION = 6,
36     DISPLAY_NODE_SET_ROG_SIZE = 7,
37     DISPLAY_NODE_ADD_TO_TREE = 8,
38     DISPLAY_NODE_REMOVE_FROM_TREE = 9,
39     DISPLAY_NODE_SET_NODE_PID = 10,
40     DISPLAY_NODE_SET_VIRTUAL_SCREEN_MUTE_STATUS = 11,
41     DISPLAY_NODE_SET_FORCE_CLOSE_HDR = 12,
42 };
43 
44 class RSB_EXPORT DisplayNodeCommandHelper {
45 public:
46     static void Create(RSContext&, NodeId, const RSDisplayNodeConfig&);
47     static std::shared_ptr<RSLogicalDisplayRenderNode> CreateWithConfigInRS(
48         RSContext&, NodeId, const RSDisplayNodeConfig&);
49     static void SetScreenId(RSContext&, NodeId, uint64_t);
50     static void SetSecurityDisplay(RSContext&, NodeId, bool);
51     static void SetDisplayMode(RSContext&, NodeId, const RSDisplayNodeConfig&);
52     static void SetScreenRotation(RSContext&, NodeId, const ScreenRotation&);
53     static void SetBootAnimation(RSContext& context, NodeId nodeId, bool isBootAnimation);
54     static void AddDisplayNodeToTree(RSContext&, NodeId);
55     static void RemoveDisplayNodeFromTree(RSContext&, NodeId);
56     static void SetScbNodePid(RSContext&, NodeId, const std::vector<int32_t>& oldScbPids, int32_t currentScbPid);
57     static void SetVirtualScreenMuteStatus(RSContext&, NodeId, bool);
58     static void SetForceCloseHdr(RSContext&, NodeId, bool);
59 };
60 
61 ADD_COMMAND(RSDisplayNodeCreate,
62     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_CREATE,
63         DisplayNodeCommandHelper::Create, NodeId, RSDisplayNodeConfig))
64 ADD_COMMAND(RSDisplayNodeSetScreenId,
65     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_SCREEN_ID,
66         DisplayNodeCommandHelper::SetScreenId, NodeId, uint64_t))
67 ADD_COMMAND(RSDisplayNodeSetSecurityDisplay,
68     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_SECURITY_DISPLAY,
69         DisplayNodeCommandHelper::SetSecurityDisplay, NodeId, bool))
70 ADD_COMMAND(RSDisplayNodeSetDisplayMode,
71     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_DISPLAY_MODE,
72         DisplayNodeCommandHelper::SetDisplayMode, NodeId, RSDisplayNodeConfig))
73 ADD_COMMAND(RSDisplayNodeSetScreenRotation,
74     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_SCREEN_ROTATION,
75         DisplayNodeCommandHelper::SetScreenRotation, NodeId, ScreenRotation))
76 ADD_COMMAND(RSDisplayNodeSetBootAnimation,
77     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_BOOT_ANIMATION,
78         DisplayNodeCommandHelper::SetBootAnimation, NodeId, bool))
79 ADD_COMMAND(RSDisplayNodeAddToTree,
80     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_ADD_TO_TREE,
81         DisplayNodeCommandHelper::AddDisplayNodeToTree, NodeId))
82 ADD_COMMAND(RSDisplayNodeRemoveFromTree,
83     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_REMOVE_FROM_TREE,
84         DisplayNodeCommandHelper::RemoveDisplayNodeFromTree, NodeId))
85 ADD_COMMAND(RSDisplayNodeSetNodePid,
86     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_NODE_PID,
87         DisplayNodeCommandHelper::SetScbNodePid, NodeId, std::vector<int32_t>, int32_t))
88 ADD_COMMAND(RSDisplayNodeSetVirtualScreenMuteStatus,
89     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_VIRTUAL_SCREEN_MUTE_STATUS,
90         DisplayNodeCommandHelper::SetVirtualScreenMuteStatus, NodeId, bool))
91 ADD_COMMAND(RSDisplayNodeForceCloseHdr,
92     ARG(PERMISSION_SYSTEM, DISPLAY_NODE, DISPLAY_NODE_SET_FORCE_CLOSE_HDR,
93         DisplayNodeCommandHelper::SetForceCloseHdr, NodeId, bool))
94 } // namespace Rosen
95 } // namespace OHOS
96 
97 #endif // ROSEN_RENDER_SERVICE_BASE_COMMAND_RS_DISPLAY_NODE_COMMAND_H
98