• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 HGM_COMMAND_H
17 #define HGM_COMMAND_H
18 
19 #include <inttypes.h>
20 #include <string>
21 
22 #include "screen_manager/screen_types.h"
23 #include "animation/rs_frame_rate_range.h"
24 
25 namespace OHOS::Rosen {
26 
27 enum OledRefreshRate {
28     OLED_NULL_HZ = 0,
29     OLED_1_HZ = 1,
30     OLED_10_HZ = 10,
31     OLED_20_HZ = 20,
32     OLED_30_HZ = 30,
33     OLED_40_HZ = 40,
34     OLED_60_HZ = 60,
35     OLED_90_HZ = 90,
36     OLED_120_HZ = 120,
37     OLED_144_HZ = 144,
38     OLED_MAX_HZ = 1000,
39 };
40 
41 enum HgmErrCode {
42     HGM_ERROR = -1,
43 
44     EXEC_SUCCESS = 0,
45 
46     HGM_NO_SCREEN = 100,
47     HGM_BASE_REMOVE_FAILED,
48 
49     XML_PARSER_CREATE_FAIL = 200,
50     XML_FILE_LOAD_FAIL,
51     XML_GET_ROOT_FAIL,
52     XML_PARSE_INTERNAL_FAIL,
53 
54     HGM_SCREEN_MODE_EXIST,
55     HGM_SCREEN_PARAM_ERROR,
56 };
57 
58 enum HgmXmlNode {
59     HGM_XML_UNDEFINED = 0,
60     HGM_XML_PARAM,
61     HGM_XML_PARAMS,
62 };
63 
64 enum Animation {
65     HGM_ANIMATION_ZOOM = 0,
66     HGM_ANIMAION_TRANS,
67     HGM_ANIMAION_UI,
68     HGM_ANIMAION_OTHERS,
69 };
70 
71 enum RefreshRateMode {
72     HGM_REFRESHRATE_MODE_AUTO = -1,
73     HGM_REFRESHRATE_MODE_NULL = 0,
74     HGM_REFRESHRATE_MODE_LOW = 1,
75     HGM_REFRESHRATE_MODE_MEDIUM,
76     HGM_REFRESHRATE_MODE_HIGH,
77 };
78 
79 enum class SpeedTransType {
80     TRANS_PIXEL_TO_MM,
81     TRANS_MM_TO_PIXEL,
82 };
83 
84 class ParsedConfigData {
85 public:
86     ParsedConfigData() = default;
87     ~ParsedConfigData() = default;
88 
89     std::string isDynamicFrameRateEnable_ = "0";
90     std::string defaultRefreshRateMode_ = "-1";
91     struct detailedStrat {
92         std::string name;
93         std::string isDynamic;
94         std::string min;
95         std::string max;
96     };
97     struct AnimationDynamicSetting {
98         int32_t min;
99         int32_t max;
100         int32_t preferred_fps;
101     };
102     std::unordered_map<std::string, std::string> customerSettingConfig_;
103     std::unordered_map<std::string, detailedStrat> detailedStrategies_;
104     std::unordered_map<std::string, std::string> animationDynamicStrats_;
105     std::unordered_map<std::string, std::string> bundle_black_list_;
106     std::unordered_map<std::string, std::string> bundle_white_list_;
107     std::unordered_map<std::string, std::unordered_map<std::string, AnimationDynamicSetting>> dynamicSetting_ = {
108         {"translate", {}}, {"scale", {}}, {"rotation", {}}};
109 
GetAnimationDynamicSettingMap(HgmModifierType hgmModifierType)110     std::unordered_map<std::string, AnimationDynamicSetting> GetAnimationDynamicSettingMap(
111         HgmModifierType hgmModifierType) const
112     {
113         switch (hgmModifierType) {
114             case HgmModifierType::TRANSLATE:
115                 return dynamicSetting_.find("translate")->second;
116             case HgmModifierType::SCALE:
117                 return dynamicSetting_.find("scale")->second;
118             case HgmModifierType::ROTATION:
119                 return dynamicSetting_.find("rotation")->second;
120         }
121     }
122 };
123 } // namespace OHOS
124 #endif // HGM_COMMAND_H