• 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_GROUP_INFO_H
17 #define OHOS_ROSEN_DISPLAY_GROUP_INFO_H
18 
19 #include <map>
20 #include <refbase.h>
21 
22 #include "display_info.h"
23 #include "wm_common.h"
24 #include "wm_single_instance.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 class DisplayGroupInfo : public RefBase {
29 WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayGroupInfo);
30 public:
31     void Init(ScreenId displayGroupId, const sptr<DisplayInfo>& displayInfo);
32     void AddDisplayInfo(const sptr<DisplayInfo>& displayInfo);
33     void RemoveDisplayInfo(DisplayId displayId);
34     void UpdateLeftAndRightDisplayId();
35 
36     void SetDisplayRotation(DisplayId displayId, Rotation rotation);
37     void SetDisplayOrientation(DisplayId displayId, DisplayOrientation orientation);
38     void SetDisplayStateChangeType(DisplayId displayId, DisplayStateChangeType changeType);
39     void SetDisplayVirtualPixelRatio(DisplayId displayId, float vpr);
40     void SetDisplayRect(DisplayId displayId, Rect displayRect);
41     void SetDefaultDisplayId(DisplayId defaultDisplayId);
42 
43     Rotation GetDisplayRotation(DisplayId displayId) const;
44     DisplayStateChangeType GetDisplayStateChangeType(DisplayId displayId) const;
45     float GetDisplayVirtualPixelRatio(DisplayId displayId) const;
46     std::map<DisplayId, Rect> GetAllDisplayRects() const;
47     Rect GetDisplayRect(DisplayId displayId) const;
48     sptr<DisplayInfo> GetDisplayInfo(DisplayId displayId) const;
49     sptr<DisplayInfo> GetDefaultDisplayInfo() const;
50     void UpdateDisplayInfo(sptr<DisplayInfo> displayInfo) const;
51     std::vector<sptr<DisplayInfo>> GetAllDisplayInfo() const;
52     std::vector<DisplayId> GetAllDisplayIds() const;
53     DisplayId GetLeftDisplayId() const;
54     DisplayId GetRightDisplayId() const;
55     DisplayId GetDefaultDisplayId() const;
56 
57 protected:
58     DisplayGroupInfo() = default;
59     ~DisplayGroupInfo() = default;
60 
61 private:
62     ScreenId displayGroupId_;
63     DisplayId defaultDisplayId_ { 0 };
64     DisplayId leftDisplayId_ { 0 };  // the displayId at left in expand-mode
65     DisplayId rightDisplayId_ { 0 }; // the displayId at right in expand-mode
66     mutable std::map<DisplayId, sptr<DisplayInfo>> displayInfosMap_;
67 };
68 } // namespace Rosen
69 } // namespace OHOS
70 #endif // OHOS_ROSEN_DISPLAY_GROUP_INFO_H
71 
72