1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#include <cinttypes> 17885b47fbSopenharmony_ci#include "display_manager.h" 18885b47fbSopenharmony_ci#include "display.h" 19885b47fbSopenharmony_ci#include "dm_common.h" 20885b47fbSopenharmony_ci#include "singleton_delegator.h" 21885b47fbSopenharmony_ci#include "window/window_manager/utils/include/display_info.h" 22885b47fbSopenharmony_ci 23885b47fbSopenharmony_cinamespace OHOS::Rosen { 24885b47fbSopenharmony_ciWM_IMPLEMENT_SINGLE_INSTANCE(DisplayManager) 25885b47fbSopenharmony_ciclass DisplayManager::Impl : public RefBase { 26885b47fbSopenharmony_ci friend class DisplayManager; 27885b47fbSopenharmony_ci 28885b47fbSopenharmony_ciprivate: 29885b47fbSopenharmony_ci bool CheckRectValid(const Media::Rect& rect, int32_t oriHeight, int32_t oriWidth) const; 30885b47fbSopenharmony_ci bool CheckSizeValid(const Media::Size& size, int32_t oriHeight, int32_t oriWidth) const; 31885b47fbSopenharmony_ci void ClearDisplayStateCallback(); 32885b47fbSopenharmony_ci}; 33885b47fbSopenharmony_ci 34885b47fbSopenharmony_cibool DisplayManager::Impl::CheckRectValid(const Media::Rect& rect, int32_t oriHeight, int32_t oriWidth) const 35885b47fbSopenharmony_ci{ 36885b47fbSopenharmony_ci return true; 37885b47fbSopenharmony_ci} 38885b47fbSopenharmony_ci 39885b47fbSopenharmony_cibool DisplayManager::Impl::CheckSizeValid(const Media::Size& size, int32_t oriHeight, int32_t oriWidth) const 40885b47fbSopenharmony_ci{ 41885b47fbSopenharmony_ci return true; 42885b47fbSopenharmony_ci} 43885b47fbSopenharmony_ci 44885b47fbSopenharmony_civoid DisplayManager::Impl::ClearDisplayStateCallback() 45885b47fbSopenharmony_ci{} 46885b47fbSopenharmony_ci 47885b47fbSopenharmony_ciDisplayManager::DisplayManager() 48885b47fbSopenharmony_ci{} 49885b47fbSopenharmony_ci 50885b47fbSopenharmony_ciDisplayManager::~DisplayManager() 51885b47fbSopenharmony_ci{} 52885b47fbSopenharmony_ci 53885b47fbSopenharmony_ciDisplayId DisplayManager::GetDefaultDisplayId() 54885b47fbSopenharmony_ci{ 55885b47fbSopenharmony_ci DisplayId id {0}; 56885b47fbSopenharmony_ci return id; 57885b47fbSopenharmony_ci} 58885b47fbSopenharmony_ci 59885b47fbSopenharmony_cisptr<Display> DisplayManager::GetDisplayById(DisplayId displayId) 60885b47fbSopenharmony_ci{ 61885b47fbSopenharmony_ci sptr<Display> display = new Display("display_mock", nullptr); 62885b47fbSopenharmony_ci return display; 63885b47fbSopenharmony_ci} 64885b47fbSopenharmony_ci 65885b47fbSopenharmony_cistd::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId, DmErrorCode* errorCode) 66885b47fbSopenharmony_ci{ 67885b47fbSopenharmony_ci return nullptr; 68885b47fbSopenharmony_ci} 69885b47fbSopenharmony_ci 70885b47fbSopenharmony_cistd::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId, 71885b47fbSopenharmony_ci const Media::Rect& rect, const Media::Size& size, int rotation, DmErrorCode* errorCode) 72885b47fbSopenharmony_ci{ 73885b47fbSopenharmony_ci return nullptr; 74885b47fbSopenharmony_ci} 75885b47fbSopenharmony_ci 76885b47fbSopenharmony_cisptr<Display> DisplayManager::GetDefaultDisplay() 77885b47fbSopenharmony_ci{ 78885b47fbSopenharmony_ci return GetDisplayById(GetDefaultDisplayId()); 79885b47fbSopenharmony_ci} 80885b47fbSopenharmony_ci 81885b47fbSopenharmony_cistd::vector<DisplayId> DisplayManager::GetAllDisplayIds() 82885b47fbSopenharmony_ci{ 83885b47fbSopenharmony_ci std::vector<DisplayId> res = {}; 84885b47fbSopenharmony_ci return res; 85885b47fbSopenharmony_ci} 86885b47fbSopenharmony_ci 87885b47fbSopenharmony_cistd::vector<sptr<Display>> DisplayManager::GetAllDisplays() 88885b47fbSopenharmony_ci{ 89885b47fbSopenharmony_ci std::vector<sptr<Display>> res; 90885b47fbSopenharmony_ci return res; 91885b47fbSopenharmony_ci} 92885b47fbSopenharmony_ci 93885b47fbSopenharmony_ciDMError DisplayManager::RegisterDisplayListener(sptr<IDisplayListener> listener) 94885b47fbSopenharmony_ci{ 95885b47fbSopenharmony_ci return DMError::DM_OK; 96885b47fbSopenharmony_ci} 97885b47fbSopenharmony_ci 98885b47fbSopenharmony_ciDMError DisplayManager::UnregisterDisplayListener(sptr<IDisplayListener> listener) 99885b47fbSopenharmony_ci{ 100885b47fbSopenharmony_ci return DMError::DM_OK; 101885b47fbSopenharmony_ci} 102885b47fbSopenharmony_ci 103885b47fbSopenharmony_ciDMError DisplayManager::RegisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener) 104885b47fbSopenharmony_ci{ 105885b47fbSopenharmony_ci return DMError::DM_OK; 106885b47fbSopenharmony_ci} 107885b47fbSopenharmony_ci 108885b47fbSopenharmony_ciDMError DisplayManager::UnregisterDisplayPowerEventListener(sptr<IDisplayPowerEventListener> listener) 109885b47fbSopenharmony_ci{ 110885b47fbSopenharmony_ci return DMError::DM_OK; 111885b47fbSopenharmony_ci} 112885b47fbSopenharmony_ci 113885b47fbSopenharmony_cibool DisplayManager::WakeUpBegin(PowerStateChangeReason reason) 114885b47fbSopenharmony_ci{ 115885b47fbSopenharmony_ci return true; 116885b47fbSopenharmony_ci} 117885b47fbSopenharmony_ci 118885b47fbSopenharmony_cibool DisplayManager::WakeUpEnd() 119885b47fbSopenharmony_ci{ 120885b47fbSopenharmony_ci return true; 121885b47fbSopenharmony_ci} 122885b47fbSopenharmony_ci 123885b47fbSopenharmony_cibool DisplayManager::SuspendBegin(PowerStateChangeReason reason) 124885b47fbSopenharmony_ci{ 125885b47fbSopenharmony_ci return true; 126885b47fbSopenharmony_ci} 127885b47fbSopenharmony_ci 128885b47fbSopenharmony_cibool DisplayManager::SuspendEnd() 129885b47fbSopenharmony_ci{ 130885b47fbSopenharmony_ci return true; 131885b47fbSopenharmony_ci} 132885b47fbSopenharmony_ci 133885b47fbSopenharmony_cibool DisplayManager::SetDisplayState(DisplayState state, DisplayStateCallback callback) 134885b47fbSopenharmony_ci{ 135885b47fbSopenharmony_ci return true; 136885b47fbSopenharmony_ci} 137885b47fbSopenharmony_ci 138885b47fbSopenharmony_ciDisplayState DisplayManager::GetDisplayState(DisplayId displayId) 139885b47fbSopenharmony_ci{ 140885b47fbSopenharmony_ci DisplayState state = DisplayState::UNKNOWN; 141885b47fbSopenharmony_ci return state; 142885b47fbSopenharmony_ci} 143885b47fbSopenharmony_ci 144885b47fbSopenharmony_cibool DisplayManager::SetScreenBrightness(uint64_t screenId, uint32_t level) 145885b47fbSopenharmony_ci{ 146885b47fbSopenharmony_ci return true; 147885b47fbSopenharmony_ci} 148885b47fbSopenharmony_ci 149885b47fbSopenharmony_ciuint32_t DisplayManager::GetScreenBrightness(uint64_t screenId) const 150885b47fbSopenharmony_ci{ 151885b47fbSopenharmony_ci return 0; 152885b47fbSopenharmony_ci} 153885b47fbSopenharmony_ci 154885b47fbSopenharmony_civoid DisplayManager::NotifyDisplayEvent(DisplayEvent event) 155885b47fbSopenharmony_ci{} 156885b47fbSopenharmony_ci} // namespace OHOS::Rosen