mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-04-01 18:34:18 +00:00
commit
4b9a9d650f
@ -325,6 +325,7 @@ private:
|
||||
#endif // DEVICE_STATUS_ENABLE
|
||||
void ShowFoldStatusChangedInfo(int errCode, std::string& dumpInfo);
|
||||
void SetMirrorScreenIds(std::vector<ScreenId>& mirrorScreenIds);
|
||||
std::shared_ptr<RSDisplayNode> GetScreenSnapshotDisplayNode(DisplayId displayId);
|
||||
class ScreenIdManager {
|
||||
friend class ScreenSessionGroup;
|
||||
public:
|
||||
@ -421,6 +422,7 @@ private:
|
||||
std::atomic<bool> buttonBlock_ = false;
|
||||
std::atomic<bool> isScreenLockSuspend_ = false;
|
||||
std::atomic<bool> gotScreenlockFingerprint_ = false;
|
||||
std::atomic<bool> isScreenShotByPicker_ = false;
|
||||
std::atomic<bool> isPhyScreenConnected_ = false;
|
||||
std::atomic<bool> isInGetSnapshotByPicker_ = false;
|
||||
|
||||
|
@ -3348,7 +3348,7 @@ const std::shared_ptr<RSDisplayNode> ScreenSessionManager::GetRSDisplayNodeByScr
|
||||
return screen->GetDisplayNode();
|
||||
}
|
||||
|
||||
std::shared_ptr<Media::PixelMap> ScreenSessionManager::GetScreenSnapshot(DisplayId displayId)
|
||||
std::shared_ptr<RSDisplayNode> ScreenSessionManager::GetScreenSnapshotDisplayNode(DisplayId displayId)
|
||||
{
|
||||
ScreenId screenId = SCREEN_ID_INVALID;
|
||||
std::shared_ptr<RSDisplayNode> displayNode = nullptr;
|
||||
@ -3381,9 +3381,29 @@ std::shared_ptr<Media::PixelMap> ScreenSessionManager::GetScreenSnapshot(Display
|
||||
TLOGE(WmsLogTag::DMS, "GetScreenSnapshot displayNode == nullptr!");
|
||||
return nullptr;
|
||||
}
|
||||
return displayNode;
|
||||
}
|
||||
|
||||
std::shared_ptr<Media::PixelMap> ScreenSessionManager::GetScreenSnapshot(DisplayId displayId)
|
||||
{
|
||||
std::shared_ptr<RSDisplayNode> displayNode = GetScreenSnapshotDisplayNode(displayId);
|
||||
if (displayNode == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "GetScreenSnapshot GetScreenSnapshotDisplayNode is nullptr!");
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<SurfaceCaptureFuture> callback = std::make_shared<SurfaceCaptureFuture>();
|
||||
bool ret = rsInterface_.TakeSurfaceCapture(displayNode, callback);
|
||||
bool ret = false;
|
||||
if (isScreenShotByPicker_) {
|
||||
TLOGI(WmsLogTag::DMS, "GetScreenSnapshot isScreenShotByPicker_ is true.");
|
||||
ret = rsInterface_.TakeSurfaceCapture(displayNode, callback);
|
||||
isScreenShotByPicker_ = false;
|
||||
} else {
|
||||
TLOGI(WmsLogTag::DMS, "GetScreenSnapshot isScreenShotByPicker_ is false.");
|
||||
RSSurfaceCaptureConfig config = {
|
||||
.useDma = true,
|
||||
};
|
||||
ret = rsInterface_.TakeSurfaceCapture(displayNode, callback, config);
|
||||
}
|
||||
if (!ret) {
|
||||
TLOGE(WmsLogTag::DMS, "GetScreenSnapshot TakeSurfaceCapture failed");
|
||||
return nullptr;
|
||||
@ -3392,13 +3412,11 @@ std::shared_ptr<Media::PixelMap> ScreenSessionManager::GetScreenSnapshot(Display
|
||||
if (screenshot == nullptr) {
|
||||
TLOGE(WmsLogTag::DMS, "Failed to get pixelmap from RS, return nullptr!");
|
||||
}
|
||||
|
||||
// notify dm listener
|
||||
sptr<ScreenshotInfo> snapshotInfo = new ScreenshotInfo();
|
||||
snapshotInfo->SetTrigger(SysCapUtil::GetClientName());
|
||||
snapshotInfo->SetDisplayId(displayId);
|
||||
OnScreenshot(snapshotInfo);
|
||||
|
||||
return screenshot;
|
||||
}
|
||||
|
||||
@ -3464,6 +3482,7 @@ std::shared_ptr<Media::PixelMap> ScreenSessionManager::GetSnapshotByPicker(Media
|
||||
}
|
||||
DisplayId displayId = displayInfo->GetDisplayId();
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:GetSnapshotByPicker(%" PRIu64")", displayId);
|
||||
isScreenShotByPicker_ = true;
|
||||
auto pixelMap = GetScreenSnapshot(displayId);
|
||||
if (pixelMap != nullptr && IS_BETA) {
|
||||
CheckAndSendHiSysEvent("GET_DISPLAY_SNAPSHOT", "hmos.screenshot");
|
||||
|
Loading…
x
Reference in New Issue
Block a user