1 /*
2  * Copyright (c) 2021-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 FOUNDATION_DMSERVER_DISPLAY_MANAGER_SERVICE_INNER_H
17 #define FOUNDATION_DMSERVER_DISPLAY_MANAGER_SERVICE_INNER_H
18 
19 #include <vector>
20 
21 #include <pixel_map.h>
22 #include <system_ability.h>
23 
24 #include "abstract_display.h"
25 #include "cutout_info.h"
26 #include "display_change_listener.h"
27 #include "singleton_delegator.h"
28 #include "wm_single_instance.h"
29 #include "window_info_queried_listener.h"
30 
31 namespace OHOS::Rosen {
32 class DisplayManagerServiceInner {
33 WM_DECLARE_SINGLE_INSTANCE(DisplayManagerServiceInner);
34 
35 public:
36     std::vector<sptr<DisplayInfo>> GetAllDisplays() const;
37     DisplayId GetDefaultDisplayId() const;
38     sptr<DisplayInfo> GetDefaultDisplay() const;
39     sptr<DisplayInfo> GetDisplayById(DisplayId displayId) const;
40     std::vector<DisplayId> GetAllDisplayIds() const;
41     sptr<ScreenInfo> GetScreenInfoByDisplayId(DisplayId displayId) const;
42     ScreenId GetScreenGroupIdByDisplayId(DisplayId displayId) const;
43     sptr<SupportedScreenModes> GetScreenModesByDisplayId(DisplayId displayId) const;
44     std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, DmErrorCode* errorCode = nullptr,
45         bool isUseDma = false) const;
46     void UpdateRSTree(DisplayId displayId, DisplayId parentDisplayId, std::shared_ptr<RSSurfaceNode>& surfaceNode,
47         bool isAdd, bool isMultiDisplay);
48     void RegisterDisplayChangeListener(sptr<IDisplayChangeListener> listener);
49     DMError SetOrientationFromWindow(DisplayId displayId, Orientation orientation, bool withAnimation = true);
50     bool SetRotationFromWindow(DisplayId displayId, Rotation targetRotation, bool withAnimation = true);
51     void SetGravitySensorSubscriptionEnabled();
52     void RegisterWindowInfoQueriedListener(const sptr<IWindowInfoQueriedListener>& listener);
53     sptr<CutoutInfo> GetCutoutInfo(DisplayId displayId) const;
54     void NotifyPrivateWindowStateChanged(bool hasPrivate);
55 };
56 } // namespace OHOS::Rosen
57 
58 #endif // FOUNDATION_DMSERVER_DISPLAY_MANAGER_SERVICE_H