mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-21 04:25:28 -04:00
Add dms and snapshot trace
Signed-off-by: shiyueeee <nieshiyue@huawei.com> Change-Id: I5e0d5e505d883ff754a6396a2f6af4567ef0260a
This commit is contained in:
@@ -19,10 +19,11 @@
|
||||
#include <cinttypes>
|
||||
#include <iservice_registry.h>
|
||||
#include <system_ability_definition.h>
|
||||
#include "display_manager_agent_controller.h"
|
||||
#include "window_manager_hilog.h"
|
||||
|
||||
#include "display_manager_agent_controller.h"
|
||||
#include "transaction/rs_interfaces.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
@@ -90,6 +91,7 @@ DisplayInfo DisplayManagerService::GetDisplayInfoById(DisplayId displayId)
|
||||
|
||||
ScreenId DisplayManagerService::CreateVirtualScreen(VirtualScreenOption option)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:CreateVirtualScreen(%s)", option.name_.c_str());
|
||||
ScreenId screenId = abstractScreenController_->CreateVirtualScreen(option);
|
||||
if (screenId == SCREEN_ID_INVALD) {
|
||||
WLOGFE("DisplayManagerService::CreateVirtualScreen: Get virtualScreenId failed");
|
||||
@@ -105,6 +107,7 @@ DMError DisplayManagerService::DestroyVirtualScreen(ScreenId screenId)
|
||||
WLOGFE("DisplayManagerService: virtualScreenId is invalid");
|
||||
return DMError::DM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
WM_SCOPED_TRACE("dms:DestroyVirtualScreen(%" PRIu64")", screenId);
|
||||
std::map<ScreenId, std::shared_ptr<RSDisplayNode>>::iterator iter = displayNodeMap_.find(screenId);
|
||||
if (iter == displayNodeMap_.end()) {
|
||||
WLOGFE("DisplayManagerService: displayNode is nullptr");
|
||||
@@ -117,6 +120,7 @@ DMError DisplayManagerService::DestroyVirtualScreen(ScreenId screenId)
|
||||
|
||||
std::shared_ptr<Media::PixelMap> DisplayManagerService::GetDispalySnapshot(DisplayId displayId)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:GetDispalySnapshot(%" PRIu64")", displayId);
|
||||
std::shared_ptr<Media::PixelMap> screenSnapshot
|
||||
= abstractDisplayController_->GetScreenSnapshot(displayId);
|
||||
return screenSnapshot;
|
||||
@@ -208,6 +212,7 @@ DMError DisplayManagerService::AddMirror(ScreenId mainScreenId, ScreenId mirrorS
|
||||
if (mainScreenId == SCREEN_ID_INVALID) {
|
||||
return DMError::DM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
WM_SCOPED_TRACE("dms:AddMirror");
|
||||
std::shared_ptr<RSDisplayNode> displayNode =
|
||||
SingletonContainer::Get<WindowManagerService>().GetDisplayNode(mainScreenId);
|
||||
if (displayNode == nullptr) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <cstdio>
|
||||
#include <getopt.h>
|
||||
#include <png.h>
|
||||
#include "wm_trace.h"
|
||||
|
||||
using namespace OHOS::Media;
|
||||
using namespace OHOS::Rosen;
|
||||
@@ -36,6 +37,7 @@ void SnapShotUtils::PrintUsage(const std::string &cmdLine)
|
||||
|
||||
bool SnapShotUtils::CheckFileNameValid(const std::string &fileName)
|
||||
{
|
||||
WM_SCOPED_TRACE("snapshot:CheckFileNameValid(%s)", fileName.c_str());
|
||||
if (fileName.length() < strlen(VALID_SNAPSHOT_SUFFIX)) {
|
||||
printf("error: fileName %s invalid, file length too short!\n", fileName.c_str());
|
||||
return false;
|
||||
@@ -95,6 +97,8 @@ bool SnapShotUtils::WriteToPng(const std::string &fileName, const WriteToPngPara
|
||||
if (!CheckParamValid(param)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WM_SCOPED_TRACE("snapshot:WriteToPng(%s)", fileName.c_str());
|
||||
|
||||
png_structp pngStruct = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (pngStruct == nullptr) {
|
||||
@@ -153,6 +157,7 @@ bool SnapShotUtils::WriteToPngWithPixelMap(const std::string &fileName, PixelMap
|
||||
|
||||
static bool ProcessDisplayId(DisplayId &displayId)
|
||||
{
|
||||
WM_SCOPED_TRACE("snapshot:ProcessDisplayId(%" PRIu64")", displayId);
|
||||
if (displayId == DISPLAY_ID_INVALD) {
|
||||
displayId = DisplayManager::GetInstance().GetDefaultDisplayId();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user