• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DISPLAY_MANAGER_AGENT_CONTROLLER_H
17 #define OHOS_ROSEN_DISPLAY_MANAGER_AGENT_CONTROLLER_H
18 
19 #include <mutex>
20 #include "wm_single_instance.h"
21 #include "client_agent_container.h"
22 #include "zidl/display_manager_agent_interface.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 class DisplayManagerAgentController {
27 WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayManagerAgentController)
28 public:
29     bool RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
30         DisplayManagerAgentType type);
31     bool UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
32         DisplayManagerAgentType type);
33 
34     bool NotifyDisplayPowerEvent(DisplayPowerEvent event, EventStatus status);
35     bool NotifyDisplayStateChanged(DisplayId id, DisplayState state);
36 
37     void OnScreenConnect(sptr<ScreenInfo> screenInfo);
38     void OnScreenDisconnect(ScreenId);
39     void OnScreenChange(sptr<ScreenInfo>, ScreenChangeEvent);
40     void OnScreenGroupChange(const std::string&, const sptr<ScreenInfo>&, ScreenGroupChangeEvent);
41     void OnScreenGroupChange(const std::string&, const std::vector<sptr<ScreenInfo>>&, ScreenGroupChangeEvent);
42     void OnDisplayCreate(sptr<DisplayInfo>);
43     void OnDisplayDestroy(DisplayId);
44     void OnDisplayChange(sptr<DisplayInfo>, DisplayChangeEvent);
45     void OnScreenshot(sptr<ScreenshotInfo>);
46 
47 private:
DisplayManagerAgentController()48     DisplayManagerAgentController() {}
49     virtual ~DisplayManagerAgentController() = default;
50 
51     ClientAgentContainer<IDisplayManagerAgent, DisplayManagerAgentType> dmAgentContainer_;
52 };
53 }
54 }
55 #endif // OHOS_ROSEN_DISPLAY_MANAGER_AGENT_CONTROLLER_H
56