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 "dm_common.h"
21#include "wm_single_instance.h"
22#include "client_agent_container.h"
23#include "zidl/display_manager_agent_interface.h"
24
25namespace OHOS {
26namespace Rosen {
27class DisplayManagerAgentController {
28WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayManagerAgentController)
29public:
30    DMError RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
31        DisplayManagerAgentType type);
32    DMError UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
33        DisplayManagerAgentType type);
34
35    bool NotifyDisplayPowerEvent(DisplayPowerEvent event, EventStatus status);
36    bool NotifyDisplayStateChanged(DisplayId id, DisplayState state);
37
38    void OnScreenConnect(sptr<ScreenInfo> screenInfo);
39    void OnScreenDisconnect(ScreenId);
40    void OnScreenChange(sptr<ScreenInfo>, ScreenChangeEvent);
41    void OnScreenGroupChange(const std::string&, const sptr<ScreenInfo>&, ScreenGroupChangeEvent);
42    void OnScreenGroupChange(const std::string&, const std::vector<sptr<ScreenInfo>>&, ScreenGroupChangeEvent);
43    void OnDisplayCreate(sptr<DisplayInfo>);
44    void OnDisplayDestroy(DisplayId);
45    void OnDisplayChange(sptr<DisplayInfo>, DisplayChangeEvent);
46    void OnScreenshot(sptr<ScreenshotInfo>);
47    void NotifyPrivateWindowStateChanged(bool hasPrivate);
48    void NotifyFoldStatusChanged(FoldStatus);
49    void NotifyFoldAngleChanged(std::vector<float> foldAngles);
50    void NotifyCaptureStatusChanged(bool isCapture);
51    void NotifyDisplayChangeInfoChanged(const sptr<DisplayChangeInfo>& info);
52    void NotifyDisplayModeChanged(FoldDisplayMode);
53    void NotifyAvailableRectChanged(DMRect);
54
55private:
56    DisplayManagerAgentController() {}
57    virtual ~DisplayManagerAgentController() = default;
58
59    ClientAgentContainer<IDisplayManagerAgent, DisplayManagerAgentType> dmAgentContainer_;
60};
61}
62}
63#endif // OHOS_ROSEN_DISPLAY_MANAGER_AGENT_CONTROLLER_H
64