diff --git a/dm/src/display.cpp b/dm/src/display.cpp index 80ebe6b1..c1caf606 100644 --- a/dm/src/display.cpp +++ b/dm/src/display.cpp @@ -64,7 +64,13 @@ int32_t Display::GetHeight() const uint32_t Display::GetFreshRate() const { UpdateDisplayInfo(); - return pImpl_->GetDisplayInfo()->GetFreshRate(); + return pImpl_->GetDisplayInfo()->GetRefreshRate(); +} + +uint32_t Display::GetRefreshRate() const +{ + UpdateDisplayInfo(); + return pImpl_->GetDisplayInfo()->GetRefreshRate(); } ScreenId Display::GetScreenId() const diff --git a/dm/test/systemtest/display_change_test.cpp b/dm/test/systemtest/display_change_test.cpp index 20c75de2..cbcdff39 100644 --- a/dm/test/systemtest/display_change_test.cpp +++ b/dm/test/systemtest/display_change_test.cpp @@ -137,6 +137,10 @@ bool DisplayChangeTest::ScreenSizeEqual(const sptr screen, const sptr display, const sptr curInfo) { + if (display == nullptr || curInfo == nullptr) { + WLOGFI("param is nullptr"); + return false; + } uint32_t dWidth = static_cast(display->GetWidth()); uint32_t dHeight = static_cast(display->GetHeight()); WLOGI("DisplaySizeEqual:: DisplaySize: %{public}u %{public}u, ActiveModeInfoSize: %{public}u %{public}u", diff --git a/dm/test/systemtest/screenshot_cmd_test.cpp b/dm/test/systemtest/screenshot_cmd_test.cpp index e50cd609..39e719b5 100644 --- a/dm/test/systemtest/screenshot_cmd_test.cpp +++ b/dm/test/systemtest/screenshot_cmd_test.cpp @@ -50,10 +50,9 @@ void ScreenshotCmdTest::SetUpTestCase() if (display == nullptr) { WLOGFE("GetDefaultDisplay: failed!\n"); return; - } else { - WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(), - display->GetHeight(), display->GetFreshRate()); } + WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(), + display->GetHeight(), display->GetRefreshRate()); defaultId_ = display->GetId(); } diff --git a/dm/test/systemtest/screenshot_test.cpp b/dm/test/systemtest/screenshot_test.cpp index 0bf59885..5c9aa3fc 100644 --- a/dm/test/systemtest/screenshot_test.cpp +++ b/dm/test/systemtest/screenshot_test.cpp @@ -51,10 +51,9 @@ void ScreenshotTest::SetUpTestCase() if (display == nullptr) { WLOGFE("GetDefaultDisplay: failed!\n"); return; - } else { - WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(), - display->GetHeight(), display->GetFreshRate()); } + WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(), + display->GetHeight(), display->GetRefreshRate()); defaultId_ = display->GetId(); defaultScreen_ = {0, 0, display->GetWidth(), display->GetHeight()}; diff --git a/dmserver/include/abstract_display.h b/dmserver/include/abstract_display.h index 1710cdc7..993ea08c 100644 --- a/dmserver/include/abstract_display.h +++ b/dmserver/include/abstract_display.h @@ -29,7 +29,7 @@ public: constexpr static float DEFAULT_VIRTUAL_PIXEL_RATIO = 1.0; constexpr static uint32_t DEFAULT_FRESH_RATE = 60; AbstractDisplay(const DisplayInfo* info); - AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t freshRate); + AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t refreshRate); ~AbstractDisplay() = default; static inline bool IsVertical(Rotation rotation) { @@ -38,7 +38,7 @@ public: DisplayId GetId() const; int32_t GetWidth() const; int32_t GetHeight() const; - uint32_t GetFreshRate() const; + uint32_t GetRefreshRate() const; float GetVirtualPixelRatio() const; ScreenId GetAbstractScreenId() const; bool BindAbstractScreen(ScreenId dmsScreenId); @@ -48,7 +48,7 @@ public: void SetId(DisplayId displayId); void SetWidth(int32_t width); void SetHeight(int32_t height); - void SetFreshRate(uint32_t freshRate); + void SetRefreshRate(uint32_t refreshRate); void SetVirtualPixelRatio(float virtualPixelRatio); void SetOrientation(Orientation orientation); bool RequestRotation(Rotation rotation); @@ -59,7 +59,7 @@ private: ScreenId screenId_ { SCREEN_ID_INVALID }; int32_t width_ { 0 }; int32_t height_ { 0 }; - uint32_t freshRate_ { 0 }; + uint32_t refreshRate_ { 0 }; float virtualPixelRatio_ { 1.0 }; Rotation rotation_ { Rotation::ROTATION_0 }; Orientation orientation_ { Orientation::UNSPECIFIED }; diff --git a/dmserver/src/abstract_display.cpp b/dmserver/src/abstract_display.cpp index 2a0edf6d..c2e9b36b 100644 --- a/dmserver/src/abstract_display.cpp +++ b/dmserver/src/abstract_display.cpp @@ -33,15 +33,15 @@ AbstractDisplay::AbstractDisplay(const DisplayInfo* info) id_ = info->GetDisplayId(); width_ = info->GetWidth(); height_ = info->GetHeight(); - freshRate_ = info->GetFreshRate(); + refreshRate_ = info->GetRefreshRate(); } -AbstractDisplay::AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t freshRate) +AbstractDisplay::AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t refreshRate) : id_(id), screenId_(screenId), width_(width), height_(height), - freshRate_(freshRate) + refreshRate_(refreshRate) { } @@ -60,9 +60,9 @@ int32_t AbstractDisplay::GetHeight() const return height_; } -uint32_t AbstractDisplay::GetFreshRate() const +uint32_t AbstractDisplay::GetRefreshRate() const { - return freshRate_; + return refreshRate_; } float AbstractDisplay::GetVirtualPixelRatio() const @@ -80,9 +80,9 @@ void AbstractDisplay::SetHeight(int32_t height) height_ = height; } -void AbstractDisplay::SetFreshRate(uint32_t freshRate) +void AbstractDisplay::SetRefreshRate(uint32_t refreshRate) { - freshRate_ = freshRate; + refreshRate_ = refreshRate; } void AbstractDisplay::SetVirtualPixelRatio(float virtualPixelRatio) @@ -141,7 +141,7 @@ bool AbstractDisplay::BindAbstractScreen(sptr abstractScreen) } width_ = static_cast(info->width_); height_ = static_cast(info->height_); - freshRate_ = info->freshRate_; + refreshRate_ = info->refreshRate_; screenId_ = dmsScreenId; WLOGD("display bound to screen. display:%{public}" PRIu64", screen:%{public}" PRIu64"", id_, dmsScreenId); return true; @@ -158,7 +158,7 @@ sptr AbstractDisplay::ConvertToDisplayInfo() const displayInfo->width_ = width_; displayInfo->height_ = height_; displayInfo->id_ = id_; - displayInfo->freshRate_ = freshRate_; + displayInfo->refreshRate_ = refreshRate_; displayInfo->screenId_ = screenId_; displayInfo->rotation_ = rotation_; displayInfo->orientation_ = orientation_; diff --git a/dmserver/src/abstract_display_controller.cpp b/dmserver/src/abstract_display_controller.cpp index 0a1a5c87..3b52928f 100644 --- a/dmserver/src/abstract_display_controller.cpp +++ b/dmserver/src/abstract_display_controller.cpp @@ -352,7 +352,7 @@ void AbstractDisplayController::BindAloneScreenLocked(sptr realA return; } sptr display = new AbstractDisplay(displayCount_.fetch_add(1), - realAbsScreen->dmsId_, info->width_, info->height_, info->freshRate_); + realAbsScreen->dmsId_, info->width_, info->height_, info->refreshRate_); abstractDisplayMap_.insert((std::make_pair(display->GetId(), display))); WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"", realAbsScreen->dmsId_, display->GetId()); @@ -395,7 +395,7 @@ void AbstractDisplayController::AddScreenToExpandLocked(sptr abs return; } sptr display = new AbstractDisplay(displayCount_.fetch_add(1), - absScreen->dmsId_, info->width_, info->height_, info->freshRate_); + absScreen->dmsId_, info->width_, info->height_, info->refreshRate_); abstractDisplayMap_.insert((std::make_pair(display->GetId(), display))); WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"", absScreen->dmsId_, display->GetId()); diff --git a/dmserver/src/abstract_screen_controller.cpp b/dmserver/src/abstract_screen_controller.cpp index 0fd21648..cccf566c 100644 --- a/dmserver/src/abstract_screen_controller.cpp +++ b/dmserver/src/abstract_screen_controller.cpp @@ -300,7 +300,7 @@ bool AbstractScreenController::FillAbstractScreen(sptr& absScree sptr info = new SupportedScreenModes(); info->width_ = static_cast(rsScreenModeInfo.GetScreenWidth()); info->height_ = static_cast(rsScreenModeInfo.GetScreenHeight()); - info->freshRate_ = rsScreenModeInfo.GetScreenFreshRate(); + info->refreshRate_ = rsScreenModeInfo.GetScreenFreshRate(); absScreen->modes_.push_back(info); WLOGD("fill screen w/h:%{public}d/%{public}d", info->width_, info->height_); } @@ -449,7 +449,7 @@ ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption optio info->height_ = option.height_; auto defaultScreen = GetAbstractScreen(GetDefaultAbstractScreenId()); if (defaultScreen != nullptr && defaultScreen->GetActiveScreenMode() != nullptr) { - info->freshRate_ = defaultScreen->GetActiveScreenMode()->freshRate_; + info->refreshRate_ = defaultScreen->GetActiveScreenMode()->refreshRate_; } absScreen->modes_.push_back(info); absScreen->activeIdx_ = 0; diff --git a/dmserver/src/display_manager_proxy.cpp b/dmserver/src/display_manager_proxy.cpp index c04e140d..7a9e4669 100644 --- a/dmserver/src/display_manager_proxy.cpp +++ b/dmserver/src/display_manager_proxy.cpp @@ -748,8 +748,8 @@ sptr DisplayManagerProxy::GetScreenInfoById(ScreenId screenId) return nullptr; } for (auto& mode : info->GetModes()) { - WLOGFI("info modes is width: %{public}u, height: %{public}u, freshRate: %{public}u", - mode->width_, mode->height_, mode->freshRate_); + WLOGFI("info modes is width: %{public}u, height: %{public}u, refreshRate: %{public}u", + mode->width_, mode->height_, mode->refreshRate_); } return info; } diff --git a/dmserver/src/display_manager_stub.cpp b/dmserver/src/display_manager_stub.cpp index 12576707..2ec850e5 100644 --- a/dmserver/src/display_manager_stub.cpp +++ b/dmserver/src/display_manager_stub.cpp @@ -181,8 +181,8 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, ScreenId screenId = static_cast(data.ReadUint64()); auto screenInfo = GetScreenInfoById(screenId); for (auto& mode : screenInfo->GetModes()) { - WLOGFI("info modes is width: %{public}u, height: %{public}u, freshRate: %{public}u", - mode->width_, mode->height_, mode->freshRate_); + WLOGFI("info modes is width: %{public}u, height: %{public}u, refreshRate: %{public}u", + mode->width_, mode->height_, mode->refreshRate_); } reply.WriteStrongParcelable(screenInfo); break; diff --git a/interfaces/innerkits/dm/display.h b/interfaces/innerkits/dm/display.h index 243e2907..18781a9c 100644 --- a/interfaces/innerkits/dm/display.h +++ b/interfaces/innerkits/dm/display.h @@ -38,6 +38,7 @@ public: int32_t GetWidth() const; int32_t GetHeight() const; uint32_t GetFreshRate() const; + uint32_t GetRefreshRate() const; ScreenId GetScreenId() const; float GetVirtualPixelRatio() const; Rotation GetRotation() const; diff --git a/interfaces/innerkits/dm/screen.h b/interfaces/innerkits/dm/screen.h index ccd86666..e30a8294 100644 --- a/interfaces/innerkits/dm/screen.h +++ b/interfaces/innerkits/dm/screen.h @@ -37,7 +37,7 @@ struct Point { struct SupportedScreenModes : public RefBase { uint32_t width_; uint32_t height_; - uint32_t freshRate_; + uint32_t refreshRate_; }; struct VirtualScreenOption { diff --git a/interfaces/kits/napi/display_runtime/napi/js_screen.cpp b/interfaces/kits/napi/display_runtime/napi/js_screen.cpp index 56dc4811..7816b858 100644 --- a/interfaces/kits/napi/display_runtime/napi/js_screen.cpp +++ b/interfaces/kits/napi/display_runtime/napi/js_screen.cpp @@ -211,10 +211,10 @@ NativeValue* CreateJsScreenModeObject(NativeEngine& engine, sptrwidth_; uint32_t height = mode->height_; - uint32_t freshRate = mode->freshRate_; + uint32_t refreshRate = mode->refreshRate_; optionObject->SetProperty("width", CreateJsValue(engine, width)); optionObject->SetProperty("height", CreateJsValue(engine, height)); - optionObject->SetProperty("freshRate", CreateJsValue(engine, freshRate)); + optionObject->SetProperty("freshRate", CreateJsValue(engine, refreshRate)); return objValue; } } // namespace Rosen diff --git a/utils/include/display_info.h b/utils/include/display_info.h index 4df74e3a..c0d31126 100644 --- a/utils/include/display_info.h +++ b/utils/include/display_info.h @@ -40,6 +40,7 @@ public: DEFINE_VAR_DEFAULT_FUNC_GET(int32_t, Width, width, 0); DEFINE_VAR_DEFAULT_FUNC_GET(int32_t, Height, height, 0); DEFINE_VAR_DEFAULT_FUNC_GET(uint32_t, FreshRate, freshRate, 0); + DEFINE_VAR_DEFAULT_FUNC_GET(uint32_t, RefreshRate, refreshRate, 0); DEFINE_VAR_DEFAULT_FUNC_GET(ScreenId, ScreenId, screenId, SCREEN_ID_INVALID); DEFINE_VAR_DEFAULT_FUNC_GET(float, XDpi, xDpi, 0.0f); DEFINE_VAR_DEFAULT_FUNC_GET(float, YDpi, yDpi, 0.0f); diff --git a/utils/src/display_info.cpp b/utils/src/display_info.cpp index f7e7bc74..e8b894b4 100644 --- a/utils/src/display_info.cpp +++ b/utils/src/display_info.cpp @@ -20,7 +20,7 @@ bool DisplayInfo::Marshalling(Parcel &parcel) const { return parcel.WriteUint64(id_) && parcel.WriteUint32(type_) && parcel.WriteInt32(width_) && parcel.WriteInt32(height_) && - parcel.WriteUint32(freshRate_) && parcel.WriteUint64(screenId_) && + parcel.WriteUint32(freshRate_) && parcel.WriteUint32(refreshRate_) && parcel.WriteUint64(screenId_) && parcel.WriteFloat(xDpi_) && parcel.WriteFloat(yDpi_) && parcel.WriteUint32(static_cast(rotation_)) && parcel.WriteUint32(static_cast(orientation_)); @@ -34,7 +34,8 @@ DisplayInfo *DisplayInfo::Unmarshalling(Parcel &parcel) uint32_t orientation; bool res = parcel.ReadUint64(displayInfo->id_) && parcel.ReadUint32(type) && parcel.ReadInt32(displayInfo->width_) && parcel.ReadInt32(displayInfo->height_) && - parcel.ReadUint32(displayInfo->freshRate_) && parcel.ReadUint64(displayInfo->screenId_) && + parcel.ReadUint32(displayInfo->freshRate_) && + parcel.ReadUint32(displayInfo->refreshRate_) && parcel.ReadUint64(displayInfo->screenId_) && parcel.ReadFloat(displayInfo->xDpi_) && parcel.ReadFloat(displayInfo->yDpi_) && parcel.ReadUint32(rotation) && parcel.ReadUint32(orientation); if (!res) { diff --git a/utils/src/screen_info.cpp b/utils/src/screen_info.cpp index ab752112..47a8b062 100644 --- a/utils/src/screen_info.cpp +++ b/utils/src/screen_info.cpp @@ -31,7 +31,7 @@ bool ScreenInfo::Marshalling(Parcel &parcel) const for (uint32_t modeIndex = 0; modeIndex < modes_.size(); modeIndex++) { if (parcel.WriteUint32(modes_[modeIndex]->height_) && parcel.WriteUint32(modes_[modeIndex]->width_) && - parcel.WriteUint32(modes_[modeIndex]->freshRate_)) { + parcel.WriteUint32(modes_[modeIndex]->refreshRate_)) { continue; } return false; @@ -71,7 +71,7 @@ bool ScreenInfo::InnerUnmarshalling(Parcel& parcel) sptr mode = new SupportedScreenModes(); if (parcel.ReadUint32(mode->height_) && parcel.ReadUint32(mode->width_) && - parcel.ReadUint32(mode->freshRate_)) { + parcel.ReadUint32(mode->refreshRate_)) { modes_.push_back(mode); } else { return false; diff --git a/wmserver/include/window_controller.h b/wmserver/include/window_controller.h index b1606de0..c593262f 100644 --- a/wmserver/include/window_controller.h +++ b/wmserver/include/window_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at