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 #include "screen_scene_config.h"
16
17 #include <climits>
18 #include <cstdint>
19 #include <cstdlib>
20 #include <libxml/globals.h>
21 #include <libxml/xmlstring.h>
22 #include <map>
23 #include <string>
24 #include <utility>
25 #include <vector>
26
27 #include "config_policy_utils.h"
28 #include "include/core/SkMatrix.h"
29 #include "include/core/SkPath.h"
30 #include "include/core/SkPathMeasure.h"
31 #include "include/utils/SkParsePath.h"
32 #include "window_manager_hilog.h"
33
34 namespace OHOS::Rosen {
35 namespace {
36 constexpr uint32_t NO_WATERFALL_DISPLAY_COMPRESSION_SIZE = 0;
37 constexpr uint32_t DISPLAY_PHYSICAL_SIZE = 2;
38 enum XmlNodeElement {
39 DPI = 0,
40 SUB_DPI,
41 IS_WATERFALL_DISPLAY,
42 CURVED_SCREEN_BOUNDARY,
43 CURVED_AREA_IN_LANDSCAPE,
44 IS_CURVED_COMPRESS_ENABLED,
45 BUILD_IN_DEFAULT_ORIENTATION,
46 DEFAULT_DEVICE_ROTATION_OFFSET,
47 DEFAULT_DISPLAY_CUTOUT_PATH,
48 SUB_DISPLAY_CUTOUT_PATH,
49 HALL_SWITCH_APP,
50 PACKAGE_NAME,
51 ROTATION_POLICY,
52 DEFAULT_ROTATION_POLICY,
53 SCREEN_SNAPSHOT_BUNDLE_NAME,
54 SCREEN_SNAPSHOT_ABILITY_NAME,
55 IS_RIGHT_POWER_BUTTON,
56 SUPPORT_ROTATE_WITH_SCREEN,
57 EXTERNAL_SCREEN_DEFAULT_MODE,
58 CAST_BUNDLE_NAME,
59 CAST_ABILITY_NAME,
60 PHYSICAL_DISPLAY_RESOLUTION,
61 IS_SUPPORT_CAPTURE
62 };
63 }
64
65 std::map<std::string, bool> ScreenSceneConfig::enableConfig_;
66 std::map<std::string, std::vector<int>> ScreenSceneConfig::intNumbersConfig_;
67 std::map<std::string, std::string> ScreenSceneConfig::stringConfig_;
68 std::map<std::string, std::vector<std::string>> ScreenSceneConfig::stringListConfig_;
69 std::map<uint64_t, std::vector<DMRect>> ScreenSceneConfig::cutoutBoundaryRectMap_;
70 std::vector<DisplayPhysicalResolution> ScreenSceneConfig::displayPhysicalResolution_;
71 std::vector<DMRect> ScreenSceneConfig::subCutoutBoundaryRect_;
72 bool ScreenSceneConfig::isWaterfallDisplay_ = false;
73 bool ScreenSceneConfig::isSupportCapture_ = false;
74 bool ScreenSceneConfig::isScreenCompressionEnableInLandscape_ = false;
75 uint32_t ScreenSceneConfig::curvedAreaInLandscape_ = 0;
76 std::map<int32_t, std::string> ScreenSceneConfig::xmlNodeMap_ = {
77 {DPI, "dpi"},
78 {SUB_DPI, "subDpi"},
79 {IS_WATERFALL_DISPLAY, "isWaterfallDisplay"},
80 {CURVED_SCREEN_BOUNDARY, "curvedScreenBoundary"},
81 {CURVED_AREA_IN_LANDSCAPE, "waterfallAreaCompressionSizeWhenHorzontal"},
82 {IS_CURVED_COMPRESS_ENABLED, "isWaterfallAreaCompressionEnableWhenHorizontal"},
83 {BUILD_IN_DEFAULT_ORIENTATION, "buildInDefaultOrientation"},
84 {DEFAULT_DEVICE_ROTATION_OFFSET, "defaultDeviceRotationOffset"},
85 {DEFAULT_DISPLAY_CUTOUT_PATH, "defaultDisplayCutoutPath"},
86 {SUB_DISPLAY_CUTOUT_PATH, "subDisplayCutoutPath"},
87 {HALL_SWITCH_APP, "hallSwitchApp"},
88 {PACKAGE_NAME, "packageName"},
89 {ROTATION_POLICY, "rotationPolicy"},
90 {DEFAULT_ROTATION_POLICY, "defaultRotationPolicy"},
91 {SCREEN_SNAPSHOT_BUNDLE_NAME, "screenSnapshotBundleName"},
92 {SCREEN_SNAPSHOT_ABILITY_NAME, "screenSnapshotAbilityName"},
93 {IS_RIGHT_POWER_BUTTON, "isRightPowerButton"},
94 {SUPPORT_ROTATE_WITH_SCREEN, "supportRotateWithSensor"},
95 {EXTERNAL_SCREEN_DEFAULT_MODE, "externalScreenDefaultMode"},
96 {CAST_BUNDLE_NAME, "castBundleName"},
97 {CAST_ABILITY_NAME, "castAbilityName"},
98 {PHYSICAL_DISPLAY_RESOLUTION, "physicalDisplayResolution"},
99 {IS_SUPPORT_CAPTURE, "isSupportCapture"}
100 };
101
102
Split(std::string str,std::string pattern)103 std::vector<std::string> ScreenSceneConfig::Split(std::string str, std::string pattern)
104 {
105 std::vector<std::string> result;
106 str += pattern;
107 int32_t length = static_cast<int32_t>(str.size());
108 for (int32_t i = 0; i < length; i++) {
109 int32_t position = static_cast<int32_t>(str.find(pattern, i));
110 if (position < length) {
111 std::string tmp = str.substr(i, position - i);
112 result.push_back(tmp);
113 i = position + static_cast<int32_t>(pattern.size()) - 1;
114 }
115 }
116 return result;
117 }
118
IsNumber(std::string str)119 bool ScreenSceneConfig::IsNumber(std::string str)
120 {
121 if (str.size() == 0) {
122 return false;
123 }
124 for (int32_t i = 0; i < static_cast<int32_t>(str.size()); i++) {
125 if (str.at(i) < '0' || str.at(i) > '9') {
126 return false;
127 }
128 }
129 return true;
130 }
131
GetConfigPath(const std::string & configFileName)132 std::string ScreenSceneConfig::GetConfigPath(const std::string& configFileName)
133 {
134 char buf[PATH_MAX + 1];
135 char* configPath = GetOneCfgFile(configFileName.c_str(), buf, PATH_MAX + 1);
136 char tmpPath[PATH_MAX + 1] = { 0 };
137 if (!configPath || strlen(configPath) == 0 || strlen(configPath) > PATH_MAX || !realpath(configPath, tmpPath)) {
138 TLOGI(WmsLogTag::DMS, "[SsConfig] can not get customization config file");
139 return "/system/" + configFileName;
140 }
141 return std::string(tmpPath);
142 }
143
LoadConfigXml()144 bool ScreenSceneConfig::LoadConfigXml()
145 {
146 auto configFilePath = GetConfigPath("etc/window/resources/display_manager_config.xml");
147 xmlDocPtr docPtr = nullptr;
148 {
149 std::lock_guard<std::recursive_mutex> lock(mutex_);
150 docPtr = xmlReadFile(configFilePath.c_str(), nullptr, XML_PARSE_NOBLANKS);
151 }
152 TLOGI(WmsLogTag::DMS, "[SsConfig] filePath: %{public}s", configFilePath.c_str());
153 if (docPtr == nullptr) {
154 TLOGE(WmsLogTag::DMS, "[SsConfig] load xml error!");
155 return false;
156 }
157 xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
158 if (rootPtr == nullptr || rootPtr->name == nullptr ||
159 xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
160 TLOGE(WmsLogTag::DMS, "[SsConfig] get root element failed!");
161 xmlFreeDoc(docPtr);
162 return false;
163 }
164 for (xmlNodePtr curNodePtr = rootPtr->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
165 if (!IsValidNode(*curNodePtr)) {
166 TLOGE(WmsLogTag::DMS, "SsConfig]: invalid node!");
167 continue;
168 }
169 ParseNodeConfig(curNodePtr);
170 }
171 xmlFreeDoc(docPtr);
172 return true;
173 }
174
ParseNodeConfig(const xmlNodePtr & currNode)175 void ScreenSceneConfig::ParseNodeConfig(const xmlNodePtr& currNode)
176 {
177 std::string nodeName(reinterpret_cast<const char*>(currNode->name));
178 bool enableConfigCheck = (xmlNodeMap_[IS_WATERFALL_DISPLAY] == nodeName) ||
179 (xmlNodeMap_[IS_CURVED_COMPRESS_ENABLED] == nodeName) ||
180 (xmlNodeMap_[IS_RIGHT_POWER_BUTTON] == nodeName) ||
181 (xmlNodeMap_[IS_SUPPORT_CAPTURE] == nodeName) ||
182 (xmlNodeMap_[SUPPORT_ROTATE_WITH_SCREEN] == nodeName);
183 bool numberConfigCheck = (xmlNodeMap_[DPI] == nodeName) ||
184 (xmlNodeMap_[SUB_DPI] == nodeName) ||
185 (xmlNodeMap_[CURVED_SCREEN_BOUNDARY] == nodeName) ||
186 (xmlNodeMap_[CURVED_AREA_IN_LANDSCAPE] == nodeName) ||
187 (xmlNodeMap_[BUILD_IN_DEFAULT_ORIENTATION] == nodeName) ||
188 (xmlNodeMap_[DEFAULT_DEVICE_ROTATION_OFFSET] == nodeName);
189 bool stringConfigCheck = (xmlNodeMap_[DEFAULT_DISPLAY_CUTOUT_PATH] == nodeName) ||
190 (xmlNodeMap_[SUB_DISPLAY_CUTOUT_PATH] == nodeName) ||
191 (xmlNodeMap_[ROTATION_POLICY] == nodeName) ||
192 (xmlNodeMap_[DEFAULT_ROTATION_POLICY] == nodeName) ||
193 (xmlNodeMap_[SCREEN_SNAPSHOT_BUNDLE_NAME] == nodeName) ||
194 (xmlNodeMap_[SCREEN_SNAPSHOT_ABILITY_NAME] == nodeName) ||
195 (xmlNodeMap_[EXTERNAL_SCREEN_DEFAULT_MODE] == nodeName) ||
196 (xmlNodeMap_[CAST_BUNDLE_NAME] == nodeName) ||
197 (xmlNodeMap_[CAST_ABILITY_NAME] == nodeName);
198 if (enableConfigCheck) {
199 ReadEnableConfigInfo(currNode);
200 } else if (numberConfigCheck) {
201 ReadIntNumbersConfigInfo(currNode);
202 } else if (stringConfigCheck) {
203 ReadStringConfigInfo(currNode);
204 } else if (xmlNodeMap_[HALL_SWITCH_APP] == nodeName) {
205 ReadStringListConfigInfo(currNode, nodeName);
206 } else if (xmlNodeMap_[PHYSICAL_DISPLAY_RESOLUTION] == nodeName) {
207 ReadPhysicalDisplayConfigInfo(currNode);
208 } else {
209 TLOGI(WmsLogTag::DMS, "xml config node name is not match, nodeName:%{public}s", nodeName.c_str());
210 }
211 }
212
IsValidNode(const xmlNode & currNode)213 bool ScreenSceneConfig::IsValidNode(const xmlNode& currNode)
214 {
215 if (currNode.name == nullptr || currNode.type == XML_COMMENT_NODE) {
216 return false;
217 }
218 return true;
219 }
220
ReadIntNumbersConfigInfo(const xmlNodePtr & currNode)221 void ScreenSceneConfig::ReadIntNumbersConfigInfo(const xmlNodePtr& currNode)
222 {
223 xmlChar* context = xmlNodeGetContent(currNode);
224 if (context == nullptr) {
225 TLOGE(WmsLogTag::DMS, "[SsConfig] read xml node error: nodeName:(%{public}s)", currNode->name);
226 return;
227 }
228
229 std::vector<int> numbersVec;
230 std::string numbersStr = reinterpret_cast<const char*>(context);
231 if (numbersStr.empty()) {
232 xmlFree(context);
233 return;
234 }
235 auto numbers = Split(numbersStr, " ");
236 for (auto& num : numbers) {
237 if (!IsNumber(num)) {
238 TLOGE(WmsLogTag::DMS, "[SsConfig] read number error: nodeName:(%{public}s)", currNode->name);
239 xmlFree(context);
240 return;
241 }
242 numbersVec.emplace_back(std::stoi(num));
243 }
244
245 std::string nodeName = reinterpret_cast<const char *>(currNode->name);
246 intNumbersConfig_[nodeName] = numbersVec;
247 xmlFree(context);
248 }
249
ReadPhysicalDisplayConfigInfo(const xmlNodePtr & currNode)250 void ScreenSceneConfig::ReadPhysicalDisplayConfigInfo(const xmlNodePtr& currNode)
251 {
252 xmlChar* displayMode = xmlGetProp(currNode, reinterpret_cast<const xmlChar*>("displayMode"));
253 if (displayMode == nullptr) {
254 TLOGE(WmsLogTag::DMS, "[SsConfig] read xml node error: nodeName:(%{public}s)", currNode->name);
255 return;
256 }
257 xmlChar* displayModeContext = xmlNodeGetContent(currNode);
258 if (displayModeContext == nullptr) {
259 TLOGE(WmsLogTag::DMS, "[SsConfig] read xml nodeName:(%{public}s) context null", currNode->name);
260 xmlFree(displayMode);
261 return;
262 }
263 std::string displaySizeStr = reinterpret_cast<const char*>(displayModeContext);
264 if (displaySizeStr.empty()) {
265 xmlFree(displayModeContext);
266 xmlFree(displayMode);
267 return;
268 }
269 auto displaySizeArray = Split(displaySizeStr, ":");
270 if (displaySizeArray.size() != DISPLAY_PHYSICAL_SIZE) {
271 xmlFree(displayModeContext);
272 xmlFree(displayMode);
273 return;
274 }
275 DisplayPhysicalResolution physicalSize;
276 if (!xmlStrcmp(displayMode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_FULL"))) {
277 physicalSize.foldDisplayMode_ = FoldDisplayMode::FULL;
278 } else if (!xmlStrcmp(displayMode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_MAIN"))) {
279 physicalSize.foldDisplayMode_ = FoldDisplayMode::MAIN;
280 } else if (!xmlStrcmp(displayMode, reinterpret_cast<const xmlChar*>("FOLD_DISPLAY_MODE_SUB"))) {
281 physicalSize.foldDisplayMode_ = FoldDisplayMode::SUB;
282 } else {
283 physicalSize.foldDisplayMode_ = FoldDisplayMode::UNKNOWN;
284 }
285 if (IsNumber(displaySizeArray[0]) && IsNumber(displaySizeArray[1])) {
286 physicalSize.physicalWidth_ = static_cast<uint32_t>(std::stoi(displaySizeArray[0]));
287 physicalSize.physicalHeight_ = static_cast<uint32_t>(std::stoi(displaySizeArray[1]));
288 }
289 displayPhysicalResolution_.emplace_back(physicalSize);
290 xmlFree(displayModeContext);
291 xmlFree(displayMode);
292 }
293
GetAllDisplayPhysicalConfig()294 std::vector<DisplayPhysicalResolution> ScreenSceneConfig::GetAllDisplayPhysicalConfig()
295 {
296 return displayPhysicalResolution_;
297 }
298
ReadEnableConfigInfo(const xmlNodePtr & currNode)299 void ScreenSceneConfig::ReadEnableConfigInfo(const xmlNodePtr& currNode)
300 {
301 xmlChar* enable = xmlGetProp(currNode, reinterpret_cast<const xmlChar*>("enable"));
302 if (enable == nullptr) {
303 TLOGE(WmsLogTag::DMS, "[SsConfig] read xml node error: nodeName:(%{public}s)", currNode->name);
304 return;
305 }
306
307 std::string nodeName = reinterpret_cast<const char *>(currNode->name);
308 if (!xmlStrcmp(enable, reinterpret_cast<const xmlChar*>("true"))) {
309 enableConfig_[nodeName] = true;
310 if (xmlNodeMap_[IS_WATERFALL_DISPLAY] == nodeName) {
311 isWaterfallDisplay_ = true;
312 } else if (xmlNodeMap_[IS_CURVED_COMPRESS_ENABLED] == nodeName) {
313 isScreenCompressionEnableInLandscape_ = true;
314 } else if (xmlNodeMap_[IS_SUPPORT_CAPTURE] == nodeName) {
315 isSupportCapture_ = true;
316 }
317 } else {
318 enableConfig_[nodeName] = false;
319 }
320 xmlFree(enable);
321 }
322
ReadStringConfigInfo(const xmlNodePtr & currNode)323 void ScreenSceneConfig::ReadStringConfigInfo(const xmlNodePtr& currNode)
324 {
325 xmlChar* context = xmlNodeGetContent(currNode);
326 if (context == nullptr) {
327 TLOGE(WmsLogTag::DMS, "[SsConfig] read xml node error: nodeName:(%{public}s)", currNode->name);
328 return;
329 }
330
331 std::string inputString = reinterpret_cast<const char*>(context);
332 std::string nodeName = reinterpret_cast<const char*>(currNode->name);
333 stringConfig_[nodeName] = inputString;
334 xmlFree(context);
335 }
336
ReadStringListConfigInfo(const xmlNodePtr & rootNode,std::string name)337 void ScreenSceneConfig::ReadStringListConfigInfo(const xmlNodePtr& rootNode, std::string name)
338 {
339 if (rootNode == nullptr || rootNode->name == nullptr) {
340 TLOGE(WmsLogTag::DMS, "[SsConfig] get root element failed!");
341 return;
342 }
343 xmlChar* rootContext = xmlNodeGetContent(rootNode);
344 if (rootContext == nullptr) {
345 TLOGE(WmsLogTag::DMS, "rootContext is null");
346 return;
347 }
348 std::vector<std::string> stringVec;
349 for (xmlNodePtr curNodePtr = rootNode->xmlChildrenNode; curNodePtr != nullptr; curNodePtr = curNodePtr->next) {
350 if (!IsValidNode(*curNodePtr)) {
351 TLOGE(WmsLogTag::DMS, "SsConfig]: invalid node!");
352 continue;
353 }
354 xmlChar* context = xmlNodeGetContent(curNodePtr);
355 std::string str = reinterpret_cast<const char*>(context);
356 stringVec.emplace_back(str);
357 xmlFree(context);
358 }
359 stringListConfig_[name] = stringVec;
360 xmlFree(rootContext);
361 }
362
GetEnableConfig()363 const std::map<std::string, bool>& ScreenSceneConfig::GetEnableConfig()
364 {
365 return enableConfig_;
366 }
367
GetIntNumbersConfig()368 const std::map<std::string, std::vector<int>>& ScreenSceneConfig::GetIntNumbersConfig()
369 {
370 return intNumbersConfig_;
371 }
372
GetStringConfig()373 const std::map<std::string, std::string>& ScreenSceneConfig::GetStringConfig()
374 {
375 return stringConfig_;
376 }
377
GetStringListConfig()378 const std::map<std::string, std::vector<std::string>>& ScreenSceneConfig::GetStringListConfig()
379 {
380 return stringListConfig_;
381 }
382
DumpConfig()383 void ScreenSceneConfig::DumpConfig()
384 {
385 for (auto& enable : enableConfig_) {
386 TLOGI(WmsLogTag::DMS, "[SsConfig] Enable: %{public}s %{public}u", enable.first.c_str(), enable.second);
387 }
388 for (auto& numbers : intNumbersConfig_) {
389 TLOGI(WmsLogTag::DMS, "[SsConfig] Numbers: %{public}s %{public}zu",
390 numbers.first.c_str(), numbers.second.size());
391 for (auto& num : numbers.second) {
392 TLOGI(WmsLogTag::DMS, "[SsConfig] Num: %{public}d", num);
393 }
394 }
395 for (auto& string : stringConfig_) {
396 TLOGI(WmsLogTag::DMS, "[SsConfig] String: %{public}s", string.first.c_str());
397 }
398 }
399
SetCutoutSvgPath(uint64_t displayId,const std::string & svgPath)400 void ScreenSceneConfig::SetCutoutSvgPath(uint64_t displayId, const std::string& svgPath)
401 {
402 cutoutBoundaryRectMap_.clear();
403 cutoutBoundaryRectMap_[displayId].emplace_back(CalcCutoutBoundaryRect(svgPath));
404 }
405
SetSubCutoutSvgPath(const std::string & svgPath)406 void ScreenSceneConfig::SetSubCutoutSvgPath(const std::string& svgPath)
407 {
408 subCutoutBoundaryRect_.clear();
409 subCutoutBoundaryRect_.emplace_back(CalcCutoutBoundaryRect(svgPath));
410 }
411
CalcCutoutBoundaryRect(std::string svgPath)412 DMRect ScreenSceneConfig::CalcCutoutBoundaryRect(std::string svgPath)
413 {
414 DMRect emptyRect = { 0, 0, 0, 0 };
415 SkPath skCutoutSvgPath;
416 if (!SkParsePath::FromSVGString(svgPath.c_str(), &skCutoutSvgPath)) {
417 TLOGE(WmsLogTag::DMS, "Parse svg string path failed.");
418 return emptyRect;
419 }
420 SkRect skRect = skCutoutSvgPath.computeTightBounds();
421 if (skRect.isEmpty()) {
422 TLOGW(WmsLogTag::DMS, "Get empty skRect");
423 return emptyRect;
424 }
425 SkIRect skiRect = skRect.roundOut();
426 if (skiRect.isEmpty()) {
427 TLOGW(WmsLogTag::DMS, "Get empty skiRect");
428 return emptyRect;
429 }
430 int32_t left = static_cast<int32_t>(skiRect.left());
431 int32_t top = static_cast<int32_t>(skiRect.top());
432 uint32_t width = static_cast<uint32_t>(skiRect.width());
433 uint32_t height = static_cast<uint32_t>(skiRect.height());
434 TLOGI(WmsLogTag::DMS,
435 "calc cutout boundary rect - left: [%{public}d top: %{public}d width: %{public}u height: %{public}u]",
436 left, top, width, height);
437 DMRect cutoutMinOuterRect = {
438 .posX_ = left,
439 .posY_ = top,
440 .width_ = width,
441 .height_ = height
442 };
443 return cutoutMinOuterRect;
444 }
445
GetCutoutBoundaryRect(uint64_t displayId)446 std::vector<DMRect> ScreenSceneConfig::GetCutoutBoundaryRect(uint64_t displayId)
447 {
448 if (cutoutBoundaryRectMap_.count(displayId) == 0) {
449 return {};
450 }
451 return cutoutBoundaryRectMap_[displayId];
452 }
453
GetSubCutoutBoundaryRect()454 std::vector<DMRect> ScreenSceneConfig::GetSubCutoutBoundaryRect()
455 {
456 return subCutoutBoundaryRect_;
457 }
458
IsWaterfallDisplay()459 bool ScreenSceneConfig::IsWaterfallDisplay()
460 {
461 return isWaterfallDisplay_;
462 }
463
IsSupportCapture()464 bool ScreenSceneConfig::IsSupportCapture()
465 {
466 return isSupportCapture_;
467 }
468
SetCurvedCompressionAreaInLandscape()469 void ScreenSceneConfig::SetCurvedCompressionAreaInLandscape()
470 {
471 if (intNumbersConfig_[xmlNodeMap_[CURVED_AREA_IN_LANDSCAPE]].size() > 0) {
472 curvedAreaInLandscape_ = static_cast<uint32_t>(intNumbersConfig_[xmlNodeMap_[CURVED_AREA_IN_LANDSCAPE]][0]);
473 } else {
474 TLOGW(WmsLogTag::DMS, "waterfallAreaCompressionSizeWhenHorzontal value is not exist");
475 }
476 }
477
GetCurvedScreenBoundaryConfig()478 std::vector<int> ScreenSceneConfig::GetCurvedScreenBoundaryConfig()
479 {
480 return intNumbersConfig_[xmlNodeMap_[CURVED_SCREEN_BOUNDARY]];
481 }
482
GetCurvedCompressionAreaInLandscape()483 uint32_t ScreenSceneConfig::GetCurvedCompressionAreaInLandscape()
484 {
485 if (!isWaterfallDisplay_ || !isScreenCompressionEnableInLandscape_) {
486 TLOGW(WmsLogTag::DMS, "not waterfall screen or waterfall compression is not enabled");
487 return NO_WATERFALL_DISPLAY_COMPRESSION_SIZE;
488 }
489 return curvedAreaInLandscape_;
490 }
491
IsSupportRotateWithSensor()492 bool ScreenSceneConfig::IsSupportRotateWithSensor()
493 {
494 if (enableConfig_.count("supportRotateWithSensor") != 0) {
495 return static_cast<bool>(enableConfig_["supportRotateWithSensor"]);
496 }
497 return false;
498 }
GetExternalScreenDefaultMode()499 std::string ScreenSceneConfig::GetExternalScreenDefaultMode()
500 {
501 if (stringConfig_.count("externalScreenDefaultMode") != 0) {
502 return static_cast<std::string>(stringConfig_["externalScreenDefaultMode"]);
503 }
504 return "";
505 }
506
507 } // namespace OHOS::Rosen
508