diff --git a/utils/include/vsync_station.h b/utils/include/vsync_station.h index c8f6d4325ae38f42e20903d53237060a4a7ff1ae..6d50a995f000aa3914f640a7a0b45b0a7e96234c 100644 --- a/utils/include/vsync_station.h +++ b/utils/include/vsync_station.h @@ -16,6 +16,7 @@ #ifndef OHOS_VSYNC_STATION_H #define OHOS_VSYNC_STATION_H +#include #include #include @@ -49,6 +50,9 @@ public: void SetDisplaySoloistFrameRateLinkerEnable(bool enabled); void SetUiDvsyncSwitch(bool dvsyncSwitch); + void DecreaseRequestVsyncTimes() { requestVsyncTimes_--; } + int32_t GetRequestVsyncTimes() { return requestVsyncTimes_.load(); } + private: std::shared_ptr GetOrCreateVsyncReceiver(); std::shared_ptr GetOrCreateVsyncReceiverLocked(); @@ -70,6 +74,8 @@ private: using Callbacks = std::unordered_set>; Callbacks vsyncCallbacks_; // Above guarded by mutex_ + + std::atomic requestVsyncTimes_ {0}; }; } // namespace Rosen } // namespace OHOS diff --git a/utils/src/vsync_station.cpp b/utils/src/vsync_station.cpp index 49cda795570823be4a524954efb4f744d109d4dd..e815859b854d5621808ac9e0b31d5243d2905ba0 100644 --- a/utils/src/vsync_station.cpp +++ b/utils/src/vsync_station.cpp @@ -141,6 +141,7 @@ __attribute__((no_sanitize("cfi"))) void VsyncStation::RequestVsync( vsyncHandler_->PostTask(task, vsyncTimeoutTaskName_, VSYNC_TIME_OUT_MILLISECONDS); } + requestVsyncTimes_++; WindowFrameTraceImpl::GetInstance()->VsyncStartFrameTrace(); auto task = [weakThis = weak_from_this()] (int64_t timestamp, int64_t frameCount, void* client) { @@ -262,6 +263,5 @@ void VsyncStation::SetUiDvsyncSwitch(bool dvsyncSwitch) receiver->SetUiDvsyncSwitch(dvsyncSwitch); } } - } // namespace Rosen } // namespace OHOS diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index 8ddf16774538ccca450f51e7f807cd2e114b5adb..958b8576deff730fe994e023d7525e6fc04cf145 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -562,6 +562,38 @@ void JsSceneSessionManager::ProcessAbilityManagerCollaboratorRegistered() SceneSessionManager::GetInstance().SetAbilityManagerCollaboratorRegisteredFunc(func); } +void JsSceneSessionManager::RegisterRootSceneCallbacksOnSSManager() +{ + RegisterDumpRootSceneElementInfoListener(); + RegisterVirtualPixelRatioChangeListener(); + SceneSessionManager::GetInstance().SetRootSceneProcessBackEventFunc([this] { + TLOGND(WmsLogTag::WMS_EVENT, "rootScene BackEvent"); + this->OnRootSceneBackEvent(); + }); + SceneSessionManager::GetInstance().SetOnFlushUIParamsFunc([] { + RootScene::staticRootScene_->OnFlushUIParams(); + }); + SceneSessionManager::GetInstance().SetIsRootSceneLastFrameLayoutFinishedFunc([] { + return RootScene::staticRootScene_->IsLastFrameLayoutFinished(); + }); +} + +void JsSceneSessionManager::RegisterSSManagerCallbacksOnRootScene() +{ + rootScene_->SetGetSessionRectCallback([](AvoidAreaType type) { + return SceneSessionManager::GetInstance().GetRootSessionAvoidSessionRect(type); + }); + if (!Session::IsScbCoreEnabled()) { + rootScene_->SetFrameLayoutFinishCallback([] { + SceneSessionManager::GetInstance().NotifyUpdateRectAfterLayout(); + SceneSessionManager::GetInstance().FlushWindowInfoToMMI(); + }); + } + RootScene::SetOnConfigurationUpdatedCallback([](const std::shared_ptr& configuration) { + SceneSessionManager::GetInstance().OnConfigurationUpdated(configuration); + }); +} + napi_value JsSceneSessionManager::RegisterCallback(napi_env env, napi_callback_info info) { WLOGFD("[NAPI]"); @@ -1463,31 +1495,14 @@ napi_value JsSceneSessionManager::OnGetRootSceneSession(napi_env env, napi_callb rootScene_ = sptr::MakeSptr(); } RootScene::staticRootScene_ = rootScene_; - RegisterDumpRootSceneElementInfoListener(); - RegisterVirtualPixelRatioChangeListener(); rootSceneSession->SetLoadContentFunc([rootScene = rootScene_] (const std::string& contentUrl, napi_env env, napi_value storage, AbilityRuntime::Context* context) { rootScene->LoadContent(contentUrl, env, storage, context); ScenePersistentStorage::InitDir(context->GetPreferencesDir()); SceneSessionManager::GetInstance().InitPersistentStorage(); }); - rootScene_->SetGetSessionRectCallback([](AvoidAreaType type) { - return SceneSessionManager::GetInstance().GetRootSessionAvoidSessionRect(type); - }); - if (!Session::IsScbCoreEnabled()) { - rootScene_->SetFrameLayoutFinishCallback([]() { - SceneSessionManager::GetInstance().NotifyUpdateRectAfterLayout(); - SceneSessionManager::GetInstance().FlushWindowInfoToMMI(); - }); - } - RootSceneProcessBackEventFunc processBackEventFunc = [this]() { - TLOGD(WmsLogTag::WMS_EVENT, "rootScene BackEvent"); - this->OnRootSceneBackEvent(); - }; - SceneSessionManager::GetInstance().SetRootSceneProcessBackEventFunc(processBackEventFunc); - RootScene::SetOnConfigurationUpdatedCallback([](const std::shared_ptr& configuration) { - SceneSessionManager::GetInstance().OnConfigurationUpdated(configuration); - }); + RegisterRootSceneCallbacksOnSSManager(); + RegisterSSManagerCallbacksOnRootScene(); napi_value jsRootSceneSessionObj = JsRootSceneSession::Create(env, rootSceneSession); if (jsRootSceneSessionObj == nullptr) { WLOGFE("[NAPI]jsRootSceneSessionObj is nullptr"); diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.h b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.h index 1b9776d35d3e2fa1bd5f23c5351bc0bc8b15cf79..650a047946f08f36d331c03929c7324661e40d8b 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.h +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.h @@ -221,6 +221,8 @@ private: std::shared_ptr GetJSCallback(const std::string& functionName); void ProcessAbilityManagerCollaboratorRegistered(); void OnAbilityManagerCollaboratorRegistered(); + void RegisterRootSceneCallbacksOnSSManager(); + void RegisterSSManagerCallbacksOnRootScene(); napi_env env_; std::shared_mutex jsCbMapMutex_; diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index a61dec6da768f6a4e3952ea304d4e7a241689b9d..b7154d9c11e791ee15cc4536c9ad60bd36fd2031 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -90,6 +90,7 @@ using NotifyMainWindowTopmostChangeFunc = std::function; using NotifyPrivacyModeChangeFunc = std::function; using UpdateGestureBackEnabledCallback = std::function; using NotifyVisibleChangeFunc = std::function; +using IsLastFrameLayoutFinishedFunc = std::function; class SceneSession : public Session { public: @@ -284,11 +285,13 @@ public: WSError GetAllAvoidAreas(std::map& avoidAreas) override; WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty); void SetIsStatusBarVisible(bool isVisible); + WSError SetIsStatusBarVisibleInner(bool isVisible); WSError UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) override; void UpdateRotationAvoidArea(); bool CheckGetAvoidAreaAvailable(AvoidAreaType type) override; bool GetIsDisplayStatusBarTemporarily() const; void SetIsDisplayStatusBarTemporarily(bool isTemporary); + void SetIsLastFrameLayoutFinishedFunc(IsLastFrameLayoutFinishedFunc&& func); void SetAbilitySessionInfo(std::shared_ptr abilityInfo); void SetWindowDragHotAreaListener(const NotifyWindowDragHotAreaFunc& func); @@ -517,6 +520,10 @@ protected: bool NotifyServerToUpdateRect(const SessionUIParam& uiParam, SizeChangeReason reason); bool UpdateScaleInner(float scaleX, float scaleY, float pivotX, float pivotY); bool UpdateZOrderInner(uint32_t zOrder); + + /** + * Window Immersive + */ virtual void NotifyClientToUpdateAvoidArea(); bool PipelineNeedNotifyClientToUpdateAvoidArea(uint32_t dirty) const; @@ -531,6 +538,10 @@ protected: sptr keyboardSession_ = nullptr; NotifyKeyboardGravityChangeFunc keyboardGravityChangeFunc_; NotifyKeyboardLayoutAdjustFunc adjustKeyboardLayoutFunc_; + + /** + * Window Immersive + */ NotifySystemBarPropertyChangeFunc onSystemBarPropertyChange_; /* @@ -545,14 +556,18 @@ protected: private: void NotifyAccessibilityVisibilityChange(); + void CalculateCombinedExtWindowFlags(); + void HandleStyleEvent(MMI::WindowArea area) override; + WSError HandleEnterWinwdowArea(int32_t windowX, int32_t windowY); + + /** + * Window Immersive + */ void CalculateAvoidAreaRect(WSRect& rect, WSRect& avoidRect, AvoidArea& avoidArea) const; void GetSystemAvoidArea(WSRect& rect, AvoidArea& avoidArea); void GetCutoutAvoidArea(WSRect& rect, AvoidArea& avoidArea); void GetKeyboardAvoidArea(WSRect& rect, AvoidArea& avoidArea); - void CalculateCombinedExtWindowFlags(); void GetAINavigationBarArea(WSRect rect, AvoidArea& avoidArea) const; - void HandleStyleEvent(MMI::WindowArea area) override; - WSError HandleEnterWinwdowArea(int32_t windowX, int32_t windowY); /* * Window Lifecycle @@ -683,7 +698,6 @@ private: SessionEventParam sessionEventParam_ = { 0, 0, 0, 0 }; std::atomic_bool isStartMoving_ { false }; std::atomic_bool isVisibleForAccessibility_ { true }; - std::atomic_bool isDisplayStatusBarTemporarily_ { false }; bool isSystemSpecificSession_ { false }; std::atomic_bool shouldHideNonSecureWindows_ { false }; std::shared_mutex combinedExtWindowFlagsMutex_; @@ -711,7 +725,6 @@ private: bool isScreenAngleMismatch_ = false; uint32_t targetScreenWidth_ = 0; uint32_t targetScreenHeight_ = 0; - bool isStatusBarVisible_ = true; // WMSPipeline-related: only accessed on SSM thread PostProcessFocusState postProcessFocusState_; @@ -752,6 +765,13 @@ private: * Window Rotation */ NotifyReqOrientationChangeFunc onRequestedOrientationChange_; + + /** + * Window Immersive + */ + std::atomic_bool isDisplayStatusBarTemporarily_ { false }; + bool isStatusBarVisible_ = true; + IsLastFrameLayoutFinishedFunc isLastFrameLayoutFinishedFunc_; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 3c4d81708ce093b093398e537e8798f691dd80c1..4cb9e68a47f0796681ec62445e2d3b52f557b855 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -1304,14 +1304,45 @@ WSError SceneSession::SetSystemBarProperty(WindowType type, SystemBarProperty sy } void SceneSession::SetIsStatusBarVisible(bool isVisible) +{ + auto task = [weakThis = wptr(this), isVisible] { + sptr sceneSession = weakThis.promote(); + if (sceneSession == nullptr) { + TLOGNE(WmsLogTag::WMS_IMMS, "session is null"); + return; + } + sceneSession->SetIsStatusBarVisibleInner(isVisible); + }; + PostTask(task, __func__); +} + +WSError SceneSession::SetIsStatusBarVisibleInner(bool isVisible) { bool isNeedNotify = isStatusBarVisible_ != isVisible; - TLOGI(WmsLogTag::WMS_IMMS, "Window [%{public}d, %{public}s] status bar visible %{public}u, need notify %{public}u", - GetPersistentId(), GetWindowName().c_str(), isVisible, isNeedNotify); + TLOGI(WmsLogTag::WMS_IMMS, "Window [%{public}d, %{public}s] status bar visible %{public}u, " + "need notify %{public}u", GetPersistentId(), GetWindowName().c_str(), isVisible, isNeedNotify); isStatusBarVisible_ = isVisible; - if (isNeedNotify && specificCallback_ && specificCallback_->onUpdateAvoidAreaByType_) { - specificCallback_->onUpdateAvoidAreaByType_(GetPersistentId(), AvoidAreaType::TYPE_SYSTEM); + if (!isNeedNotify) { + return WSError::WS_OK; + } + if (isLastFrameLayoutFinishedFunc_ == nullptr) { + TLOGE(WmsLogTag::WMS_IMMS, "isLastFrameLayoutFinishedFunc is null, id: %{public}d", GetPersistentId()); + return WSError::WS_ERROR_NULLPTR; } + bool isLayoutFinished = false; + WSError ret = isLastFrameLayoutFinishedFunc_(isLayoutFinished); + if (ret != WSError::WS_OK) { + TLOGE(WmsLogTag::WMS_IMMS, "isLastFrameLayoutFinishedFunc failed: %{public}d", ret); + return ret; + } + if (isLayoutFinished) { + if (specificCallback_ && specificCallback_->onUpdateAvoidAreaByType_) { + specificCallback_->onUpdateAvoidAreaByType_(GetPersistentId(), AvoidAreaType::TYPE_SYSTEM); + } + } else { + dirtyFlags_ |= static_cast(SessionUIDirtyFlag::AVOID_AREA); + } + return WSError::WS_OK; } void SceneSession::NotifyPropertyWhenConnect() @@ -4670,6 +4701,11 @@ bool SceneSession::GetIsDisplayStatusBarTemporarily() const return isDisplayStatusBarTemporarily_.load(); } +void SceneSession::SetIsLastFrameLayoutFinishedFunc(IsLastFrameLayoutFinishedFunc&& func) +{ + isLastFrameLayoutFinishedFunc_ = std::move(func); +} + void SceneSession::SetStartingWindowExitAnimationFlag(bool enable) { TLOGI(WmsLogTag::DEFAULT, "SetStartingWindowExitAnimationFlag %{public}d", enable); diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index 8b5829b91c100d5dbe32e41020990eee4beeb28b..d20fd06b8c10d75e398db2d03853bdeb46a3d874 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -117,6 +117,8 @@ using DumpUITreeFunc = std::function; using RootSceneProcessBackEventFunc = std::function; using ProcessCloseTargetFloatWindowFunc = std::function; using AbilityManagerCollaboratorRegisteredFunc = std::function; +using OnFlushUIParamsFunc = std::function; +using IsRootSceneLastFrameLayoutFinishedFunc = std::function; class AppAnrListener : public IRemoteStub { public: @@ -279,11 +281,9 @@ public: WSError GetBatchAbilityInfos(const std::vector& bundleNames, int32_t userId, std::vector& scbAbilityInfos); WSError PrepareTerminate(int32_t persistentId, bool& isPrepareTerminate); - WSError GetIsLayoutFullScreen(bool& isLayoutFullScreen); WSError TerminateSessionNew( const sptr info, bool needStartCaller, bool isFromBroker = false) override; - WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) override; WSError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener) override; WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId, SessionSnapshot& snapshot, bool isLowResolution) override; @@ -364,10 +364,15 @@ public: /* * Window Immersive */ + WSError GetIsLayoutFullScreen(bool& isLayoutFullScreen); + WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) override; bool GetImmersiveState(ScreenId screenId); WSError NotifyStatusBarShowStatus(int32_t persistentId, bool isVisible); WSError NotifyAINavigationBarShowStatus(bool isVisible, WSRect barArea, uint64_t displayId); WSRect GetAINavigationBarArea(uint64_t displayId); + void ClearDisplayStatusBarTemporarilyFlags(); + void SetOnFlushUIParamsFunc(OnFlushUIParamsFunc&& func); + void SetIsRootSceneLastFrameLayoutFinishedFunc(IsRootSceneLastFrameLayoutFinishedFunc&& func); WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) override; void DealwithVisibilityChange(const std::vector>& visibilityChangeInfos, @@ -421,7 +426,6 @@ public: WSError GetFreeMultiWindowEnableState(bool& enable) override; const SystemSessionConfig& GetSystemSessionConfig() const; - void ClearDisplayStatusBarTemporarilyFlags(); WSError NotifyEnterRecentTask(bool enterRecent); WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo); WMError GetAllMainWindowInfos(std::vector& infos) const; @@ -620,6 +624,9 @@ private: void UpdateNormalSessionAvoidArea(const int32_t& persistentId, sptr& sceneSession, bool& needUpdate); void UpdateAvoidArea(int32_t persistentId); void UpdateAvoidAreaByType(int32_t persistentId, AvoidAreaType type); + WSError IsLastFrameLayoutFinished(bool& isLayoutFinished); + void HandleSpecificSystemBarProperty(WindowType type, const sptr& property, + const sptr& sceneSession); sptr GetBundleManager(); std::shared_ptr GetResourceManager(const AppExecFwk::AbilityInfo& abilityInfo); @@ -642,8 +649,6 @@ private: WSError UpdateBrightness(int32_t persistentId); void SetDisplayBrightness(float brightness); float GetDisplayBrightness() const; - void HandleSpecificSystemBarProperty(WindowType type, const sptr& property, - const sptr& sceneSession); void HandleHideNonSystemFloatingWindows(const sptr& property, const sptr& sceneSession); void UpdateForceHideState(const sptr& sceneSession, const sptr& property, @@ -801,9 +806,6 @@ private: std::mutex privacyBundleMapMutex_; std::unordered_map> privacyBundleMap_; - bool isAINavigationBarVisible_ = false; - std::shared_mutex currAINavigationBarAreaMapMutex_; - std::map currAINavigationBarAreaMap_; WindowModeType lastWindowModeType_ { WindowModeType::WINDOW_MODE_OTHER }; // Multi User @@ -981,6 +983,15 @@ private: */ bool IsInSecondaryScreen(const sptr& sceneSession); + /** + * Window Immersive + */ + OnFlushUIParamsFunc onFlushUIParamsFunc_; + IsRootSceneLastFrameLayoutFinishedFunc isRootSceneLastFrameLayoutFinishedFunc_; + bool isAINavigationBarVisible_ = false; + std::shared_mutex currAINavigationBarAreaMapMutex_; + std::map currAINavigationBarAreaMap_; + struct SessionInfoList { int32_t uid_; std::string bundleName_; diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index 208005dbea03c153991bab3190c156447a36eff0..b0020732b1837136f22c33243c0532ce9275e426 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -1531,6 +1531,9 @@ sptr SceneSessionManager::CreateSceneSession(const SessionInfo& se if (sceneSession->moveDragController_) { sceneSession->moveDragController_->SetIsPcWindow(systemConfig_.IsPcWindow()); } + sceneSession->SetIsLastFrameLayoutFinishedFunc([this](bool& isLayoutFinished) { + return this->IsLastFrameLayoutFinished(isLayoutFinished); + }); } return sceneSession; } @@ -4547,6 +4550,16 @@ void SceneSessionManager::SetDumpUITreeFunc(const DumpUITreeFunc& func) dumpUITreeFunc_ = func; } +void SceneSessionManager::SetOnFlushUIParamsFunc(OnFlushUIParamsFunc&& func) +{ + onFlushUIParamsFunc_ = std::move(func); +} + +void SceneSessionManager::SetIsRootSceneLastFrameLayoutFinishedFunc(IsRootSceneLastFrameLayoutFinishedFunc&& func) +{ + isRootSceneLastFrameLayoutFinishedFunc_ = std::move(func); +} + void FocusIDChange(int32_t persistentId, sptr& sceneSession) { // notify RS @@ -9209,6 +9222,9 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map& return taskScheduler_->PostSyncTask(task, "GetDisplayIdByWindowId"); } +WSError SceneSessionManager::IsLastFrameLayoutFinished(bool& isLayoutFinished) +{ + if (isRootSceneLastFrameLayoutFinishedFunc_ == nullptr) { + TLOGE(WmsLogTag::WMS_IMMS, "isRootSceneLastFrameLayoutFinishedFunc is null"); + return WSError::WS_ERROR_NULLPTR; + } + isLayoutFinished = isRootSceneLastFrameLayoutFinishedFunc_(); + return WSError::WS_OK; +} } // namespace OHOS::Rosen \ No newline at end of file diff --git a/window_scene/test/unittest/scene_session_test.cpp b/window_scene/test/unittest/scene_session_test.cpp index f080ec1d3c6c5c68ec891321efc04409dc75765b..437a7cc9699631eb093313f0f475225b09cfe9fb 100644 --- a/window_scene/test/unittest/scene_session_test.cpp +++ b/window_scene/test/unittest/scene_session_test.cpp @@ -2130,6 +2130,48 @@ HWTEST_F(SceneSessionTest, SetSessionGlobalRect, Function | SmallTest | Level2) sceneSession->SetScbCoreEnabled(true); EXPECT_EQ(test, sceneSession->GetSessionGlobalRect()); } + +/** + * @tc.name: SetSessionGlobalRect/GetSessionGlobalRect + * @tc.desc: SetSessionGlobalRect + * @tc.type: FUNC + */ +HWTEST_F(SceneSessionTest, SetIsStatusBarVisibleInner01, Function | SmallTest | Level2) +{ + SessionInfo info; + info.abilityName_ = "SetIsStatusBarVisibleInner01"; + info.bundleName_ = "SetIsStatusBarVisibleInner01"; + info.windowType_ = 1; + sptr specificCallback = + sptr::MakeSptr(); + EXPECT_NE(specificCallback, nullptr); + sptr sceneSession = sptr::MakeSptr(info, specificCallback); + EXPECT_NE(sceneSession, nullptr); + sceneSession->isStatusBarVisible_ = true; + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_OK); + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_ERROR_NULLPTR); + + sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) { + return WSError::WS_ERROR_NULLPTR; + }; + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_ERROR_NULLPTR); + + sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) { + isLayoutFinished = false; + return WSError::WS_OK; + }; + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK); + + sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) { + isLayoutFinished = true; + return WSError::WS_OK; + }; + sceneSession->specificCallback_->onUpdateAvoidAreaByType_ = [](int32_t persistentId, AvoidAreaType type) {}; + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_OK); + + sceneSession->specificCallback_ = nullptr; + EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK); +} } // namespace } // Rosen } // OHOS \ No newline at end of file diff --git a/wm/include/root_scene.h b/wm/include/root_scene.h index 3c888f903d9c6ec6c41e011b4802c8be84f0f35c..ff4a16e24a5580370115d4ae9762031fa749a310 100644 --- a/wm/include/root_scene.h +++ b/wm/include/root_scene.h @@ -52,6 +52,12 @@ public: int64_t GetVSyncPeriod() override; void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType = 0) override; + /** + * Window Immersive + */ + bool IsLastFrameLayoutFinished(); + void OnFlushUIParams(); + void OnBundleUpdated(const std::string& bundleName); static void SetOnConfigurationUpdatedCallback( const std::function&)>& callback); diff --git a/wm/src/root_scene.cpp b/wm/src/root_scene.cpp index 77fc862df8d48a22c90b29c7acfe76fc14a180d6..327914aec3331009dbcc07e114d9f7921686c0ea 100644 --- a/wm/src/root_scene.cpp +++ b/wm/src/root_scene.cpp @@ -184,6 +184,18 @@ void RootScene::FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, vsyncStation_->FlushFrameRate(rate, animatorExpectedFrameRate, rateType); } +bool RootScene::IsLastFrameLayoutFinished() +{ + int32_t requestTimes = vsyncStation_->GetRequestVsyncTimes(); + TLOGI(WmsLogTag::WMS_LAYOUT, "vsync request times: %{public}d", requestTimes); + return requestTimes <= 0; +} + +void RootScene::OnFlushUIParams() +{ + vsyncStation_->DecreaseRequestVsyncTimes(); +} + void RootScene::OnBundleUpdated(const std::string& bundleName) { WLOGFD("bundle %{public}s updated", bundleName.c_str());