mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
use vsync calc layout state
Signed-off-by: hfwang0318 <wanghaofan@huawei.com>
This commit is contained in:
parent
29572e5934
commit
ad1afd1e30
@ -16,6 +16,7 @@
|
||||
#ifndef OHOS_VSYNC_STATION_H
|
||||
#define OHOS_VSYNC_STATION_H
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
@ -48,6 +49,11 @@ public:
|
||||
void SetFrameRateLinkerEnable(bool enabled);
|
||||
void SetDisplaySoloistFrameRateLinkerEnable(bool enabled);
|
||||
void SetUiDvsyncSwitch(bool dvsyncSwitch);
|
||||
void OnFlushUIParams();
|
||||
uint32_t GetRequestTimes()
|
||||
{
|
||||
return requestTimes_.load();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<VSyncReceiver> GetOrCreateVsyncReceiver();
|
||||
@ -65,6 +71,7 @@ private:
|
||||
bool isFirstVsyncBack_ = true;
|
||||
bool destroyed_ = false;
|
||||
bool hasRequestedVsync_ = false;
|
||||
std::atomic<uint32_t> requestTimes_;
|
||||
std::shared_ptr<VSyncReceiver> receiver_ = nullptr;
|
||||
std::shared_ptr<RSFrameRateLinker> frameRateLinker_ = nullptr;
|
||||
using Callbacks = std::unordered_set<std::shared_ptr<VsyncCallback>>;
|
||||
|
@ -141,6 +141,7 @@ __attribute__((no_sanitize("cfi"))) void VsyncStation::RequestVsync(
|
||||
vsyncHandler_->PostTask(task, vsyncTimeoutTaskName_, VSYNC_TIME_OUT_MILLISECONDS);
|
||||
}
|
||||
|
||||
requestTimes_++;
|
||||
WindowFrameTraceImpl::GetInstance()->VsyncStartFrameTrace();
|
||||
auto task = [weakThis = weak_from_this()]
|
||||
(int64_t timestamp, int64_t frameCount, void* client) {
|
||||
@ -263,5 +264,9 @@ void VsyncStation::SetUiDvsyncSwitch(bool dvsyncSwitch)
|
||||
}
|
||||
}
|
||||
|
||||
void VsyncStation::OnFlushUIParams()
|
||||
{
|
||||
requestTimes_--;
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -562,6 +562,41 @@ void JsSceneSessionManager::ProcessAbilityManagerCollaboratorRegistered()
|
||||
SceneSessionManager::GetInstance().SetAbilityManagerCollaboratorRegisteredFunc(func);
|
||||
}
|
||||
|
||||
void JsSceneSessionManager::ProcessSSMCallbackOnRootScene()
|
||||
{
|
||||
RegisterDumpRootSceneElementInfoListener();
|
||||
RegisterVirtualPixelRatioChangeListener();
|
||||
RootSceneProcessBackEventFunc processBackEventFunc = [this]() {
|
||||
TLOGD(WmsLogTag::WMS_EVENT, "rootScene BackEvent");
|
||||
this->OnRootSceneBackEvent();
|
||||
};
|
||||
SceneSessionManager::GetInstance().SetRootSceneProcessBackEventFunc(processBackEventFunc);
|
||||
auto onFlushUIParamsFunc = []() {
|
||||
RootScene::staticRootScene_->OnFlushUIParams();
|
||||
};
|
||||
SceneSessionManager::GetInstance().SetOnFlushUIParamsFunc(onFlushUIParamsFunc);
|
||||
auto getIsLayoutFinishedFunc = []() {
|
||||
return RootScene::staticRootScene_->IsLayoutFinished();
|
||||
};
|
||||
SceneSessionManager::GetInstance().SetGetIsLayoutFinishedFunc(getIsLayoutFinishedFunc);
|
||||
}
|
||||
|
||||
void JsSceneSessionManager::ProcessRootSceneCallbackOnSSM()
|
||||
{
|
||||
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<AppExecFwk::Configuration>& configuration) {
|
||||
SceneSessionManager::GetInstance().OnConfigurationUpdated(configuration);
|
||||
});
|
||||
}
|
||||
|
||||
napi_value JsSceneSessionManager::RegisterCallback(napi_env env, napi_callback_info info)
|
||||
{
|
||||
WLOGFD("[NAPI]");
|
||||
@ -1463,31 +1498,14 @@ napi_value JsSceneSessionManager::OnGetRootSceneSession(napi_env env, napi_callb
|
||||
rootScene_ = sptr<RootScene>::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<AppExecFwk::Configuration>& configuration) {
|
||||
SceneSessionManager::GetInstance().OnConfigurationUpdated(configuration);
|
||||
});
|
||||
ProcessSSMCallbackOnRootScene();
|
||||
ProcessRootSceneCallbackOnSSM();
|
||||
napi_value jsRootSceneSessionObj = JsRootSceneSession::Create(env, rootSceneSession);
|
||||
if (jsRootSceneSessionObj == nullptr) {
|
||||
WLOGFE("[NAPI]jsRootSceneSessionObj is nullptr");
|
||||
|
@ -221,6 +221,8 @@ private:
|
||||
std::shared_ptr<NativeReference> GetJSCallback(const std::string& functionName);
|
||||
void ProcessAbilityManagerCollaboratorRegistered();
|
||||
void OnAbilityManagerCollaboratorRegistered();
|
||||
void ProcessSSMCallbackOnRootScene();
|
||||
void ProcessRootSceneCallbackOnSSM();
|
||||
|
||||
napi_env env_;
|
||||
std::shared_mutex jsCbMapMutex_;
|
||||
|
@ -90,6 +90,7 @@ using NotifyMainWindowTopmostChangeFunc = std::function<void(bool isTopmost)>;
|
||||
using NotifyPrivacyModeChangeFunc = std::function<void(uint32_t isPrivacyMode)>;
|
||||
using UpdateGestureBackEnabledCallback = std::function<void(int32_t persistentId)>;
|
||||
using NotifyVisibleChangeFunc = std::function<void(int32_t persistentId)>;
|
||||
using GetIsLayoutFinishedFunc = std::function<WSError(bool& isLayoutFinished)>;
|
||||
|
||||
class SceneSession : public Session {
|
||||
public:
|
||||
@ -283,11 +284,13 @@ public:
|
||||
WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override;
|
||||
WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty);
|
||||
void SetIsStatusBarVisible(bool isVisible);
|
||||
WSError SetIsStatusBarVisibleTask(bool isVisible);
|
||||
WSError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) override;
|
||||
void UpdateRotationAvoidArea();
|
||||
bool CheckGetAvoidAreaAvailable(AvoidAreaType type) override;
|
||||
bool GetIsDisplayStatusBarTemporarily() const;
|
||||
void SetIsDisplayStatusBarTemporarily(bool isTemporary);
|
||||
void SetGetIsLayoutFinishedFunc(GetIsLayoutFinishedFunc&& getIsLayoutFinishedFunc);
|
||||
|
||||
void SetAbilitySessionInfo(std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo);
|
||||
void SetWindowDragHotAreaListener(const NotifyWindowDragHotAreaFunc& func);
|
||||
@ -513,6 +516,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;
|
||||
|
||||
@ -527,6 +534,10 @@ protected:
|
||||
sptr<SceneSession> keyboardSession_ = nullptr;
|
||||
NotifyKeyboardGravityChangeFunc keyboardGravityChangeFunc_;
|
||||
NotifyKeyboardLayoutAdjustFunc adjustKeyboardLayoutFunc_;
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
*/
|
||||
NotifySystemBarPropertyChangeFunc onSystemBarPropertyChange_;
|
||||
|
||||
/*
|
||||
@ -536,15 +547,19 @@ protected:
|
||||
|
||||
private:
|
||||
void NotifyAccessibilityVisibilityChange();
|
||||
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 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 GetAINavigationBarArea(WSRect rect, AvoidArea &avoidArea) const;
|
||||
|
||||
/*
|
||||
* Window Lifecycle
|
||||
*/
|
||||
@ -676,7 +691,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_;
|
||||
@ -704,7 +718,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_;
|
||||
@ -740,6 +753,13 @@ private:
|
||||
* Window Visibility
|
||||
*/
|
||||
NotifyVisibleChangeFunc notifyVisibleChangeFunc_;
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
*/
|
||||
std::atomic_bool isDisplayStatusBarTemporarily_ { false };
|
||||
bool isStatusBarVisible_ = true;
|
||||
GetIsLayoutFinishedFunc getIsLayoutFinishedFunc_;
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
#endif // OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_H
|
||||
|
@ -1305,14 +1305,45 @@ WSError SceneSession::SetSystemBarProperty(WindowType type, SystemBarProperty sy
|
||||
}
|
||||
|
||||
void SceneSession::SetIsStatusBarVisible(bool isVisible)
|
||||
{
|
||||
auto task = [weakThis = wptr(this), isVisible]() {
|
||||
sptr<SceneSession> self = weakThis.promote();
|
||||
if (self == nullptr) {
|
||||
TLOGNE(WmsLogTag::WMS_IMMS, "session is null");
|
||||
return;
|
||||
}
|
||||
self->SetIsStatusBarVisibleTask(isVisible);
|
||||
};
|
||||
PostTask(task, __func__);
|
||||
}
|
||||
|
||||
WSError SceneSession::SetIsStatusBarVisibleTask(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 (getIsLayoutFinishedFunc_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "getIsLayoutFinishedFunc_ is null, id: %{public}d", GetPersistentId());
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
bool isLayoutFinished = false;
|
||||
WSError ret = getIsLayoutFinishedFunc_(isLayoutFinished);
|
||||
if (ret != WSError::WS_OK) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "getIsLayoutFinishedFunc_ failed: %{public}d", ret);
|
||||
return ret;
|
||||
}
|
||||
if (isLayoutFinished) {
|
||||
if (specificCallback_ && specificCallback_->onUpdateAvoidAreaByType_) {
|
||||
specificCallback_->onUpdateAvoidAreaByType_(GetPersistentId(), AvoidAreaType::TYPE_SYSTEM);
|
||||
}
|
||||
} else {
|
||||
dirtyFlags_ |= static_cast<uint32_t>(SessionUIDirtyFlag::AVOID_AREA);
|
||||
}
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
void SceneSession::NotifyPropertyWhenConnect()
|
||||
@ -4663,6 +4694,11 @@ bool SceneSession::GetIsDisplayStatusBarTemporarily() const
|
||||
return isDisplayStatusBarTemporarily_.load();
|
||||
}
|
||||
|
||||
void SceneSession::SetGetIsLayoutFinishedFunc(GetIsLayoutFinishedFunc&& getIsLayoutFinishedFunc)
|
||||
{
|
||||
getIsLayoutFinishedFunc_ = std::move(getIsLayoutFinishedFunc);
|
||||
}
|
||||
|
||||
void SceneSession::SetStartingWindowExitAnimationFlag(bool enable)
|
||||
{
|
||||
TLOGI(WmsLogTag::DEFAULT, "SetStartingWindowExitAnimationFlag %{public}d", enable);
|
||||
|
@ -117,6 +117,8 @@ using DumpUITreeFunc = std::function<void(uint64_t, std::string& dumpInfo)>;
|
||||
using RootSceneProcessBackEventFunc = std::function<void()>;
|
||||
using ProcessCloseTargetFloatWindowFunc = std::function<void(const std::string& bundleName)>;
|
||||
using AbilityManagerCollaboratorRegisteredFunc = std::function<void()>;
|
||||
using OnFlushUIParamsFunc = std::function<void()>;
|
||||
using GetIsLayoutFinishedOnRootSceneFunc = std::function<bool()>;
|
||||
|
||||
class AppAnrListener : public IRemoteStub<AppExecFwk::IAppDebugListener> {
|
||||
public:
|
||||
@ -279,11 +281,9 @@ public:
|
||||
WSError GetBatchAbilityInfos(const std::vector<std::string>& bundleNames, int32_t userId,
|
||||
std::vector<SCBAbilityInfo>& scbAbilityInfos);
|
||||
WSError PrepareTerminate(int32_t persistentId, bool& isPrepareTerminate);
|
||||
WSError GetIsLayoutFullScreen(bool& isLayoutFullScreen);
|
||||
|
||||
WSError TerminateSessionNew(
|
||||
const sptr<AAFwk::SessionInfo> 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 SetGetIsLayoutFinishedFunc(GetIsLayoutFinishedOnRootSceneFunc&& func);
|
||||
|
||||
WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) override;
|
||||
void DealwithVisibilityChange(const std::vector<std::pair<uint64_t, WindowVisibilityState>>& visibilityChangeInfos,
|
||||
@ -416,7 +421,6 @@ public:
|
||||
WSError SwitchFreeMultiWindow(bool enable);
|
||||
WSError GetFreeMultiWindowEnableState(bool& enable) override;
|
||||
const SystemSessionConfig& GetSystemSessionConfig() const;
|
||||
void ClearDisplayStatusBarTemporarilyFlags();
|
||||
WSError NotifyEnterRecentTask(bool enterRecent);
|
||||
WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo);
|
||||
WMError GetAllMainWindowInfos(std::vector<MainWindowInfo>& infos) const;
|
||||
@ -614,6 +618,9 @@ private:
|
||||
void UpdateNormalSessionAvoidArea(const int32_t& persistentId, sptr<SceneSession>& sceneSession, bool& needUpdate);
|
||||
void UpdateAvoidArea(int32_t persistentId);
|
||||
void UpdateAvoidAreaByType(int32_t persistentId, AvoidAreaType type);
|
||||
WSError IsLayoutFinished(bool& isLayoutFinished);
|
||||
void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty> &property,
|
||||
const sptr<SceneSession> &sceneSession);
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> GetBundleManager();
|
||||
std::shared_ptr<Global::Resource::ResourceManager> GetResourceManager(const AppExecFwk::AbilityInfo& abilityInfo);
|
||||
@ -636,8 +643,6 @@ private:
|
||||
WSError UpdateBrightness(int32_t persistentId);
|
||||
void SetDisplayBrightness(float brightness);
|
||||
float GetDisplayBrightness() const;
|
||||
void HandleSpecificSystemBarProperty(WindowType type, const sptr<WindowSessionProperty>& property,
|
||||
const sptr<SceneSession>& sceneSession);
|
||||
void HandleHideNonSystemFloatingWindows(const sptr<WindowSessionProperty>& property,
|
||||
const sptr<SceneSession>& sceneSession);
|
||||
void UpdateForceHideState(const sptr<SceneSession>& sceneSession, const sptr<WindowSessionProperty>& property,
|
||||
@ -795,9 +800,6 @@ private:
|
||||
std::mutex privacyBundleMapMutex_;
|
||||
std::unordered_map<DisplayId, std::unordered_set<std::string>> privacyBundleMap_;
|
||||
|
||||
bool isAINavigationBarVisible_ = false;
|
||||
std::shared_mutex currAINavigationBarAreaMapMutex_;
|
||||
std::map<uint64_t, WSRect> currAINavigationBarAreaMap_;
|
||||
WindowModeType lastWindowModeType_ { WindowModeType::WINDOW_MODE_OTHER };
|
||||
|
||||
// Multi User
|
||||
@ -975,6 +977,15 @@ private:
|
||||
*/
|
||||
bool IsInSecondaryScreen(const sptr<SceneSession>& sceneSession);
|
||||
|
||||
/**
|
||||
* Window Immersive
|
||||
*/
|
||||
OnFlushUIParamsFunc onFlushUIParamsFunc_;
|
||||
GetIsLayoutFinishedOnRootSceneFunc getIsLayoutFinishedOnRootSceneFunc_;
|
||||
bool isAINavigationBarVisible_ = false;
|
||||
std::shared_mutex currAINavigationBarAreaMapMutex_;
|
||||
std::map<uint64_t, WSRect> currAINavigationBarAreaMap_;
|
||||
|
||||
struct SessionInfoList {
|
||||
int32_t uid_;
|
||||
std::string bundleName_;
|
||||
|
@ -1215,7 +1215,7 @@ WSRect SceneSessionManager::GetRootSessionAvoidSessionRect(AvoidAreaType type)
|
||||
const WSRect rect = session->GetSessionRect();
|
||||
TLOGI(WmsLogTag::WMS_IMMS, "type: %{public}u, rect: %{public}s", type, rect.ToString().c_str());
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -1526,6 +1526,9 @@ sptr<SceneSession> SceneSessionManager::CreateSceneSession(const SessionInfo& se
|
||||
if (sceneSession->moveDragController_) {
|
||||
sceneSession->moveDragController_->SetIsPcWindow(systemConfig_.IsPcWindow());
|
||||
}
|
||||
sceneSession->SetGetIsLayoutFinishedFunc([this](bool& isLayoutFinished) {
|
||||
return this->IsLayoutFinished(isLayoutFinished);
|
||||
});
|
||||
}
|
||||
return sceneSession;
|
||||
}
|
||||
@ -4542,6 +4545,16 @@ void SceneSessionManager::SetDumpUITreeFunc(const DumpUITreeFunc& func)
|
||||
dumpUITreeFunc_ = func;
|
||||
}
|
||||
|
||||
void SceneSessionManager::SetOnFlushUIParamsFunc(OnFlushUIParamsFunc&& func)
|
||||
{
|
||||
onFlushUIParamsFunc_ = std::move(func);
|
||||
}
|
||||
|
||||
void SceneSessionManager::SetGetIsLayoutFinishedFunc(GetIsLayoutFinishedOnRootSceneFunc&& func)
|
||||
{
|
||||
getIsLayoutFinishedOnRootSceneFunc_ = std::move(func);
|
||||
}
|
||||
|
||||
void FocusIDChange(int32_t persistentId, sptr<SceneSession>& sceneSession)
|
||||
{
|
||||
// notify RS
|
||||
@ -9194,6 +9207,9 @@ void SceneSessionManager::FlushUIParams(ScreenId screenId, std::unordered_map<in
|
||||
if (!Session::IsScbCoreEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (onFlushUIParamsFunc_ != nullptr) {
|
||||
onFlushUIParamsFunc_();
|
||||
}
|
||||
auto task = [this, screenId, uiParams = std::move(uiParams)]() {
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "SceneSessionManager::FlushUIParams");
|
||||
TLOGD(WmsLogTag::WMS_PIPELINE, "FlushUIParams");
|
||||
@ -11298,4 +11314,13 @@ WMError SceneSessionManager::GetDisplayIdByWindowId(const std::vector<uint64_t>&
|
||||
return taskScheduler_->PostSyncTask(task, "GetDisplayIdByWindowId");
|
||||
}
|
||||
|
||||
WSError SceneSessionManager::IsLayoutFinished(bool& isLayoutFinished)
|
||||
{
|
||||
if (getIsLayoutFinishedOnRootSceneFunc_ == nullptr) {
|
||||
TLOGE(WmsLogTag::WMS_IMMS, "getIsLayoutFinishedOnRootSceneFunc_ is null");
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
}
|
||||
isLayoutFinished = getIsLayoutFinishedOnRootSceneFunc_();
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
@ -2173,6 +2173,57 @@ 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, SetIsStatusBarVisibleTask01, Function | SmallTest | Level2)
|
||||
{
|
||||
SessionInfo info;
|
||||
info.abilityName_ = "SetIsStatusBarVisibleTask01";
|
||||
info.bundleName_ = "SetIsStatusBarVisibleTask01";
|
||||
info.windowType_ = 1;
|
||||
sptr<Rosen::ISession> session_;
|
||||
sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
|
||||
sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
|
||||
EXPECT_NE(specificCallback_, nullptr);
|
||||
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback_);
|
||||
EXPECT_NE(sceneSession, nullptr);
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(true), WSError::WS_OK);
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_ERROR_NULLPTR);
|
||||
|
||||
sceneSession->getIsLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
|
||||
return WSError::WS_ERROR_NULLPTR;
|
||||
};
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_ERROR_NULLPTR);
|
||||
|
||||
sceneSession->getIsLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
|
||||
isLayoutFinished = false;
|
||||
return WSError::WS_OK;
|
||||
};
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_OK);
|
||||
|
||||
sceneSession->getIsLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
|
||||
isLayoutFinished = true;
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
sceneSession->specificCallback_->onUpdateAvoidAreaByType_ = [](int32_t persistentId, AvoidAreaType type) { };
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_OK);
|
||||
|
||||
sceneSession->specificCallback_ = nullptr;
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_OK);
|
||||
|
||||
sceneSession->getIsLayoutFinishedFunc = nullptr;
|
||||
sceneSession->isStatusBarVisible_ = true;
|
||||
EXPECT_EQ(sceneSession->SetIsStatusBarVisibleTask(false), WSError::WS_OK);
|
||||
}
|
||||
} // namespace
|
||||
} // Rosen
|
||||
} // OHOS
|
@ -51,6 +51,8 @@ public:
|
||||
void RequestVsync(const std::shared_ptr<VsyncCallback>& vsyncCallback) override;
|
||||
int64_t GetVSyncPeriod() override;
|
||||
void FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate, uint32_t rateType = 0) override;
|
||||
bool IsLayoutFinished();
|
||||
bool OnFlushUIParams();
|
||||
|
||||
void OnBundleUpdated(const std::string& bundleName);
|
||||
static void SetOnConfigurationUpdatedCallback(
|
||||
|
@ -184,6 +184,18 @@ void RootScene::FlushFrameRate(uint32_t rate, int32_t animatorExpectedFrameRate,
|
||||
vsyncStation_->FlushFrameRate(rate, animatorExpectedFrameRate, rateType);
|
||||
}
|
||||
|
||||
bool RootScene::IsLayoutFinished()
|
||||
{
|
||||
uint32_t requestTimes = vsyncStation_->GetRequestTimes();
|
||||
WLOGI("RootScene vsync request times: %{public}d", requestTimes);
|
||||
return requestTimes == 0;
|
||||
}
|
||||
|
||||
void RootScene::OnFlushUIParams()
|
||||
{
|
||||
vsyncStation_->OnFlushUIParams();
|
||||
}
|
||||
|
||||
void RootScene::OnBundleUpdated(const std::string& bundleName)
|
||||
{
|
||||
WLOGFD("bundle %{public}s updated", bundleName.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user