mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-27 00:51:35 +00:00
commit
6d26cb3963
@ -27,6 +27,7 @@
|
||||
#include "dm_common.h"
|
||||
#include "wm_single_instance.h"
|
||||
#include "transaction/rs_interfaces.h"
|
||||
#include "fold_screen_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
|
||||
@ -49,12 +50,18 @@ public:
|
||||
|
||||
void HandleSuperFoldStatusChange(SuperFoldStatusChangeEvents events);
|
||||
|
||||
void InitSuperFoldStateManagerMap();
|
||||
|
||||
sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion();
|
||||
|
||||
SuperFoldStatus GetCurrentStatus();
|
||||
|
||||
FoldStatus MatchSuperFoldStatusToFoldStatus(SuperFoldStatus superFoldStatus);
|
||||
private:
|
||||
std::atomic<SuperFoldStatus> curState_ = SuperFoldStatus::UNKNOWN;
|
||||
|
||||
sptr<FoldCreaseRegion> currentSuperFoldCreaseRegion_ = nullptr;
|
||||
|
||||
struct Transition {
|
||||
SuperFoldStatus nextState;
|
||||
std::function<void (SuperFoldStatusChangeEvents)> action;
|
||||
|
@ -110,7 +110,7 @@ void SuperFoldStateManager::DoFoldedToHalfFolded(SuperFoldStatusChangeEvents eve
|
||||
TLOGI(WmsLogTag::DMS, "SuperFoldStateManager::DoFoldedToHalfFolded()");
|
||||
}
|
||||
|
||||
SuperFoldStateManager::SuperFoldStateManager()
|
||||
void SuperFoldStateManager::InitSuperFoldStateManagerMap()
|
||||
{
|
||||
AddStateManagerMap(SuperFoldStatus::HALF_FOLDED,
|
||||
SuperFoldStatusChangeEvents::ANGLE_CHANGE_EXPANDED,
|
||||
@ -164,6 +164,24 @@ SuperFoldStateManager::SuperFoldStateManager()
|
||||
[&](SuperFoldStatusChangeEvents events) {});
|
||||
}
|
||||
|
||||
SuperFoldStateManager::SuperFoldStateManager()
|
||||
{
|
||||
InitSuperFoldStateManagerMap();
|
||||
ScreenId screenIdFull = 0;
|
||||
int32_t superFoldCreaseRegionPosX = 0;
|
||||
int32_t superFoldCreaseRegionPosY = 1624;
|
||||
int32_t superFoldCreaseRegionPosWidth = 2472;
|
||||
int32_t superFoldCreaseRegionPosHeight = 48;
|
||||
|
||||
std::vector<DMRect> rect = {
|
||||
{
|
||||
superFoldCreaseRegionPosX, superFoldCreaseRegionPosY,
|
||||
superFoldCreaseRegionPosWidth, superFoldCreaseRegionPosHeight
|
||||
}
|
||||
};
|
||||
currentSuperFoldCreaseRegion_ = new FoldCreaseRegion(screenIdFull, rect);
|
||||
}
|
||||
|
||||
SuperFoldStateManager::~SuperFoldStateManager() = default;
|
||||
|
||||
void SuperFoldStateManager::AddStateManagerMap(SuperFoldStatus curState,
|
||||
@ -237,6 +255,12 @@ void SuperFoldStateManager::SetCurrentStatus(SuperFoldStatus curState)
|
||||
curState_.store(curState);
|
||||
}
|
||||
|
||||
sptr<FoldCreaseRegion> SuperFoldStateManager::GetCurrentFoldCreaseRegion()
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "GetCurrentFoldCreaseRegion()");
|
||||
return currentSuperFoldCreaseRegion_;
|
||||
}
|
||||
|
||||
void SuperFoldStateManager::HandleDisplayNotify(SuperFoldStatusChangeEvents changeEvent)
|
||||
{
|
||||
TLOGI(WmsLogTag::DMS, "changeEvent: %{public}d", static_cast<uint32_t>(changeEvent));
|
||||
|
@ -5294,6 +5294,9 @@ bool ScreenSessionManager::GetTentMode()
|
||||
|
||||
sptr<FoldCreaseRegion> ScreenSessionManager::GetCurrentFoldCreaseRegion()
|
||||
{
|
||||
if (FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
|
||||
return SuperFoldStateManager::GetInstance().GetCurrentFoldCreaseRegion();
|
||||
}
|
||||
if (!g_foldScreenFlag) {
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user