已合并
add screen power manager #19706
wulong158创建于 7月18日
add screen power manager #19706
已合并
共 8 个文件变更+181-57
| @@ -27,6 +27,7 @@ config("session_manager_public_config") { | |||
| 27 | "${window_base_path}/window_scene/screen_session_manager/infra/include/fold_screen", | 27 | "${window_base_path}/window_scene/screen_session_manager/infra/include/fold_screen", |
| 28 | "${window_base_path}/window_scene/screen_session_manager/infra/include/common", | 28 | "${window_base_path}/window_scene/screen_session_manager/infra/include/common", |
| 29 | "${window_base_path}/window_scene/screen_session_manager/infra/include/ffrt", | 29 | "${window_base_path}/window_scene/screen_session_manager/infra/include/ffrt", |
| 30 | + "${window_base_path}/window_scene/screen_session_manager/infra/include/screen_power", | ||
| 30 | "${window_base_path}/window_scene/screen_session_manager/include/zidl", | 31 | "${window_base_path}/window_scene/screen_session_manager/include/zidl", |
| 31 | "${window_base_path}/window_scene/session_manager_service/include", | 32 | "${window_base_path}/window_scene/session_manager_service/include", |
| 32 | 33 | ||
| @@ -92,7 +93,8 @@ ohos_shared_library("screen_session_manager") { | |||
| 92 | "src/setting_provider.cpp", | 93 | "src/setting_provider.cpp", |
| 93 | "src/zidl/screen_session_manager_stub.cpp", | 94 | "src/zidl/screen_session_manager_stub.cpp", |
| 94 | "src/screen_session_manager_adapter.cpp", | 95 | "src/screen_session_manager_adapter.cpp", |
| 95 | - "src/rs_event_data_manager.cpp" | 96 | + "src/rs_event_data_manager.cpp", |
| 97 | + "infra/src/screen_power/screen_power_mgr.cpp", | ||
| 96 | ] | 98 | ] |
| 97 | 99 | ||
| 98 | cflags_cc = [ "-std=c++17" ] | 100 | cflags_cc = [ "-std=c++17" ] |
| @@ -1315,8 +1315,6 @@ private: | |||
| 1315 | void GetCastVirtualMirrorSession(sptr<ScreenSession>& virtualSession); | 1315 | void GetCastVirtualMirrorSession(sptr<ScreenSession>& virtualSession); |
| 1316 | std::atomic<bool> curResolutionEffectEnable_ = false; | 1316 | std::atomic<bool> curResolutionEffectEnable_ = false; |
| 1317 | void SetOptionConfig(ScreenId screenId, VirtualScreenOption option); | 1317 | void SetOptionConfig(ScreenId screenId, VirtualScreenOption option); |
| 1318 | - void DoSetScreenPowerStatus(ScreenId rsScreenId, ScreenPowerStatus status); | ||
| 1319 | - void ClearScreenPowerStatus(ScreenId rsScreenId); | ||
| 1320 | void InitScreenActiveModeRectMap(); | 1318 | void InitScreenActiveModeRectMap(); |
| 1321 | void SetScreenSessionScale(const sptr<ScreenSession>& screenSession, float scaleX, float scaleY); | 1319 | void SetScreenSessionScale(const sptr<ScreenSession>& screenSession, float scaleX, float scaleY); |
| 1322 | void ApplyVirtualScreenScale(const sptr<ScreenSession>& screenSession, | 1320 | void ApplyVirtualScreenScale(const sptr<ScreenSession>& screenSession, |
| @@ -1335,8 +1333,6 @@ private: | |||
| 1335 | uint32_t customResolutionWidth_ = 0; | 1333 | uint32_t customResolutionWidth_ = 0; |
| 1336 | uint32_t customResolutionHeight_ = 0; | 1334 | uint32_t customResolutionHeight_ = 0; |
| 1337 | 1335 | ||
| 1338 | - std::map<ScreenId, ScreenPowerStatus> screenPowerStatusMap_; | ||
| 1339 | - std::mutex screenPowerStatusMapMutex_; | ||
| 1340 | std::function<void(sptr<ScreenSession>& screenSession, | 1336 | std::function<void(sptr<ScreenSession>& screenSession, |
| 1341 | SuperFoldStatusChangeEvents changeEvent)> propertyChangedCallback_; | 1337 | SuperFoldStatusChangeEvents changeEvent)> propertyChangedCallback_; |
| 1342 | std::mutex callbackMutex_; | 1338 | std::mutex callbackMutex_; |
| @@ -149,6 +149,8 @@ protected: | |||
| 149 | FoldScreenBasePolicy(); | 149 | FoldScreenBasePolicy(); |
| 150 | virtual ~FoldScreenBasePolicy(); | 150 | virtual ~FoldScreenBasePolicy(); |
| 151 | 151 | ||
| 152 | + virtual void PreProcessTP() {}; | ||
| 153 | + | ||
| 152 | // Avoid fold to expand process queues private variable | 154 | // Avoid fold to expand process queues private variable |
| 153 | std::atomic<int> pendingTask_{FOLD_TASK_NUM}; | 155 | std::atomic<int> pendingTask_{FOLD_TASK_NUM}; |
| 154 | std::atomic<bool> displayModeChangeRunning_ = false; | 156 | std::atomic<bool> displayModeChangeRunning_ = false; |
| @@ -0,0 +1,53 @@ | |||
| 1 | + | ||
| 2 | +/* | ||
| 3 | + * Copyright (c) 2025 Huawei Device Co., Ltd. | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | +namespace OHOS { | ||
| 29 | +namespace Rosen { | ||
| 30 | +namespace DMS { | ||
| 31 | + | ||
| 32 | +class ScreenPowerMgr { | ||
| 33 | + DISALLOW_COPY_AND_MOVE(ScreenPowerMgr); | ||
| 34 | + | ||
| 35 | +public: | ||
| 36 | + static ScreenPowerMgr& GetInstance(); | ||
| 37 | + void ClearScreenPowerStatus(ScreenId rsScreenId); | ||
| 38 | + bool IsScreenPowerOn(ScreenId rsScreenId); | ||
| 39 | + | ||
| 40 | + virtual void DoSetScreenPowerStatus(ScreenId rsScreenId, ScreenPowerStatus status); | ||
| 41 | + | ||
| 42 | +protected: | ||
| 43 | + ScreenPowerMgr(); | ||
| 44 | + void SetTpFeatureConfig(int32_t tpType, const std::string& tpConfig); | ||
| 45 | + std::mutex screenPowerStatusMapMutex_; | ||
| 46 | + std::map<ScreenId, ScreenPowerStatus> screenPowerStatusMap_; | ||
| 47 | +}; | ||
| 48 | + | ||
| 49 | +} // namespace DMS | ||
| 50 | +} // namespace Rosen | ||
| 51 | +} // namespace OHOS | ||
| 52 | + | ||
| 53 | + | ||
| @@ -124,6 +124,7 @@ void FoldScreenBasePolicy::SetTpFeatureConfig(int32_t tpType, const std::string& | |||
| 124 | { | 124 | { |
| 125 | 125 | ||
| 126 | if (isDefaultConfigType) { | 126 | if (isDefaultConfigType) { |
| 127 | + PreProcessTP(); | ||
Z | |||
| 127 | RSInterfaces::GetInstance().SetTpFeatureConfig(tpType, tpConfig.c_str()); | 128 | RSInterfaces::GetInstance().SetTpFeatureConfig(tpType, tpConfig.c_str()); |
| 128 | } else { | 129 | } else { |
| 129 | RSInterfaces::GetInstance().SetTpFeatureConfig(tpType, tpConfig.c_str(), TpFeatureConfigType::AFT_TP_FEATURE); | 130 | RSInterfaces::GetInstance().SetTpFeatureConfig(tpType, tpConfig.c_str(), TpFeatureConfigType::AFT_TP_FEATURE); |
| @@ -747,7 +748,7 @@ void FoldScreenBasePolicy::ChangeScreenDisplayModeToMainWhenFoldScreenOff(sptr<S | |||
| 747 | TLOGNI(WmsLogTag::DMS, "ChangeScreenDisplayModeToMain: IsFoldScreenOn is false, Change ScreenId to Main."); | 748 | TLOGNI(WmsLogTag::DMS, "ChangeScreenDisplayModeToMain: IsFoldScreenOn is false, Change ScreenId to Main."); |
| 748 | screenId_ = SCREEN_ID_MAIN; | 749 | screenId_ = SCREEN_ID_MAIN; |
| 749 | 750 | ||
| 750 | - RSInterfaces::GetInstance().SetTpFeatureConfig(TP_TYPE_POWER_CTRL, MAIN_TP_OFF.c_str()); | 751 | + SetTpFeatureConfig(TP_TYPE_POWER_CTRL, MAIN_TP_OFF.c_str()); |
| 751 | 752 | ||
| 752 | if (isTentMode) { | 753 | if (isTentMode) { |
| 753 | PowerMgr::PowerMgrClient::GetInstance().WakeupDeviceAsync(); | 754 | PowerMgr::PowerMgrClient::GetInstance().WakeupDeviceAsync(); |
| @@ -769,7 +770,7 @@ void FoldScreenBasePolicy::ChangeScreenDisplayModeToMain(sptr<ScreenSession> scr | |||
| 769 | } | 770 | } |
| 770 | RSInterfaces::GetInstance().NotifyScreenSwitched(); | 771 | RSInterfaces::GetInstance().NotifyScreenSwitched(); |
| 771 | 772 | ||
| 772 | - RSInterfaces::GetInstance().SetTpFeatureConfig(TP_TYPE, MAIN_TP.c_str()); | 773 | + SetTpFeatureConfig(TP_TYPE, MAIN_TP.c_str()); |
| 773 | 774 | ||
| 774 | if (PowerMgr::PowerMgrClient::GetInstance().IsFoldScreenOn() || | 775 | if (PowerMgr::PowerMgrClient::GetInstance().IsFoldScreenOn() || |
| 775 | ScreenSessionManager::GetInstance().GetCancelSuspendStatus()) { | 776 | ScreenSessionManager::GetInstance().GetCancelSuspendStatus()) { |
| @@ -827,7 +828,7 @@ void FoldScreenBasePolicy::ChangeScreenDisplayModeToFullWhenFoldScreenOff(sptr<S | |||
| 827 | screenId_ = SCREEN_ID_FULL; | 828 | screenId_ = SCREEN_ID_FULL; |
| 828 | if (reason == DisplayModeChangeReason::RECOVER) { | 829 | if (reason == DisplayModeChangeReason::RECOVER) { |
| 829 | 830 | ||
| 830 | - RSInterfaces::GetInstance().SetTpFeatureConfig(TP_TYPE_POWER_CTRL, FULL_TP_OFF.c_str()); | 831 | + SetTpFeatureConfig(TP_TYPE_POWER_CTRL, FULL_TP_OFF.c_str()); |
| 831 | 832 | ||
| 832 | } else { | 833 | } else { |
| 833 | PowerMgr::PowerMgrClient::GetInstance().WakeupDeviceAsync(); | 834 | PowerMgr::PowerMgrClient::GetInstance().WakeupDeviceAsync(); |
| @@ -850,7 +851,7 @@ void FoldScreenBasePolicy::ChangeScreenDisplayModeToFull(sptr<ScreenSession> scr | |||
| 850 | RSInterfaces::GetInstance().NotifyScreenSwitched(); | 851 | RSInterfaces::GetInstance().NotifyScreenSwitched(); |
| 851 | ReportFoldStatusChangeBegin((int32_t)SCREEN_ID_MAIN, (int32_t)SCREEN_ID_FULL); | 852 | ReportFoldStatusChangeBegin((int32_t)SCREEN_ID_MAIN, (int32_t)SCREEN_ID_FULL); |
| 852 | 853 | ||
| 853 | - RSInterfaces::GetInstance().SetTpFeatureConfig(TP_TYPE, FULL_TP.c_str()); | 854 | + SetTpFeatureConfig(TP_TYPE, FULL_TP.c_str()); |
| 854 | 855 | ||
| 855 | if (PowerMgr::PowerMgrClient::GetInstance().IsFoldScreenOn()) { | 856 | if (PowerMgr::PowerMgrClient::GetInstance().IsFoldScreenOn()) { |
| 856 | ChangeScreenDisplayModeToFullWhenFoldScreenOn(screenSession); | 857 | ChangeScreenDisplayModeToFullWhenFoldScreenOn(screenSession); |
| @@ -0,0 +1,108 @@ | |||
| 1 | +/* | ||
| 2 | + * Copyright (c) 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 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +namespace OHOS::Rosen::DMS { | ||
| 24 | + | ||
| 25 | +ScreenPowerMgr::ScreenPowerMgr() | ||
| 26 | +{ | ||
| 27 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr+"); | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +ScreenPowerMgr& ScreenPowerMgr::GetInstance() | ||
| 31 | +{ | ||
| 32 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr GetInstance+"); | ||
| 33 | + static std::mutex singletonMutex_; | ||
| 34 | + static ScreenPowerMgr* instance_ = nullptr; | ||
| 35 | + if (instance_ == nullptr) { | ||
| 36 | + std::lock_guard<std::mutex> lock(singletonMutex_); | ||
| 37 | + if (instance_ == nullptr) { | ||
| 38 | + TLOGI(WmsLogTag::DMS, "init ScreenPowerMgr from ext"); | ||
| 39 | + instance_ = ProductExtWrapper::GetExtInstance<ScreenPowerMgr>("GetScreenPowerMgr"); | ||
| 40 | + } | ||
| 41 | + if (instance_ == nullptr) { | ||
| 42 | + TLOGI(WmsLogTag::DMS, "init ScreenPowerMgr"); | ||
| 43 | + instance_ = new ScreenPowerMgr(); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return *instance_; | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +void ScreenPowerMgr::ClearScreenPowerStatus(ScreenId rsScreenId) | ||
| 50 | +{ | ||
| 51 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr ClearScreenPowerStatus+"); | ||
| 52 | + std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 53 | + screenPowerStatusMap_.erase(rsScreenId); | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +bool ScreenPowerMgr::IsScreenPowerOn(ScreenId rsScreenId) | ||
| 57 | +{ | ||
| 58 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr IsScreenPowerOn+"); | ||
| 59 | + std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 60 | + auto it = screenPowerStatusMap_.find(rsScreenId); | ||
| 61 | + if (it != screenPowerStatusMap_.end()) { | ||
| 62 | + TLOGNFI( | ||
| 63 | + WmsLogTag::DMS, "[UL_POWER]screenId: %{public}" PRIu64 " powerStatus:%{public}u", rsScreenId, it->second); | ||
| 64 | + if (it->second == ScreenPowerStatus::POWER_STATUS_ON) { | ||
| 65 | + return true; | ||
| 66 | + } | ||
| 67 | + } else { | ||
| 68 | + TLOGNFI(WmsLogTag::DMS, "[UL_POWER]cannot find screenPowerStatusMap_ id: %{public}" PRIu64, rsScreenId); | ||
| 69 | + } | ||
| 70 | + return false; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +void ScreenPowerMgr::DoSetScreenPowerStatus(ScreenId rsScreenId, ScreenPowerStatus status) | ||
| 74 | +{ | ||
| 75 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr DoSetScreenPowerStatus+"); | ||
| 76 | + bool setAdvancedOffFlag = false; | ||
| 77 | + { | ||
| 78 | + std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 79 | + auto it = screenPowerStatusMap_.find(rsScreenId); | ||
| 80 | + if (it != screenPowerStatusMap_.end() && it->second == ScreenPowerStatus::POWER_STATUS_ON_ADVANCED && | ||
| 81 | + status == ScreenPowerStatus::POWER_STATUS_OFF) { | ||
| 82 | + setAdvancedOffFlag = true; | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + // when the power status is ON_ADVANCED and need to be set to OFF,first set the status to OFF_ADVANCED. | ||
| 87 | + if (setAdvancedOffFlag) { | ||
| 88 | + TLOGNFW(WmsLogTag::DMS, | ||
| 89 | + "set the power status to OFF_ADVANCED first, screenId: %{public}" PRIu64 ", status: %{public}d.", | ||
| 90 | + rsScreenId, status); | ||
| 91 | + status = ScreenPowerStatus::POWER_STATUS_OFF_ADVANCED; | ||
| 92 | + } | ||
| 93 | + RSInterfaces::GetInstance().SetScreenPowerStatus(rsScreenId, status); | ||
| 94 | + { | ||
| 95 | + std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 96 | + screenPowerStatusMap_[rsScreenId] = status; | ||
| 97 | + } | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +void ScreenPowerMgr::SetTpFeatureConfig(int32_t tpType, const std::string& tpConfig) | ||
| 101 | +{ | ||
| 102 | + TLOGI(WmsLogTag::DMS, "ScreenPowerMgr SetTpFeatureConfig+"); | ||
| 103 | + | ||
| 104 | + RSInterfaces::GetInstance().SetTpFeatureConfig(tpType, tpConfig.c_str()); | ||
| 105 | + | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +} // namespace OHOS::Rosen::DMS | ||
| @@ -94,6 +94,7 @@ | |||
| 94 | 94 | ||
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | + | ||
| 97 | 98 | ||
| 98 | namespace OHOS::Rosen { | 99 | namespace OHOS::Rosen { |
| 99 | namespace { | 100 | namespace { |
| @@ -2895,7 +2896,7 @@ void ScreenSessionManager::HandleMapWhenScreenDisconnect(ScreenId screenId) | |||
| 2895 | physicalScreenSessionMap_.erase(screenId); | 2896 | physicalScreenSessionMap_.erase(screenId); |
| 2896 | } | 2897 | } |
| 2897 | 2898 | ||
| 2898 | - ClearScreenPowerStatus(screenId); | 2899 | + DMS::ScreenPowerMgr::GetInstance().ClearScreenPowerStatus(screenId); |
| 2899 | } | 2900 | } |
| 2900 | 2901 | ||
| 2901 | void ScreenSessionManager::HandlePCScreenDisconnect(sptr<ScreenSession>& screenSession) | 2902 | void ScreenSessionManager::HandlePCScreenDisconnect(sptr<ScreenSession>& screenSession) |
| @@ -6143,18 +6144,9 @@ bool ScreenSessionManager::DealMultiScreenOff(ScreenId screenId, ScreenPowerStat | |||
| 6143 | } | 6144 | } |
| 6144 | auto session = GetScreenSession(sid); | 6145 | auto session = GetScreenSession(sid); |
| 6145 | if (session && session->GetScreenProperty().GetScreenType() == ScreenType::REAL) { | 6146 | if (session && session->GetScreenProperty().GetScreenType() == ScreenType::REAL) { |
| 6146 | - std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | 6147 | + if (DMS::ScreenPowerMgr::GetInstance().IsScreenPowerOn(sid)) { |
| 6147 | - auto it = screenPowerStatusMap_.find(sid); | 6148 | + hasOtherScreenPowerOn = true; |
| 6148 | - if (it != screenPowerStatusMap_.end()) { | 6149 | + break; |
| 6149 | - auto powerStatus = it->second; | ||
| 6150 | - TLOGNFI(WmsLogTag::DMS, "[UL_POWER]screenId: %{public}" PRIu64 " powerStatus:%{public}u", | ||
| 6151 | - sid, powerStatus); | ||
| 6152 | - if (it->second == ScreenPowerStatus::POWER_STATUS_ON) { | ||
| 6153 | - hasOtherScreenPowerOn = true; | ||
| 6154 | - break; | ||
| 6155 | - } | ||
| 6156 | - } else { | ||
| 6157 | - TLOGNFI(WmsLogTag::DMS, "[UL_POWER]cannot find screenPowerStatusMap_ id: %{public}" PRIu64, sid); | ||
| 6158 | } | 6150 | } |
| 6159 | } | 6151 | } |
| 6160 | } | 6152 | } |
| @@ -16319,7 +16311,7 @@ bool ScreenSessionManager::SetRSScreenPowerStatusExt(ScreenId screenId, ScreenPo | |||
| 16319 | rsScreenId = screenId; | 16311 | rsScreenId = screenId; |
| 16320 | } | 16312 | } |
| 16321 | } | 16313 | } |
| 16322 | - DoSetScreenPowerStatus(rsScreenId, status); | 16314 | + DMS::ScreenPowerMgr::GetInstance().DoSetScreenPowerStatus(rsScreenId, status); |
| 16323 | if (status == ScreenPowerStatus::POWER_STATUS_ON) { | 16315 | if (status == ScreenPowerStatus::POWER_STATUS_ON) { |
| 16324 | 16316 | ||
| 16325 | int32_t ret = DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().NotifyBrightnessManagerScreenPowerStatus( | 16317 | int32_t ret = DisplayPowerMgr::DisplayPowerMgrClient::GetInstance().NotifyBrightnessManagerScreenPowerStatus( |
| @@ -16352,8 +16344,8 @@ void ScreenSessionManager::CheckAnotherScreenStatus(ScreenId screenId, ScreenPow | |||
| 16352 | return; | 16344 | return; |
| 16353 | } | 16345 | } |
| 16354 | TLOGNFI(WmsLogTag::DMS, "Another screen status is on, do on and off"); | 16346 | TLOGNFI(WmsLogTag::DMS, "Another screen status is on, do on and off"); |
| 16355 | - DoSetScreenPowerStatus(secondScreenId, ScreenPowerStatus::POWER_STATUS_ON); | 16347 | + DMS::ScreenPowerMgr::GetInstance().DoSetScreenPowerStatus(secondScreenId, ScreenPowerStatus::POWER_STATUS_ON); |
| 16356 | - DoSetScreenPowerStatus(secondScreenId, ScreenPowerStatus::POWER_STATUS_OFF); | 16348 | + DMS::ScreenPowerMgr::GetInstance().DoSetScreenPowerStatus(secondScreenId, ScreenPowerStatus::POWER_STATUS_OFF); |
| 16357 | } else { | 16349 | } else { |
| 16358 | TLOGNFI(WmsLogTag::DMS, "Another screen status is not on, set screen power status directly"); | 16350 | TLOGNFI(WmsLogTag::DMS, "Another screen status is not on, set screen power status directly"); |
| 16359 | } | 16351 | } |
| @@ -17670,38 +17662,6 @@ bool ScreenSessionManager::GetScreenLcdStatus(ScreenId screenId, PanelPowerStatu | |||
| 17670 | return true; | 17662 | return true; |
| 17671 | } | 17663 | } |
| 17672 | 17664 | ||
| 17673 | -void ScreenSessionManager::DoSetScreenPowerStatus(ScreenId rsScreenId, ScreenPowerStatus status) | ||
| 17674 | -{ | ||
| 17675 | - bool setAdvancedOffFlag = false; | ||
| 17676 | - { | ||
| 17677 | - std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 17678 | - auto it = screenPowerStatusMap_.find(rsScreenId); | ||
| 17679 | - if (it != screenPowerStatusMap_.end() && it->second == ScreenPowerStatus::POWER_STATUS_ON_ADVANCED && | ||
| 17680 | - status == ScreenPowerStatus::POWER_STATUS_OFF) { | ||
| 17681 | - setAdvancedOffFlag = true; | ||
| 17682 | - } | ||
| 17683 | - } | ||
| 17684 | - | ||
| 17685 | - // when the power status is ON_ADVANCED and need to be set to OFF,first set the status to OFF_ADVANCED. | ||
| 17686 | - if (setAdvancedOffFlag) { | ||
| 17687 | - TLOGNFW(WmsLogTag::DMS, | ||
| 17688 | - "set the power status to OFF_ADVANCED first, screenId: %{public}" PRIu64 ", status: %{public}d.", rsScreenId, | ||
| 17689 | - status); | ||
| 17690 | - status = ScreenPowerStatus::POWER_STATUS_OFF_ADVANCED; | ||
| 17691 | - } | ||
| 17692 | - rsInterface_.SetScreenPowerStatus(rsScreenId, status); | ||
| 17693 | - { | ||
| 17694 | - std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 17695 | - screenPowerStatusMap_[rsScreenId] = status; | ||
| 17696 | - } | ||
| 17697 | -} | ||
| 17698 | - | ||
| 17699 | -void ScreenSessionManager::ClearScreenPowerStatus(ScreenId rsScreenId) | ||
| 17700 | -{ | ||
| 17701 | - std::lock_guard<std::mutex> lock(screenPowerStatusMapMutex_); | ||
| 17702 | - screenPowerStatusMap_.erase(rsScreenId); | ||
| 17703 | -} | ||
| 17704 | - | ||
| 17705 | void ScreenSessionManager::UpdateSwitchUser(bool userSwitching) | 17665 | void ScreenSessionManager::UpdateSwitchUser(bool userSwitching) |
| 17706 | { | 17666 | { |
| 17707 | std::unique_lock<std::mutex> lock(switchUserMutex_); | 17667 | std::unique_lock<std::mutex> lock(switchUserMutex_); |
| @@ -122,6 +122,7 @@ test_source_common = [ | |||
| 122 | "${window_base_path}/window_scene/screen_session_manager/infra/src/common/product_config.cpp", | 122 | "${window_base_path}/window_scene/screen_session_manager/infra/src/common/product_config.cpp", |
| 123 | "${window_base_path}/window_scene/screen_session_manager/infra/src/common/product_ext_wrapper.cpp", | 123 | "${window_base_path}/window_scene/screen_session_manager/infra/src/common/product_ext_wrapper.cpp", |
| 124 | "${window_base_path}/window_scene/screen_session_manager/infra/src/ffrt/ffrt_queue.cpp", | 124 | "${window_base_path}/window_scene/screen_session_manager/infra/src/ffrt/ffrt_queue.cpp", |
| 125 | + "${window_base_path}/window_scene/screen_session_manager/infra/src/screen_power/screen_power_mgr.cpp", | ||
| 125 | 126 | ||
| 126 | # ScreenSession | 127 | # ScreenSession |
| 127 | "${window_base_path}/window_scene/session/screen/src/screen_property.cpp", | 128 | "${window_base_path}/window_scene/session/screen/src/screen_property.cpp", |
| @@ -210,6 +211,7 @@ config("dms_unittest_base_config") { | |||
| 210 | "${window_base_path}/window_scene/screen_session_manager/infra/include/fold_screen", | 211 | "${window_base_path}/window_scene/screen_session_manager/infra/include/fold_screen", |
| 211 | "${window_base_path}/window_scene/screen_session_manager/infra/include/common", | 212 | "${window_base_path}/window_scene/screen_session_manager/infra/include/common", |
| 212 | "${window_base_path}/window_scene/screen_session_manager/infra/include/ffrt", | 213 | "${window_base_path}/window_scene/screen_session_manager/infra/include/ffrt", |
| 214 | + "${window_base_path}/window_scene/screen_session_manager/infra/include/screen_power", | ||
| 213 | "${window_base_path}/window_scene/screen_session_manager/include/zidl", | 215 | "${window_base_path}/window_scene/screen_session_manager/include/zidl", |
| 214 | "${window_base_path}/window_scene/session_manager_service/include", | 216 | "${window_base_path}/window_scene/session_manager_service/include", |
| 215 | 217 | ||
前置处理问什么加到这里?