已合并
双屏同显ready等待 #17598
Rok_100创建于 1月16日
双屏同显ready等待 #17598
已合并
共 9 个文件变更+380-8
| @@ -480,7 +480,11 @@ public: | |||
| 480 | void OnFoldScreenChange(sptr<ScreenSession>& screenSession); | 480 | void OnFoldScreenChange(sptr<ScreenSession>& screenSession); |
| 481 | void OnFoldStatusChange(bool isSwitching); | 481 | void OnFoldStatusChange(bool isSwitching); |
| 482 | void SetCoordinationFlag(bool isCoordinationFlag); | 482 | void SetCoordinationFlag(bool isCoordinationFlag); |
| 483 | - bool GetCoordinationFlag(void); | 483 | + bool GetCoordinationFlag(); |
| 484 | + void WaitForCoordinationReady(); | ||
| 485 | + void SetWaitingForCoordinationReady(bool isWaitingForCoordinationReady); | ||
| 486 | + bool GetWaitingForCoordinationReady() const; | ||
| 487 | + void NotifyCoordinationReadyCV(); | ||
| 484 | DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate, | 488 | DMError SetVirtualScreenMaxRefreshRate(ScreenId id, uint32_t refreshRate, |
| 485 | uint32_t& actualRefreshRate) override; | 489 | uint32_t& actualRefreshRate) override; |
| 486 | void OnScreenModeChange(ScreenModeChangeEvent screenModeChangeEvent) override; | 490 | void OnScreenModeChange(ScreenModeChangeEvent screenModeChangeEvent) override; |
| @@ -1062,6 +1066,8 @@ private: | |||
| 1062 | void HandleScreenRotationAndBoundsWhenSetClient(sptr<ScreenSession>& screenSession); | 1066 | void HandleScreenRotationAndBoundsWhenSetClient(sptr<ScreenSession>& screenSession); |
| 1063 | void HandleFoldDeviceScreenConnect(ScreenId screenId, const sptr<ScreenSession>& screenSession, | 1067 | void HandleFoldDeviceScreenConnect(ScreenId screenId, const sptr<ScreenSession>& screenSession, |
| 1064 | bool phyMirrorEnable, ScreenEvent screenEvent); | 1068 | bool phyMirrorEnable, ScreenEvent screenEvent); |
| 1069 | + void RegisterSettingCoordinationReadyObserver(); | ||
| 1070 | + void UpdateCoordinationReadyFromSettingData(); | ||
| 1065 | 1071 | ||
| 1066 | LowTempMode lowTemp_ {LowTempMode::UNKNOWN}; | 1072 | LowTempMode lowTemp_ {LowTempMode::UNKNOWN}; |
| 1067 | std::mutex lowTempMutex_; | 1073 | std::mutex lowTempMutex_; |
| @@ -1070,6 +1076,11 @@ private: | |||
| 1070 | std::unordered_map<FoldDisplayMode, int32_t> rotationCorrectionMap_; | 1076 | std::unordered_map<FoldDisplayMode, int32_t> rotationCorrectionMap_; |
| 1071 | std::shared_mutex rotationCorrectionMutex_; | 1077 | std::shared_mutex rotationCorrectionMutex_; |
| 1072 | std::atomic<bool> firstSCBConnect_ = false; | 1078 | std::atomic<bool> firstSCBConnect_ = false; |
| 1079 | + std::atomic<bool> isCoordinationReady_ = false; | ||
| 1080 | + std::mutex coordinationReadyMutex_; | ||
| 1081 | + std::condition_variable coordinationReadyCV_; | ||
| 1082 | + std::atomic<bool> isWaitingForCoordinationReady_ = false; | ||
| 1083 | + std::atomic<int32_t> waitCoordinationReadyMaxTime_ = 1500; // ms | ||
| 1073 | 1084 | ||
| 1074 | // Fold Screen duringcall | 1085 | // Fold Screen duringcall |
| 1075 | bool duringCallState_ = false; | 1086 | bool duringCallState_ = false; |
| @@ -40,6 +40,7 @@ public: | |||
| 40 | static bool SetSettingValue(const std::string& key, uint32_t value); | 40 | static bool SetSettingValue(const std::string& key, uint32_t value); |
| 41 | static bool GetSettingValue(const std::string& key, std::string& value); | 41 | static bool GetSettingValue(const std::string& key, std::string& value); |
| 42 | static bool SetSettingValue(const std::string& key, const std::string& value); | 42 | static bool SetSettingValue(const std::string& key, const std::string& value); |
| 43 | + static bool GetSettingValue(const std::string& key, bool& value); | ||
| 43 | static void RegisterSettingCastObserver(SettingObserver::UpdateFunc func); | 44 | static void RegisterSettingCastObserver(SettingObserver::UpdateFunc func); |
| 44 | static void UnregisterSettingCastObserver(); | 45 | static void UnregisterSettingCastObserver(); |
| 45 | static bool GetSettingCast(bool& enable, const std::string& key = SETTING_CAST_KEY); | 46 | static bool GetSettingCast(bool& enable, const std::string& key = SETTING_CAST_KEY); |
| @@ -86,6 +87,10 @@ public: | |||
| 86 | const std::string& key = SETTING_COMPATIBLE_APP_STRATEGY_KEY); | 87 | const std::string& key = SETTING_COMPATIBLE_APP_STRATEGY_KEY); |
| 87 | static void GetCorrectionExemptionListFromJson(const std::string& exemptionListJsonStr, | 88 | static void GetCorrectionExemptionListFromJson(const std::string& exemptionListJsonStr, |
| 88 | std::vector<std::string>& exemptionApps); | 89 | std::vector<std::string>& exemptionApps); |
| 90 | + static void RegisterSettingCoordinationReadyObserver(SettingObserver::UpdateFunc func); | ||
| 91 | + static void UnregisterSettingCoordinationReadyObserver(); | ||
| 92 | + static bool GetSettingIsCoordinationReady(bool& isCoordinationReady, | ||
| 93 | + const std::string& key = SETTING_DUAL_DISPLAY_READY_KEY); | ||
| 89 | template<typename T> | 94 | template<typename T> |
| 90 | static bool GetJsonValue(const nlohmann::json& payload, const std::string& key, T& result) | 95 | static bool GetJsonValue(const nlohmann::json& payload, const std::string& key, T& result) |
| 91 | { | 96 | { |
| @@ -122,6 +127,7 @@ private: | |||
| 122 | static const constexpr char* SETTING_COMPATIBLE_APP_STRATEGY_KEY {"COMPATIBLE_APP_STRATEGY"}; | 127 | static const constexpr char* SETTING_COMPATIBLE_APP_STRATEGY_KEY {"COMPATIBLE_APP_STRATEGY"}; |
| 123 | static const constexpr char* SETTING_SCREEN_RESOLUTION_MODE_KEY {"user_set_resolution_mode"}; | 128 | static const constexpr char* SETTING_SCREEN_RESOLUTION_MODE_KEY {"user_set_resolution_mode"}; |
| 124 | static const constexpr char* SETTING_SCREEN_BORDERING_AREA_PERCENT_KEY {"bordering_area_percent"}; | 129 | static const constexpr char* SETTING_SCREEN_BORDERING_AREA_PERCENT_KEY {"bordering_area_percent"}; |
| 130 | + static const constexpr char* SETTING_DUAL_DISPLAY_READY_KEY {"settings.display.dual_display_ready"}; | ||
| 125 | static const constexpr uint32_t BASE_TEN = 10; | 131 | static const constexpr uint32_t BASE_TEN = 10; |
| 126 | static sptr<SettingObserver> dpiObserver_; | 132 | static sptr<SettingObserver> dpiObserver_; |
| 127 | static sptr<SettingObserver> castObserver_; | 133 | static sptr<SettingObserver> castObserver_; |
| @@ -132,6 +138,7 @@ private: | |||
| 132 | static sptr<SettingObserver> resolutionEffectObserver_; | 138 | static sptr<SettingObserver> resolutionEffectObserver_; |
| 133 | static sptr<SettingObserver> correctionExemptionListObserver_; | 139 | static sptr<SettingObserver> correctionExemptionListObserver_; |
| 134 | static sptr<SettingObserver> borderingAreaPercentObserver_; | 140 | static sptr<SettingObserver> borderingAreaPercentObserver_; |
| 141 | + static sptr<SettingObserver> coordinationReadyObserver_; | ||
| 135 | }; | 142 | }; |
| 136 | } // namespace Rosen | 143 | } // namespace Rosen |
| 137 | } // namespace OHOS | 144 | } // namespace OHOS |
| @@ -209,6 +209,18 @@ void FoldScreenBasePolicy::ChangeOffTentMode() | |||
| 209 | TLOGI(WmsLogTag::DMS, "change displaymode to coordination current mode=%{public}d", currentDisplayMode_); | 209 | TLOGI(WmsLogTag::DMS, "change displaymode to coordination current mode=%{public}d", currentDisplayMode_); |
| 210 | ScreenSessionManager::GetInstance().NotifyRSCoordination(true); | 210 | ScreenSessionManager::GetInstance().NotifyRSCoordination(true); |
| 211 | ScreenSessionManager::GetInstance().SetCoordinationFlag(true); | 211 | ScreenSessionManager::GetInstance().SetCoordinationFlag(true); |
| 212 | + | ||
| 213 | + // wait for coordination ready | ||
| 214 | + if (ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()) { | ||
| 215 | + TLOGI(WmsLogTag::DMS, "EnterCoordination skipped, is waiting for coordination ready"); | ||
| 216 | + return; | ||
| 217 | + } | ||
| 218 | + ScreenSessionManager::GetInstance().WaitForCoordinationReady(); | ||
| 219 | + if (!ScreenSessionManager::GetInstance().GetCoordinationFlag()) { | ||
| 220 | + TLOGW(WmsLogTag::DMS, "EnterCoordination skipped, current coordination flag is false"); | ||
| 221 | + return; | ||
| 222 | + } | ||
| 223 | + | ||
| 212 | ScreenSessionManager::GetInstance().OnScreenChange(SCREEN_ID_MAIN, ScreenEvent::CONNECTED); | 224 | ScreenSessionManager::GetInstance().OnScreenChange(SCREEN_ID_MAIN, ScreenEvent::CONNECTED); |
| 213 | 225 | ||
| 214 | // on main screen | 226 | // on main screen |
| @@ -234,6 +246,14 @@ void FoldScreenBasePolicy::CloseCoordinationScreen() | |||
| 234 | } | 246 | } |
| 235 | TLOGI(WmsLogTag::DMS, "Close Coordination Screen current mode=%{public}d", currentDisplayMode_); | 247 | TLOGI(WmsLogTag::DMS, "Close Coordination Screen current mode=%{public}d", currentDisplayMode_); |
| 236 | ScreenSessionManager::GetInstance().NotifyRSCoordination(false); | 248 | ScreenSessionManager::GetInstance().NotifyRSCoordination(false); |
| 249 | + | ||
| 250 | + if (ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()) { | ||
| 251 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(false); | ||
| 252 | + ScreenSessionManager::GetInstance().NotifyCoordinationReadyCV(); | ||
| 253 | + TLOGI(WmsLogTag::DMS, "CloseCoordinationScreen skipped, is waiting for coordination ready"); | ||
| 254 | + return; | ||
| 255 | + } | ||
| 256 | + | ||
| 237 | // on main screen | 257 | // on main screen |
| 238 | auto taskScreenOnMainOFF = [=] { | 258 | auto taskScreenOnMainOFF = [=] { |
| 239 | TLOGNI(WmsLogTag::DMS, "CloseCoordinationScreen: screenIdMain OFF."); | 259 | TLOGNI(WmsLogTag::DMS, "CloseCoordinationScreen: screenIdMain OFF."); |
| @@ -258,6 +278,12 @@ void FoldScreenBasePolicy::ExitCoordination() | |||
| 258 | return; | 278 | return; |
| 259 | } | 279 | } |
| 260 | ScreenSessionManager::GetInstance().NotifyRSCoordination(false); | 280 | ScreenSessionManager::GetInstance().NotifyRSCoordination(false); |
| 281 | + if (ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()) { | ||
| 282 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(false); | ||
| 283 | + ScreenSessionManager::GetInstance().NotifyCoordinationReadyCV(); | ||
| 284 | + TLOGI(WmsLogTag::DMS, "ExitCoordination skipped, is waiting for coordination ready"); | ||
| 285 | + return; | ||
| 286 | + } | ||
| 261 | ScreenSessionManager::GetInstance().SetKeyguardDrawnDoneFlag(false); | 287 | ScreenSessionManager::GetInstance().SetKeyguardDrawnDoneFlag(false); |
| 262 | ScreenSessionManager::GetInstance().SetRSScreenPowerStatusExt(SCREEN_ID_MAIN, | 288 | ScreenSessionManager::GetInstance().SetRSScreenPowerStatusExt(SCREEN_ID_MAIN, |
| 263 | ScreenPowerStatus::POWER_STATUS_OFF); | 289 | ScreenPowerStatus::POWER_STATUS_OFF); |
| @@ -75,7 +75,8 @@ enum XmlNodeElement { | |||
| 75 | HALF_FOLDED_BUFFER, | 75 | HALF_FOLDED_BUFFER, |
| 76 | LARGER_BOUNDARY_FOR_THRESHOLD, | 76 | LARGER_BOUNDARY_FOR_THRESHOLD, |
| 77 | POSTURE_SIZE, | 77 | POSTURE_SIZE, |
| 78 | - HALL_SIZE | 78 | + HALL_SIZE, |
| 79 | + WAIT_COORDINATION_READY_MAX_TIME, | ||
| 79 | }; | 80 | }; |
| 80 | } | 81 | } |
| 81 | 82 | ||
| @@ -132,7 +133,8 @@ std::map<int32_t, std::string> ScreenSceneConfig::xmlNodeMap_ = { | |||
| 132 | {HALF_FOLDED_BUFFER, "halfFoldedBuffer"}, | 133 | {HALF_FOLDED_BUFFER, "halfFoldedBuffer"}, |
| 133 | {LARGER_BOUNDARY_FOR_THRESHOLD, "largerBoundaryForThreshold"}, | 134 | {LARGER_BOUNDARY_FOR_THRESHOLD, "largerBoundaryForThreshold"}, |
| 134 | {POSTURE_SIZE, "postureSize"}, | 135 | {POSTURE_SIZE, "postureSize"}, |
| 135 | - {HALL_SIZE, "hallSize"} | 136 | + {HALL_SIZE, "hallSize"}, |
| 137 | + {WAIT_COORDINATION_READY_MAX_TIME, "waitCoordinationReadyMaxTime"}, | ||
| 136 | }; | 138 | }; |
| 137 | 139 | ||
| 138 | std::vector<std::string> ScreenSceneConfig::Split(std::string str, std::string pattern) | 140 | std::vector<std::string> ScreenSceneConfig::Split(std::string str, std::string pattern) |
| @@ -239,7 +241,8 @@ void ScreenSceneConfig::ParseNodeConfig(const xmlNodePtr& currNode) | |||
| 239 | (xmlNodeMap_[HALF_FOLDED_BUFFER] == nodeName) || | 241 | (xmlNodeMap_[HALF_FOLDED_BUFFER] == nodeName) || |
| 240 | (xmlNodeMap_[LARGER_BOUNDARY_FOR_THRESHOLD] == nodeName) || | 242 | (xmlNodeMap_[LARGER_BOUNDARY_FOR_THRESHOLD] == nodeName) || |
| 241 | (xmlNodeMap_[POSTURE_SIZE] == nodeName) || | 243 | (xmlNodeMap_[POSTURE_SIZE] == nodeName) || |
| 242 | - (xmlNodeMap_[HALL_SIZE] == nodeName); | 244 | + (xmlNodeMap_[HALL_SIZE] == nodeName) || |
| 245 | + (xmlNodeMap_[WAIT_COORDINATION_READY_MAX_TIME] == nodeName); | ||
| 243 | bool stringConfigCheck = (xmlNodeMap_[DEFAULT_DISPLAY_CUTOUT_PATH] == nodeName) || | 246 | bool stringConfigCheck = (xmlNodeMap_[DEFAULT_DISPLAY_CUTOUT_PATH] == nodeName) || |
| 244 | (xmlNodeMap_[SUB_DISPLAY_CUTOUT_PATH] == nodeName) || | 247 | (xmlNodeMap_[SUB_DISPLAY_CUTOUT_PATH] == nodeName) || |
| 245 | (xmlNodeMap_[ROTATION_POLICY] == nodeName) || | 248 | (xmlNodeMap_[ROTATION_POLICY] == nodeName) || |
| @@ -794,6 +794,11 @@ void ScreenSessionManager::ConfigureScreenScene() | |||
| 794 | std::lock_guard<std::mutex> lock(allDisplayPhysicalResolutionMutex_); | 794 | std::lock_guard<std::mutex> lock(allDisplayPhysicalResolutionMutex_); |
| 795 | allDisplayPhysicalResolution_ = ScreenSceneConfig::GetAllDisplayPhysicalConfig(); | 795 | allDisplayPhysicalResolution_ = ScreenSceneConfig::GetAllDisplayPhysicalConfig(); |
| 796 | } | 796 | } |
| 797 | + | ||
| 798 | + if (numbersConfig.count("waitCoordinationReadyMaxTime") != 0) { | ||
| 799 | + waitCoordinationReadyMaxTime_ = static_cast<int32_t>(numbersConfig["waitCoordinationReadyMaxTime"][0]); | ||
| 800 | + TLOGD(WmsLogTag::DMS, "waitCoordinationReadyMaxTime=%{public}d", waitCoordinationReadyMaxTime_.load()); | ||
| 801 | + } | ||
| 797 | } | 802 | } |
| 798 | 803 | ||
| 799 | void ScreenSessionManager::ConfigureDpi() | 804 | void ScreenSessionManager::ConfigureDpi() |
| @@ -5499,6 +5504,7 @@ void ScreenSessionManager::BootFinishedCallback(const char *key, const char *val | |||
| 5499 | } | 5504 | } |
| 5500 | that.RegisterSettingRotationObserver(); | 5505 | that.RegisterSettingRotationObserver(); |
| 5501 | that.RegisterSettingResolutionEffectObserver(); | 5506 | that.RegisterSettingResolutionEffectObserver(); |
| 5507 | + that.RegisterSettingCoordinationReadyObserver(); | ||
| 5502 | if (that.defaultDpi) { | 5508 | if (that.defaultDpi) { |
| 5503 | uint32_t initDefaultDpi; | 5509 | uint32_t initDefaultDpi; |
| 5504 | auto ret = ScreenSettingHelper::GetSettingValue(initDefaultDpi, SET_SETTING_DPI_KEY); | 5510 | auto ret = ScreenSettingHelper::GetSettingValue(initDefaultDpi, SET_SETTING_DPI_KEY); |
| @@ -5557,6 +5563,57 @@ void ScreenSessionManager::SetRotateLockedFromSettingData() | |||
| 5557 | } | 5563 | } |
| 5558 | } | 5564 | } |
| 5559 | 5565 | ||
| 5566 | +void ScreenSessionManager::RegisterSettingCoordinationReadyObserver() | ||
| 5567 | +{ | ||
| 5568 | + TLOGI(WmsLogTag::DMS, "Register setting coordination ready observer"); | ||
| 5569 | + SettingObserver::UpdateFunc updateFunc = [this](const std::string& key) { UpdateCoordinationReadyFromSettingData(); }; | ||
| 5570 | + ScreenSettingHelper::RegisterSettingCoordinationReadyObserver(DmUtils::wrap_callback(updateFunc)); | ||
| 5571 | +} | ||
| 5572 | + | ||
| 5573 | +void ScreenSessionManager::UpdateCoordinationReadyFromSettingData() | ||
| 5574 | +{ | ||
| 5575 | + bool isCoordinationReady; | ||
| 5576 | + ScreenSettingHelper::GetSettingIsCoordinationReady(isCoordinationReady); | ||
| 5577 | + TLOGI(WmsLogTag::DMS, "isCoordinationReady: %{public}d", isCoordinationReady); | ||
| 5578 | + if (isCoordinationReady == isCoordinationReady_.load()) { | ||
| 5579 | + return; | ||
| 5580 | + } | ||
| 5581 | + isCoordinationReady_ = isCoordinationReady; | ||
| 5582 | + if (isCoordinationReady_.load()) { | ||
| 5583 | + NotifyCoordinationReadyCV(); | ||
| 5584 | + } | ||
| 5585 | +} | ||
| 5586 | + | ||
| 5587 | +void ScreenSessionManager::SetWaitingForCoordinationReady(bool isWaitingForCoordinationReady) | ||
| 5588 | +{ | ||
| 5589 | + isWaitingForCoordinationReady_ = isWaitingForCoordinationReady; | ||
| 5590 | +} | ||
| 5591 | + | ||
| 5592 | +bool ScreenSessionManager::GetWaitingForCoordinationReady() const | ||
| 5593 | +{ | ||
| 5594 | + return isWaitingForCoordinationReady_.load(); | ||
| 5595 | +} | ||
| 5596 | + | ||
| 5597 | +void ScreenSessionManager::WaitForCoordinationReady() | ||
| 5598 | +{ | ||
| 5599 | + std::unique_lock<std::mutex> lock(coordinationReadyMutex_); | ||
| 5600 | + SetWaitingForCoordinationReady(true); | ||
| 5601 | + bool isCoordinationReady = isCoordinationReady_.load(); | ||
| 5602 | + TLOGI(WmsLogTag::DMS, "begin wait coordination ready. need wait: %{public}d", isCoordinationReady); | ||
| 5603 | + if (!isCoordinationReady) { | ||
| 5604 | + if (DmUtils::safe_wait_for(coordinationReadyCV_, lock, | ||
| 5605 | + std::chrono::milliseconds(waitCoordinationReadyMaxTime_.load())) == std::cv_status::timeout) { | ||
| 5606 | + TLOGW(WmsLogTag::DMS, "Wait dual display ready timeout, still enter coordination mode."); | ||
| 5607 | + } | ||
| 5608 | + } | ||
| 5609 | + SetWaitingForCoordinationReady(false); | ||
| 5610 | +} | ||
| 5611 | + | ||
| 5612 | +void ScreenSessionManager::NotifyCoordinationReadyCV() | ||
| 5613 | +{ | ||
| 5614 | + coordinationReadyCV_.notify_all(); | ||
| 5615 | +} | ||
| 5616 | + | ||
| 5560 | void ScreenSessionManager::RegisterSettingResolutionEffectObserver() | 5617 | void ScreenSessionManager::RegisterSettingResolutionEffectObserver() |
| 5561 | { | 5618 | { |
| 5562 | TLOGNFI(WmsLogTag::DMS, "Register Setting Observer"); | 5619 | TLOGNFI(WmsLogTag::DMS, "Register Setting Observer"); |
| @@ -36,6 +36,7 @@ sptr<SettingObserver> ScreenSettingHelper::duringCallStateObserver_; | |||
| 36 | sptr<SettingObserver> ScreenSettingHelper::resolutionEffectObserver_; | 36 | sptr<SettingObserver> ScreenSettingHelper::resolutionEffectObserver_; |
| 37 | sptr<SettingObserver> ScreenSettingHelper::correctionExemptionListObserver_; | 37 | sptr<SettingObserver> ScreenSettingHelper::correctionExemptionListObserver_; |
| 38 | sptr<SettingObserver> ScreenSettingHelper::borderingAreaPercentObserver_; | 38 | sptr<SettingObserver> ScreenSettingHelper::borderingAreaPercentObserver_; |
| 39 | +sptr<SettingObserver> ScreenSettingHelper::coordinationReadyObserver_; | ||
| 39 | constexpr int32_t PARAM_NUM_TEN = 10; | 40 | constexpr int32_t PARAM_NUM_TEN = 10; |
| 40 | constexpr uint32_t EXPECT_ACTIVE_MODE_SIZE = 4; | 41 | constexpr uint32_t EXPECT_ACTIVE_MODE_SIZE = 4; |
| 41 | constexpr uint32_t EXPECT_SCREEN_MODE_SIZE = 2; | 42 | constexpr uint32_t EXPECT_SCREEN_MODE_SIZE = 2; |
| @@ -106,6 +107,45 @@ bool ScreenSettingHelper::GetSettingDpi(uint32_t& dpi, const std::string& key) | |||
| 106 | return GetSettingValue(dpi, key); | 107 | return GetSettingValue(dpi, key); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 110 | +void ScreenSettingHelper::RegisterSettingCoordinationReadyObserver(SettingObserver::UpdateFunc func) | ||
| 111 | +{ | ||
| 112 | + if (coordinationReadyObserver_) { | ||
| 113 | + TLOGD(WmsLogTag::WMS_ATTRIBUTE, "setting Brightness observer is registered"); | ||
| 114 | + return; | ||
| 115 | + } | ||
| 116 | + SettingProvider& provider = SettingProvider::GetInstance(WINDOW_MANAGER_SERVICE_ID); | ||
| 117 | + coordinationReadyObserver_ = provider.CreateObserver(SETTING_DUAL_DISPLAY_READY_KEY, func); | ||
| 118 | + if (coordinationReadyObserver_ == nullptr) { | ||
| 119 | + TLOGE(WmsLogTag::WMS_ATTRIBUTE, "create observer failed"); | ||
| 120 | + return; | ||
| 121 | + } | ||
| 122 | + ErrCode ret = provider.RegisterObserver(coordinationReadyObserver_); | ||
| 123 | + if (ret != ERR_OK) { | ||
| 124 | + TLOGE(WmsLogTag::WMS_ATTRIBUTE, "failed, ret=%{public}d", ret); | ||
| 125 | + coordinationReadyObserver_ = nullptr; | ||
| 126 | + } | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +void ScreenSettingHelper::UnregisterSettingCoordinationReadyObserver() | ||
| 130 | +{ | ||
| 131 | + if (coordinationReadyObserver_ == nullptr) { | ||
| 132 | + TLOGD(WmsLogTag::WMS_ATTRIBUTE, "coordinationReadyObserver_ is nullptr"); | ||
| 133 | + return; | ||
| 134 | + } | ||
| 135 | + SettingProvider& provider = SettingProvider::GetInstance(WINDOW_MANAGER_SERVICE_ID); | ||
| 136 | + ErrCode ret = provider.UnregisterObserver(coordinationReadyObserver_); | ||
| 137 | + if (ret != ERR_OK) { | ||
| 138 | + TLOGE(WmsLogTag::WMS_ATTRIBUTE, "failed, ret=%{public}d", ret); | ||
| 139 | + return; | ||
| 140 | + } | ||
| 141 | + coordinationReadyObserver_ = nullptr; | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +bool ScreenSettingHelper::GetSettingIsCoordinationReady(bool& isCoordinationReady, const std::string& key) | ||
| 145 | +{ | ||
| 146 | + return GetSettingValue(key, isCoordinationReady); | ||
| 147 | +} | ||
| 148 | + | ||
| 109 | bool ScreenSettingHelper::GetSettingValue(uint32_t& value, const std::string& key) | 149 | bool ScreenSettingHelper::GetSettingValue(uint32_t& value, const std::string& key) |
| 110 | { | 150 | { |
| 111 | SettingProvider& settingData = SettingProvider::GetInstance(DISPLAY_MANAGER_SERVICE_SA_ID); | 151 | SettingProvider& settingData = SettingProvider::GetInstance(DISPLAY_MANAGER_SERVICE_SA_ID); |
| @@ -119,6 +159,19 @@ bool ScreenSettingHelper::GetSettingValue(uint32_t& value, const std::string& ke | |||
| 119 | return true; | 159 | return true; |
| 120 | } | 160 | } |
| 121 | 161 | ||
| 162 | +bool ScreenSettingHelper::GetSettingValue(const std::string& key, bool& value) | ||
| 163 | +{ | ||
| 164 | + SettingProvider& settingData = SettingProvider::GetInstance(DISPLAY_MANAGER_SERVICE_SA_ID); | ||
| 165 | + bool getValue; | ||
| 166 | + ErrCode ret = settingData.GetBoolValue(key, getValue); | ||
| 167 | + if (ret != ERR_OK) { | ||
| 168 | + TLOGW(WmsLogTag::DMS, "failed, ret=%{public}d", ret); | ||
| 169 | + return false; | ||
| 170 | + } | ||
| 171 | + value = getValue; | ||
| 172 | + return true; | ||
| 173 | +} | ||
| 174 | + | ||
| 122 | // LCOV_EXCL_START | 175 | // LCOV_EXCL_START |
| 123 | bool ScreenSettingHelper::GetSettingValue(const std::string& key, std::string& value) | 176 | bool ScreenSettingHelper::GetSettingValue(const std::string& key, std::string& value) |
| 124 | { | 177 | { |
| @@ -133,6 +133,23 @@ HWTEST_F(FoldScreenBasePolicyTest, ChangeScreenDisplayModeToCoordinationTest, Te | |||
| 133 | EXPECT_TRUE(g_logMsg.find("screenId: 5, command: 1") != std::string::npos); | 133 | EXPECT_TRUE(g_logMsg.find("screenId: 5, command: 1") != std::string::npos); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | +/** | ||
| 137 | + * @tc.name: ChangeScreenDisplayModeToCoordinationTest_wait | ||
| 138 | + * @tc.desc: test function : ChangeScreenDisplayModeToCoordination waiting path | ||
| 139 | + * @tc.type: FUNC | ||
| 140 | + */ | ||
| 141 | +HWTEST_F(FoldScreenBasePolicyTest, ChangeScreenDisplayModeToCoordinationTest_wait, TestSize.Level1) | ||
| 142 | +{ | ||
| 143 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(false); | ||
| 144 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(true); | ||
| 145 | + FoldScreenBasePolicy::GetInstance().ChangeScreenDisplayModeToCoordination(); | ||
| 146 | + EXPECT_TRUE(ScreenSessionManager::GetInstance().GetCoordinationFlag()); | ||
| 147 | + EXPECT_TRUE(ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()); | ||
| 148 | + | ||
| 149 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(false); | ||
| 150 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(false); | ||
| 151 | +} | ||
| 152 | + | ||
| 136 | /** | 153 | /** |
| 137 | * @tc.name: CloseCoordinationScreenTest | 154 | * @tc.name: CloseCoordinationScreenTest |
| 138 | * @tc.desc: test function : CloseCoordinationScreen | 155 | * @tc.desc: test function : CloseCoordinationScreen |
| @@ -153,6 +170,42 @@ HWTEST_F(FoldScreenBasePolicyTest, CloseCoordinationScreenTest, TestSize.Level1) | |||
| 153 | EXPECT_TRUE(!ScreenSessionManager::GetInstance().GetCoordinationFlag()); | 170 | EXPECT_TRUE(!ScreenSessionManager::GetInstance().GetCoordinationFlag()); |
| 154 | } | 171 | } |
| 155 | 172 | ||
| 173 | +/** | ||
| 174 | + * @tc.name: CloseCoordinationScreenTest_wait | ||
| 175 | + * @tc.desc: test function : CloseCoordinationScreen waiting path | ||
| 176 | + * @tc.type: FUNC | ||
| 177 | + */ | ||
| 178 | +HWTEST_F(FoldScreenBasePolicyTest, CloseCoordinationScreenTest_wait, TestSize.Level1) | ||
| 179 | +{ | ||
| 180 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(true); | ||
| 181 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(true); | ||
| 182 | + FoldScreenBasePolicy::GetInstance().CloseCoordinationScreen(); | ||
| 183 | + EXPECT_TRUE(!ScreenSessionManager::GetInstance().GetCoordinationFlag()); | ||
| 184 | + EXPECT_TRUE(ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()); | ||
| 185 | + | ||
| 186 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(false); | ||
| 187 | +} | ||
| 188 | + | ||
| 189 | +/** | ||
| 190 | + * @tc.name: ExitCoordinationTest | ||
| 191 | + * @tc.desc: test function : ExitCoordination | ||
| 192 | + * @tc.type: FUNC | ||
| 193 | + */ | ||
| 194 | +HWTEST_F(FoldScreenBasePolicyTest, ExitCoordinationTest, TestSize.Level1) | ||
| 195 | +{ | ||
| 196 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(false); | ||
| 197 | + FoldScreenBasePolicy::GetInstance().ExitCoordination(); | ||
| 198 | + EXPECT_FALSE(ScreenSessionManager::GetInstance().GetCoordinationFlag()); | ||
| 199 | + | ||
| 200 | + ScreenSessionManager::GetInstance().SetCoordinationFlag(true); | ||
| 201 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(true); | ||
| 202 | + FoldScreenBasePolicy::GetInstance().ExitCoordination(); | ||
| 203 | + EXPECT_TRUE(!ScreenSessionManager::GetInstance().GetCoordinationFlag()); | ||
| 204 | + EXPECT_TRUE(ScreenSessionManager::GetInstance().GetWaitingForCoordinationReady()); | ||
| 205 | + | ||
| 206 | + ScreenSessionManager::GetInstance().SetWaitingForCoordinationReady(false); | ||
| 207 | +} | ||
| 208 | + | ||
| 156 | /** | 209 | /** |
| 157 | * @tc.name: ReportFoldDisplayModeChangeTest | 210 | * @tc.name: ReportFoldDisplayModeChangeTest |
| 158 | * @tc.desc: test function : ReportFoldDisplayModeChange | 211 | * @tc.desc: test function : ReportFoldDisplayModeChange |
| @@ -325,4 +378,4 @@ HWTEST_F(FoldScreenBasePolicyTest, GetCurrentFoldCreaseRegionTest, TestSize.Leve | |||
| 325 | } | 378 | } |
| 326 | } | 379 | } |
| 327 | } // namespace Rosen | 380 | } // namespace Rosen |
| 328 | -} // namespace OHOS | 381 | +} // namespace OHOS |
| @@ -14,12 +14,14 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | 21 | ||
| 21 | 22 | ||
| 22 | 23 | ||
| 24 | + | ||
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | 27 | ||
| @@ -41,6 +43,7 @@ const int32_t CV_WAIT_SCREENON_MS = 300; | |||
| 41 | const int32_t CV_WAIT_SCREENOFF_MS_MAX = 3500; | 43 | const int32_t CV_WAIT_SCREENOFF_MS_MAX = 3500; |
| 42 | const uint32_t INVALID_DISPLAY_ORIENTATION = 99; | 44 | const uint32_t INVALID_DISPLAY_ORIENTATION = 99; |
| 43 | constexpr uint32_t SLEEP_TIME_IN_US = 100000; // 100ms | 45 | constexpr uint32_t SLEEP_TIME_IN_US = 100000; // 100ms |
| 46 | +constexpr uint32_t WAIT_COORDINATION_READY_US = 10000; // 10ms | ||
| 44 | constexpr int32_t CAST_WIRED_PROJECTION_START = 1005; | 47 | constexpr int32_t CAST_WIRED_PROJECTION_START = 1005; |
| 45 | constexpr int32_t CAST_WIRED_PROJECTION_STOP = 1007; | 48 | constexpr int32_t CAST_WIRED_PROJECTION_STOP = 1007; |
| 46 | bool g_isPcDevice = ScreenSceneConfig::GetExternalScreenDefaultMode() == "none"; | 49 | bool g_isPcDevice = ScreenSceneConfig::GetExternalScreenDefaultMode() == "none"; |
| @@ -65,7 +68,6 @@ public: | |||
| 65 | ScreenId DEFAULT_SCREEN_ID {0}; | 68 | ScreenId DEFAULT_SCREEN_ID {0}; |
| 66 | ScreenId VIRTUAL_SCREEN_ID {2}; | 69 | ScreenId VIRTUAL_SCREEN_ID {2}; |
| 67 | ScreenId VIRTUAL_SCREEN_RS_ID {100}; | 70 | ScreenId VIRTUAL_SCREEN_RS_ID {100}; |
| 68 | - int32_t INVALID_USER_ID {1000}; | ||
| 69 | void SetAceessTokenPermission(const std::string processName); | 71 | void SetAceessTokenPermission(const std::string processName); |
| 70 | sptr<ScreenSession> InitTestScreenSession(std::string name, ScreenId &screenId); | 72 | sptr<ScreenSession> InitTestScreenSession(std::string name, ScreenId &screenId); |
| 71 | DMHookInfo CreateDefaultHookInfo(); | 73 | DMHookInfo CreateDefaultHookInfo(); |
| @@ -1131,6 +1133,94 @@ HWTEST_F(ScreenSessionManagerTest, PhyMirrorConnectWakeupScreen, TestSize.Level1 | |||
| 1131 | 1133 | ||
| 1132 | } | 1134 | } |
| 1133 | 1135 | ||
| 1136 | +/** | ||
| 1137 | + * @tc.name: ConfigureScreenScene | ||
| 1138 | + * @tc.desc: ConfigureScreenScene test | ||
| 1139 | + * @tc.type: FUNC | ||
| 1140 | + */ | ||
| 1141 | +HWTEST_F(ScreenSessionManagerTest, ConfigureScreenScene, TestSize.Level1) | ||
| 1142 | +{ | ||
| 1143 | + ASSERT_NE(ssm_, nullptr); | ||
| 1144 | + auto intBackup = ScreenSceneConfig::intNumbersConfig_; | ||
| 1145 | + auto enableBackup = ScreenSceneConfig::enableConfig_; | ||
| 1146 | + auto stringBackup = ScreenSceneConfig::stringConfig_; | ||
| 1147 | + | ||
| 1148 | + ScreenSceneConfig::intNumbersConfig_.clear(); | ||
| 1149 | + ScreenSceneConfig::enableConfig_.clear(); | ||
| 1150 | + ScreenSceneConfig::stringConfig_.clear(); | ||
| 1151 | + ScreenSceneConfig::intNumbersConfig_["defaultDeviceRotationOffset"] = {2}; | ||
| 1152 | + ScreenSceneConfig::enableConfig_["isRightPowerButton"] = false; | ||
| 1153 | + ScreenSceneConfig::stringConfig_["rotationPolicy"] = "2"; | ||
| 1154 | + ScreenSceneConfig::stringConfig_["defaultRotationPolicy"] = "3"; | ||
| 1155 | + | ||
| 1156 | + ssm_->defaultDeviceRotationOffset_ = 0; | ||
| 1157 | + ssm_->deviceScreenConfig_.rotationPolicy_ = "11"; | ||
| 1158 | + ssm_->deviceScreenConfig_.defaultRotationPolicy_ = "1"; | ||
| 1159 | + ssm_->deviceScreenConfig_.isRightPowerButton_ = true; | ||
| 1160 | + ssm_->ConfigureScreenScene(); | ||
| 1161 | + EXPECT_EQ(2u, ssm_->defaultDeviceRotationOffset_); | ||
| 1162 | + EXPECT_EQ("2", ssm_->deviceScreenConfig_.rotationPolicy_); | ||
| 1163 | + EXPECT_EQ("3", ssm_->deviceScreenConfig_.defaultRotationPolicy_); | ||
| 1164 | + EXPECT_FALSE(ssm_->deviceScreenConfig_.isRightPowerButton_); | ||
| 1165 | + | ||
| 1166 | + ScreenSceneConfig::intNumbersConfig_ = intBackup; | ||
| 1167 | + ScreenSceneConfig::enableConfig_ = enableBackup; | ||
| 1168 | + ScreenSceneConfig::stringConfig_ = stringBackup; | ||
| 1169 | +} | ||
| 1170 | + | ||
| 1171 | +/** | ||
| 1172 | + * @tc.name: RegisterSettingCoordinationReadyObserver | ||
| 1173 | + * @tc.desc: RegisterSettingCoordinationReadyObserver test | ||
| 1174 | + * @tc.type: FUNC | ||
| 1175 | + */ | ||
| 1176 | +HWTEST_F(ScreenSessionManagerTest, RegisterSettingCoordinationReadyObserver, TestSize.Level1) | ||
| 1177 | +{ | ||
| 1178 | + ASSERT_NE(ssm_, nullptr); | ||
| 1179 | + sptr<SettingObserver> observer = new SettingObserver(); | ||
| 1180 | + ScreenSettingHelper::coordinationReadyObserver_ = observer; | ||
| 1181 | + ssm_->RegisterSettingCoordinationReadyObserver(); | ||
| 1182 | + EXPECT_EQ(observer, ScreenSettingHelper::coordinationReadyObserver_); | ||
| 1183 | + ScreenSettingHelper::coordinationReadyObserver_ = nullptr; | ||
| 1184 | +} | ||
| 1185 | + | ||
| 1186 | +/** | ||
| 1187 | + * @tc.name: WaitForCoordinationReady | ||
| 1188 | + * @tc.desc: WaitForCoordinationReady test | ||
| 1189 | + * @tc.type: FUNC | ||
| 1190 | + */ | ||
| 1191 | +HWTEST_F(ScreenSessionManagerTest, WaitForCoordinationReady, TestSize.Level1) | ||
| 1192 | +{ | ||
| 1193 | + ASSERT_NE(ssm_, nullptr); | ||
| 1194 | + ssm_->isCoordinationReady_ = true; | ||
| 1195 | + ssm_->waitCoordinationReadyMaxTime_ = 0; //ms | ||
| 1196 | + ssm_->WaitForCoordinationReady(); | ||
| 1197 | + EXPECT_FALSE(ssm_->GetWaitingForCoordinationReady()); | ||
| 1198 | +} | ||
| 1199 | + | ||
| 1200 | +/** | ||
| 1201 | + * @tc.name: NotifyCoordinationReadyCV | ||
| 1202 | + * @tc.desc: NotifyCoordinationReadyCV test | ||
| 1203 | + * @tc.type: FUNC | ||
| 1204 | + */ | ||
| 1205 | +HWTEST_F(ScreenSessionManagerTest, NotifyCoordinationReadyCV, TestSize.Level1) | ||
| 1206 | +{ | ||
| 1207 | + ASSERT_NE(ssm_, nullptr); | ||
| 1208 | + ssm_->isCoordinationReady_ = false; | ||
| 1209 | + ssm_->waitCoordinationReadyMaxTime_ = 1000; //ms | ||
| 1210 | + auto ssm = ssm_; | ||
| 1211 | + std::thread waitThread([ssm]() { ssm->WaitForCoordinationReady(); }); | ||
| 1212 | + for (int i = 0; i < 50; ++i) { | ||
| 1213 | + if (ssm_->GetWaitingForCoordinationReady()) { | ||
| 1214 | + break; | ||
| 1215 | + } | ||
| 1216 | + usleep(WAIT_COORDINATION_READY_US); | ||
| 1217 | + } | ||
| 1218 | + EXPECT_TRUE(ssm_->GetWaitingForCoordinationReady()); | ||
| 1219 | + ssm_->NotifyCoordinationReadyCV(); | ||
| 1220 | + waitThread.join(); | ||
| 1221 | + EXPECT_FALSE(ssm_->GetWaitingForCoordinationReady()); | ||
| 1222 | +} | ||
| 1223 | + | ||
| 1134 | /** | 1224 | /** |
| 1135 | * @tc.name: GetIsCurrentInUseById01 | 1225 | * @tc.name: GetIsCurrentInUseById01 |
| 1136 | * @tc.desc: GetIsCurrentInUseById01 | 1226 | * @tc.desc: GetIsCurrentInUseById01 |
| @@ -1147,4 +1237,4 @@ HWTEST_F(ScreenSessionManagerTest, GetIsCurrentInUseById01, Function | SmallTest | |||
| 1147 | } | 1237 | } |
| 1148 | } | 1238 | } |
| 1149 | } // namespace Rosen | 1239 | } // namespace Rosen |
| 1150 | -} // namespace OHOS | 1240 | +} // namespace OHOS |
| @@ -314,6 +314,34 @@ namespace { | |||
| 314 | ASSERT_FALSE(ret); | 314 | ASSERT_FALSE(ret); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | + /** | ||
| 318 | + * @tc.name: GetSettingValueString | ||
| 319 | + * @tc.desc: GetSettingValueString | ||
| 320 | + * @tc.type: FUNC | ||
| 321 | + */ | ||
| 322 | + HWTEST_F(ScreenSettingHelperTest, GetSettingValueString, TestSize.Level1) | ||
| 323 | + { | ||
| 324 | + ScreenSettingHelper screenSettingHelper = ScreenSettingHelper(); | ||
| 325 | + std::string value; | ||
| 326 | + std::string key = "test"; | ||
| 327 | + bool ret = screenSettingHelper.GetSettingValue(key, value); | ||
| 328 | + ASSERT_FALSE(ret); | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + /** | ||
| 332 | + * @tc.name: GetSettingValueBool | ||
| 333 | + * @tc.desc: GetSettingValueBool | ||
| 334 | + * @tc.type: FUNC | ||
| 335 | + */ | ||
| 336 | + HWTEST_F(ScreenSettingHelperTest, GetSettingValueBool, TestSize.Level1) | ||
| 337 | + { | ||
| 338 | + ScreenSettingHelper screenSettingHelper = ScreenSettingHelper(); | ||
| 339 | + bool value = false; | ||
| 340 | + std::string key = "test"; | ||
| 341 | + bool ret = screenSettingHelper.GetSettingValue(key, value); | ||
| 342 | + ASSERT_FALSE(ret); | ||
| 343 | + } | ||
| 344 | + | ||
| 317 | /** | 345 | /** |
| 318 | * @tc.name: RemoveInvalidChar01 | 346 | * @tc.name: RemoveInvalidChar01 |
| 319 | * @tc.desc: RemoveInvalidChar Test01 | 347 | * @tc.desc: RemoveInvalidChar Test01 |
| @@ -1094,6 +1122,50 @@ namespace { | |||
| 1094 | ASSERT_EQ(ScreenSettingHelper::resolutionEffectObserver_, nullptr); | 1122 | ASSERT_EQ(ScreenSettingHelper::resolutionEffectObserver_, nullptr); |
| 1095 | } | 1123 | } |
| 1096 | 1124 | ||
| 1125 | + /** | ||
| 1126 | + * @tc.name: RegisterSettingCoordinationReadyObserver01 | ||
| 1127 | + * @tc.desc: RegisterSettingCoordinationReadyObserver01 | ||
| 1128 | + * @tc.type: FUNC | ||
| 1129 | + */ | ||
| 1130 | + HWTEST_F(ScreenSettingHelperTest, RegisterSettingCoordinationReadyObserver01, TestSize.Level1) | ||
| 1131 | + { | ||
| 1132 | + auto func = [] (const std::string&) { | ||
| 1133 | + TLOGI(WmsLogTag::DMS, "UT test"); | ||
| 1134 | + }; | ||
| 1135 | + ScreenSettingHelper::RegisterSettingCoordinationReadyObserver(func); | ||
| 1136 | + ScreenSettingHelper::coordinationReadyObserver_ = nullptr; | ||
| 1137 | + ASSERT_EQ(ScreenSettingHelper::coordinationReadyObserver_, nullptr); | ||
| 1138 | + } | ||
| 1139 | + | ||
| 1140 | + /** | ||
| 1141 | + * @tc.name: RegisterSettingCoordinationReadyObserver02 | ||
| 1142 | + * @tc.desc: RegisterSettingCoordinationReadyObserver02 | ||
| 1143 | + * @tc.type: FUNC | ||
| 1144 | + */ | ||
| 1145 | + HWTEST_F(ScreenSettingHelperTest, RegisterSettingCoordinationReadyObserver02, TestSize.Level1) | ||
| 1146 | + { | ||
| 1147 | + sptr<SettingObserver> observer = new SettingObserver(); | ||
| 1148 | + ScreenSettingHelper::coordinationReadyObserver_ = observer; | ||
| 1149 | + auto func = [] (const std::string&) { | ||
| 1150 | + TLOGI(WmsLogTag::DMS, "UT test"); | ||
| 1151 | + }; | ||
| 1152 | + ScreenSettingHelper::RegisterSettingCoordinationReadyObserver(func); | ||
| 1153 | + ASSERT_EQ(ScreenSettingHelper::coordinationReadyObserver_, observer); | ||
| 1154 | + ScreenSettingHelper::coordinationReadyObserver_ = nullptr; | ||
| 1155 | + } | ||
| 1156 | + | ||
| 1157 | + /** | ||
| 1158 | + * @tc.name: UnregisterSettingCoordinationReadyObserver01 | ||
| 1159 | + * @tc.desc: UnregisterSettingCoordinationReadyObserver01 | ||
| 1160 | + * @tc.type: FUNC | ||
| 1161 | + */ | ||
| 1162 | + HWTEST_F(ScreenSettingHelperTest, UnregisterSettingCoordinationReadyObserver01, TestSize.Level1) | ||
| 1163 | + { | ||
| 1164 | + ScreenSettingHelper::coordinationReadyObserver_ = nullptr; | ||
| 1165 | + ScreenSettingHelper::UnregisterSettingCoordinationReadyObserver(); | ||
| 1166 | + ASSERT_EQ(ScreenSettingHelper::coordinationReadyObserver_, nullptr); | ||
| 1167 | + } | ||
| 1168 | + | ||
| 1097 | /** | 1169 | /** |
| 1098 | * @tc.name: GetResolutionEffectTest | 1170 | * @tc.name: GetResolutionEffectTest |
| 1099 | * @tc.desc: Test GetResolutionEffectTest func | 1171 | * @tc.desc: Test GetResolutionEffectTest func |
| @@ -1263,4 +1335,4 @@ namespace { | |||
| 1263 | } | 1335 | } |
| 1264 | } | 1336 | } |
| 1265 | } // namespace Rosen | 1337 | } // namespace Rosen |
| 1266 | -} // namespace OHOS | 1338 | +} // namespace OHOS |