!10918 [新需求]: 折痕区返回接口

Merge pull request !10918 from HUMBLE./master
This commit is contained in:
openharmony_ci 2024-11-20 13:37:05 +00:00 committed by Gitee
commit 6d26cb3963
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 35 additions and 1 deletions

View File

@ -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;

View File

@ -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));

View File

@ -5294,6 +5294,9 @@ bool ScreenSessionManager::GetTentMode()
sptr<FoldCreaseRegion> ScreenSessionManager::GetCurrentFoldCreaseRegion()
{
if (FoldScreenStateInternel::IsSuperFoldDisplayDevice()) {
return SuperFoldStateManager::GetInstance().GetCurrentFoldCreaseRegion();
}
if (!g_foldScreenFlag) {
return nullptr;
}