• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2024-2025 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_ACE_FRAMEWORKS_BASE_UTILS_DISPLAY_INFO_UTILS_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_UTILS_DISPLAY_INFO_UTILS_H
18 
19 #include "base/memory/ace_type.h"
20 #include "core/common/display_info.h"
21 
22 namespace OHOS::Ace {
23 class ACE_FORCE_EXPORT DisplayInfoUtils : public AceType {
24     DECLARE_ACE_TYPE(DisplayInfoUtils, AceType);
25 
26 public:
27     DisplayInfoUtils() = default;
28     ~DisplayInfoUtils() override = default;
29     RefPtr<DisplayInfo> GetDisplayInfo(int32_t displayId = 0);
30     void InitIsFoldable();
31     bool GetIsFoldable();
32     FoldStatus GetCurrentFoldStatus();
33     std::vector<Rect> GetCurrentFoldCreaseRegion();
34     Rect GetDisplayAvailableRect(int32_t displayId) const;
35     Rect GetFoldExpandAvailableRect() const;
36 
37 private:
38     RefPtr<DisplayInfo> displayInfo_ = AceType::MakeRefPtr<DisplayInfo>();
39     bool hasInitIsFoldable_ = false;
40     bool hasInitFoldCreaseRegion_ = false;
41 };
42 
43 } // namespace OHOS::Ace
44 
45 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_UTILS_DISPLAY_INFO_UTILS_H
46