已合并
重启过程中,开机动画位置偏移 #18544
wang_Q_Q创建于 3月25日
重启过程中,开机动画位置偏移 #18544
已合并
共 5 个文件变更+39-9
| @@ -84,6 +84,7 @@ public: | |||
| 84 | static RogResolution GetRogResolution(uint32_t width, uint32_t height); | 84 | static RogResolution GetRogResolution(uint32_t width, uint32_t height); |
| 85 | static uint64_t GetUptimeSeconds(); | 85 | static uint64_t GetUptimeSeconds(); |
| 86 | static uint64_t GetBootTimeThreshold(); | 86 | static uint64_t GetBootTimeThreshold(); |
| 87 | + static void SetRogResolution(const RogResolution& rogResolution); | ||
| 87 | 88 | ||
| 88 | private: | 89 | private: |
| 89 | static std::map<int32_t, std::string> xmlNodeMap_; | 90 | static std::map<int32_t, std::string> xmlNodeMap_; |
| @@ -126,7 +127,6 @@ private: | |||
| 126 | static void ParseDisplaysConfig(const xmlNodePtr& currPtr); | 127 | static void ParseDisplaysConfig(const xmlNodePtr& currPtr); |
| 127 | static bool ParseFlagsConfig(const xmlNodePtr& flagsNode, DisplayFlag& outFlags); | 128 | static bool ParseFlagsConfig(const xmlNodePtr& flagsNode, DisplayFlag& outFlags); |
| 128 | static void ReadRogResolutionConfigInfo(const xmlNodePtr& currNode); | 129 | static void ReadRogResolutionConfigInfo(const xmlNodePtr& currNode); |
| 129 | - static void SetRogResolution(const RogResolution rogResolution); | ||
| 130 | }; | 130 | }; |
| 131 | } // namespace OHOS::Rosen | 131 | } // namespace OHOS::Rosen |
| 132 | 132 | ||
| @@ -1075,6 +1075,7 @@ private: | |||
| 1075 | 1075 | ||
| 1076 | // Fold Screen | 1076 | // Fold Screen |
| 1077 | static void BootFinishedCallback(const char *key, const char *value, void *context); | 1077 | static void BootFinishedCallback(const char *key, const char *value, void *context); |
| 1078 | + static void BootAnimateFinishedCallback(const char *key, const char *value, void *context); | ||
| 1078 | std::function<void()> foldScreenPowerInit_ = nullptr; | 1079 | std::function<void()> foldScreenPowerInit_ = nullptr; |
| 1079 | void HandleFoldScreenPowerInit(); | 1080 | void HandleFoldScreenPowerInit(); |
| 1080 | void SetFoldScreenPowerInit(std::function<void()> foldScreenPowerInit); | 1081 | void SetFoldScreenPowerInit(std::function<void()> foldScreenPowerInit); |
| @@ -556,7 +556,7 @@ uint64_t ScreenSceneConfig::GetUptimeSeconds() | |||
| 556 | return static_cast<uint64_t>(ts.tv_sec); | 556 | return static_cast<uint64_t>(ts.tv_sec); |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | -void ScreenSceneConfig::SetRogResolution(const RogResolution rogResolution) | 559 | +void ScreenSceneConfig::SetRogResolution(const RogResolution& rogResolution) |
| 560 | { | 560 | { |
| 561 | rogResolution_ = rogResolution; | 561 | rogResolution_ = rogResolution; |
| 562 | } | 562 | } |
| @@ -106,6 +106,7 @@ const std::string SCREEN_CAPTURE_PERMISSION = "ohos.permission.CAPTURE_SCREEN"; | |||
| 106 | const std::string CUSTOM_SCREEN_CAPTURE_PERMISSION = "ohos.permission.CUSTOM_SCREEN_CAPTURE"; | 106 | const std::string CUSTOM_SCREEN_CAPTURE_PERMISSION = "ohos.permission.CUSTOM_SCREEN_CAPTURE"; |
| 107 | const std::string CUSTOM_SCREEN_RECORDING_PERMISSION = "ohos.permission.CUSTOM_SCREEN_RECORDING"; | 107 | const std::string CUSTOM_SCREEN_RECORDING_PERMISSION = "ohos.permission.CUSTOM_SCREEN_RECORDING"; |
| 108 | const std::string BOOTEVENT_BOOT_COMPLETED = "bootevent.boot.completed"; | 108 | const std::string BOOTEVENT_BOOT_COMPLETED = "bootevent.boot.completed"; |
| 109 | +const std::string BOOT_ANIMATION_FINISHED = "bootevent.bootanimation.finished"; | ||
| 109 | const std::string ACCESS_VIRTUAL_SCREEN_PERMISSION = "ohos.permission.ACCESS_VIRTUAL_SCREEN"; | 110 | const std::string ACCESS_VIRTUAL_SCREEN_PERMISSION = "ohos.permission.ACCESS_VIRTUAL_SCREEN"; |
| 110 | const std::string IS_PC_MODE_KEY = "persist.sceneboard.ispcmode"; | 111 | const std::string IS_PC_MODE_KEY = "persist.sceneboard.ispcmode"; |
| 111 | const std::string PC_MODE_DPI_KEY = "pcModeDpi"; | 112 | const std::string PC_MODE_DPI_KEY = "pcModeDpi"; |
| @@ -389,6 +390,7 @@ ScreenSessionManager::ScreenSessionManager() | |||
| 389 | SetFirstSCBConnect(true); | 390 | SetFirstSCBConnect(true); |
| 390 | SetOnBootAnimation(true); | 391 | SetOnBootAnimation(true); |
| 391 | WatchParameter(BOOTEVENT_BOOT_COMPLETED.c_str(), BootFinishedCallback, this); | 392 | WatchParameter(BOOTEVENT_BOOT_COMPLETED.c_str(), BootFinishedCallback, this); |
| 393 | + WatchParameter(BOOT_ANIMATION_FINISHED.c_str(), BootAnimateFinishedCallback, this); | ||
| 392 | isSupportCapture_ = IsSupportCapture(); | 394 | isSupportCapture_ = IsSupportCapture(); |
| 393 | if (SUPPORT_COMPATIBLE_MODE) { | 395 | if (SUPPORT_COMPATIBLE_MODE) { |
| 394 | InitExtendScreenDpiOptions(); | 396 | InitExtendScreenDpiOptions(); |
| @@ -3667,6 +3669,8 @@ DMError ScreenSessionManager::SetResolution(ScreenId screenId, uint32_t width, u | |||
| 3667 | NotifyScreenChanged(screenInfo, ScreenChangeEvent::CHANGE_MODE); | 3669 | NotifyScreenChanged(screenInfo, ScreenChangeEvent::CHANGE_MODE); |
| 3668 | NotifyDisplayStateChange(screenId, displayInfo, emptyMap, DisplayStateChangeType::RESOLUTION_CHANGE); | 3670 | NotifyDisplayStateChange(screenId, displayInfo, emptyMap, DisplayStateChangeType::RESOLUTION_CHANGE); |
| 3669 | screenSession->PropertyChange(screenSession->GetScreenProperty(), ScreenPropertyChangeReason::CHANGE_MODE); | 3671 | screenSession->PropertyChange(screenSession->GetScreenProperty(), ScreenPropertyChangeReason::CHANGE_MODE); |
| 3672 | + ScreenSceneConfig::SetRogResolution(RogResolution{ true, false, 0, virtualPixelRatio, width, height }); | ||
| 3673 | + SetRogParameter(width, height, virtualPixelRatio, 1); | ||
| 3670 | // unfreeze screen when system boot completed | 3674 | // unfreeze screen when system boot completed |
| 3671 | WatchParameter(BOOTEVENT_BOOT_COMPLETED.c_str(), BootFinishedUnfreezeCallback, this); | 3675 | WatchParameter(BOOTEVENT_BOOT_COMPLETED.c_str(), BootFinishedUnfreezeCallback, this); |
| 3672 | // add asyc task to judge when to unfreeze screen | 3676 | // add asyc task to judge when to unfreeze screen |
| @@ -4725,12 +4729,6 @@ sptr<ScreenSession> ScreenSessionManager::GetOrCreateScreenSession(ScreenId scre | |||
| 4725 | RogResolution rogSize = ScreenSceneConfig::GetRogResolution(property.GetPhyBounds().rect_.GetWidth(), | 4729 | RogResolution rogSize = ScreenSceneConfig::GetRogResolution(property.GetPhyBounds().rect_.GetWidth(), |
| 4726 | property.GetPhyBounds().rect_.GetHeight()); | 4730 | property.GetPhyBounds().rect_.GetHeight()); |
| 4727 | if (rogSize.isSupportRog) { | 4731 | if (rogSize.isSupportRog) { |
| 4728 | - if (rsInterface_.SetRogScreenResolution(screenId, rogSize.width, rogSize.height) != 0) { | ||
| 4729 | - TLOGNFE(WmsLogTag::DMS, "Failed to SetRogScreenResolution, retry setRog"); | ||
| 4730 | - if (rsInterface_.SetRogScreenResolution(screenId, rogSize.width, rogSize.height) != 0) { | ||
| 4731 | - TLOGNFE(WmsLogTag::DMS, "retry setRog failed"); | ||
| 4732 | - } | ||
| 4733 | - } | ||
| 4734 | float rogScaleRatio = rogDpi_ / densityDpi_; | 4732 | float rogScaleRatio = rogDpi_ / densityDpi_; |
| 4735 | TLOGNFI(WmsLogTag::DMS, "rogDpi_: %{public}f, densityDpi_: %{public}f, rogScaleRatio: %{public}f", rogDpi_, densityDpi_, rogScaleRatio); | 4733 | TLOGNFI(WmsLogTag::DMS, "rogDpi_: %{public}f, densityDpi_: %{public}f, rogScaleRatio: %{public}f", rogDpi_, densityDpi_, rogScaleRatio); |
| 4736 | session->SetVprScaleRatio(rogScaleRatio); | 4734 | session->SetVprScaleRatio(rogScaleRatio); |
| @@ -6090,10 +6088,36 @@ void ScreenSessionManager::UnregisterInHandlerSensorWithPowerOff(PowerStateChang | |||
| 6090 | 6088 | ||
| 6091 | } | 6089 | } |
| 6092 | 6090 | ||
| 6091 | +void ScreenSessionManager::BootAnimateFinishedCallback(const char *key, const char *value, void *context) | ||
| 6092 | +{ | ||
| 6093 | + if (strcmp(key, BOOT_ANIMATION_FINISHED.c_str()) == 0 && strcmp(value, "true") == 0) { | ||
| 6094 | + TLOGNFI(WmsLogTag::DMS, "boot animation finished"); | ||
| 6095 | + auto& that = *reinterpret_cast<ScreenSessionManager*>(context); | ||
| 6096 | + auto screenSession = that.GetDefaultScreenSession(); | ||
| 6097 | + if (screenSession == nullptr) { | ||
| 6098 | + TLOGNFE(WmsLogTag::DMS, "screen session is null!"); | ||
| 6099 | + return; | ||
| 6100 | + } | ||
| 6101 | + ScreenId screenId = screenSession->GetScreenId(); | ||
| 6102 | + RogResolution rogSize = ScreenSceneConfig::GetRogResolution(0, 0); | ||
| 6103 | + if (rogSize.isSupportRog) { | ||
| 6104 | + TLOGNFI(WmsLogTag::DMS, "SetRogScreenResolution while BootFinish"); | ||
| 6105 | + auto res = RSInterfaces::GetInstance().SetRogScreenResolution(screenId, rogSize.width, rogSize.height); | ||
| 6106 | + if (res != 0) { | ||
| 6107 | + TLOGNFE(WmsLogTag::DMS, "Failed to SetRogScreenResolution BootFinish, errorCode::%{public}d", res); | ||
| 6108 | + } else { | ||
| 6109 | + TLOGNFI(WmsLogTag::DMS, "SetRogScreenResolution BootFinish success"); | ||
| 6110 | + } | ||
| 6111 | + } else { | ||
| 6112 | + TLOGNFI(WmsLogTag::DMS, "not support rog"); | ||
| 6113 | + } | ||
| 6114 | + } | ||
| 6115 | +} | ||
| 6116 | + | ||
| 6093 | void ScreenSessionManager::BootFinishedCallback(const char *key, const char *value, void *context) | 6117 | void ScreenSessionManager::BootFinishedCallback(const char *key, const char *value, void *context) |
| 6094 | { | 6118 | { |
| 6095 | if (strcmp(key, BOOTEVENT_BOOT_COMPLETED.c_str()) == 0 && strcmp(value, "true") == 0) { | 6119 | if (strcmp(key, BOOTEVENT_BOOT_COMPLETED.c_str()) == 0 && strcmp(value, "true") == 0) { |
| 6096 | - TLOGNFI(WmsLogTag::DMS, "boot animation finished"); | 6120 | + TLOGNFI(WmsLogTag::DMS, "boot animation completed"); |
| 6097 | auto &that = *reinterpret_cast<ScreenSessionManager *>(context); | 6121 | auto &that = *reinterpret_cast<ScreenSessionManager *>(context); |
| 6098 | that.SetRotateLockedFromSettingData(); | 6122 | that.SetRotateLockedFromSettingData(); |
| 6099 | that.SetDpiFromSettingData(); | 6123 | that.SetDpiFromSettingData(); |
| @@ -338,6 +338,11 @@ bool ScreenSceneConfig::IsConcurrentUser() | |||
| 338 | } | 338 | } |
| 339 | // LCOV_EXCL_STOP | 339 | // LCOV_EXCL_STOP |
| 340 | 340 | ||
| 341 | +void ScreenSceneConfig::SetRogResolution(const RogResolution& rogResolution) | ||
| 342 | +{ | ||
| 343 | + rogResolution_ = rogResolution; | ||
| 344 | +} | ||
| 345 | + | ||
| 341 | uint32_t ScreenSceneConfig::GetNumberConfigValue(const std::string& name, const uint32_t& default_value) | 346 | uint32_t ScreenSceneConfig::GetNumberConfigValue(const std::string& name, const uint32_t& default_value) |
| 342 | { | 347 | { |
| 343 | if (intNumbersConfig_.count(name) != 0) { | 348 | if (intNumbersConfig_.count(name) != 0) { |