mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
@@ -83,6 +83,8 @@ ohos_systemtest("dm_screenshot_cmd_test") {
|
||||
]
|
||||
|
||||
deps = [ ":dm_systemtest_common" ]
|
||||
|
||||
external_deps = [ "hitrace_native:hitrace_meter" ]
|
||||
}
|
||||
|
||||
## SystemTest dm_screenshot_cmd_test }}}
|
||||
|
||||
@@ -60,6 +60,8 @@ ohos_unittest("dm_snapshot_utils_test") {
|
||||
]
|
||||
|
||||
deps = [ ":dm_unittest_common" ]
|
||||
|
||||
external_deps = [ "hitrace_native:hitrace_meter" ]
|
||||
}
|
||||
|
||||
## UnitTest dm_snapshot_utils_test }}}
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
#include "abstract_display_controller.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <hitrace_meter.h>
|
||||
#include <surface.h>
|
||||
|
||||
#include "display_manager_agent_controller.h"
|
||||
#include "display_manager_service.h"
|
||||
#include "screen_group.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
@@ -357,7 +357,7 @@ void AbstractDisplayController::ProcessDisplayUpdateOrientation(sptr<AbstractScr
|
||||
|
||||
void AbstractDisplayController::ProcessDisplaySizeChange(sptr<AbstractScreen> absScreen)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:ProcessDisplaySizeChange(%" PRIu64")", absScreen->dmsId_);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:ProcessDisplaySizeChange(%" PRIu64")", absScreen->dmsId_);
|
||||
sptr<SupportedScreenModes> info = absScreen->GetActiveScreenMode();
|
||||
if (info == nullptr) {
|
||||
WLOGE("cannot get active screen info.");
|
||||
@@ -531,13 +531,13 @@ void AbstractDisplayController::AddScreenToExpandLocked(sptr<AbstractScreen> abs
|
||||
|
||||
void AbstractDisplayController::SetFreeze(std::vector<DisplayId> displayIds, bool toFreeze)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetAllFreeze");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetAllFreeze");
|
||||
DisplayStateChangeType type = toFreeze ? DisplayStateChangeType::FREEZE : DisplayStateChangeType::UNFREEZE;
|
||||
DisplayChangeEvent event
|
||||
= toFreeze ? DisplayChangeEvent::DISPLAY_FREEZED : DisplayChangeEvent::DISPLAY_UNFREEZED;
|
||||
for (DisplayId displayId : displayIds) {
|
||||
sptr<AbstractDisplay> abstractDisplay;
|
||||
WM_SCOPED_TRACE("dms:SetFreeze(%" PRIu64")", displayId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetFreeze(%" PRIu64")", displayId);
|
||||
{
|
||||
WLOGI("setfreeze display %{public}" PRIu64"", displayId);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "abstract_screen_controller.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <hitrace_meter.h>
|
||||
#include <screen_manager/rs_screen_mode_info.h>
|
||||
#include <screen_manager/screen_types.h>
|
||||
#include <surface.h>
|
||||
@@ -26,7 +27,6 @@
|
||||
#include "event_runner.h"
|
||||
#include "screen_rotation_controller.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
@@ -756,7 +756,7 @@ bool AbstractScreenController::SetScreenActiveMode(ScreenId screenId, uint32_t m
|
||||
|
||||
void AbstractScreenController::ProcessScreenModeChanged(ScreenId dmsScreenId)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:ProcessScreenModeChanged(%" PRIu64")", dmsScreenId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:ProcessScreenModeChanged(%" PRIu64")", dmsScreenId);
|
||||
sptr<AbstractScreen> absScreen = nullptr;
|
||||
sptr<AbstractScreenCallback> absScreenCallback = nullptr;
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "display_manager_service.h"
|
||||
|
||||
#include <cinttypes>
|
||||
#include <hitrace_meter.h>
|
||||
#include <ipc_skeleton.h>
|
||||
#include <iservice_registry.h>
|
||||
#include <system_ability_definition.h>
|
||||
@@ -28,7 +29,6 @@
|
||||
#include "screen_rotation_controller.h"
|
||||
#include "transaction/rs_interfaces.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
@@ -175,7 +175,7 @@ sptr<DisplayInfo> DisplayManagerService::GetDisplayInfoByScreen(ScreenId screenI
|
||||
ScreenId DisplayManagerService::CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:CreateVirtualScreen(%s)", option.name_.c_str());
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:CreateVirtualScreen(%s)", option.name_.c_str());
|
||||
ScreenId screenId = abstractScreenController_->CreateVirtualScreen(option, displayManagerAgent);
|
||||
CHECK_SCREEN_AND_RETURN(SCREEN_ID_INVALID);
|
||||
accessTokenIdMaps_[screenId] = IPCSkeleton::GetCallingTokenID();
|
||||
@@ -191,7 +191,7 @@ DMError DisplayManagerService::DestroyVirtualScreen(ScreenId screenId)
|
||||
WLOGFI("DestroyVirtualScreen::ScreenId: %{public}" PRIu64 "", screenId);
|
||||
CHECK_SCREEN_AND_RETURN(DMError::DM_ERROR_INVALID_PARAM);
|
||||
|
||||
WM_SCOPED_TRACE("dms:DestroyVirtualScreen(%" PRIu64")", screenId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:DestroyVirtualScreen(%" PRIu64")", screenId);
|
||||
return abstractScreenController_->DestroyVirtualScreen(screenId);
|
||||
}
|
||||
|
||||
@@ -204,25 +204,25 @@ DMError DisplayManagerService::SetVirtualScreenSurface(ScreenId screenId, sptr<S
|
||||
|
||||
bool DisplayManagerService::SetOrientation(ScreenId screenId, Orientation orientation)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetOrientation(%" PRIu64")", screenId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetOrientation(%" PRIu64")", screenId);
|
||||
return abstractScreenController_->SetOrientation(screenId, orientation, false);
|
||||
}
|
||||
|
||||
bool DisplayManagerService::SetOrientationFromWindow(ScreenId screenId, Orientation orientation)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetOrientationFromWindow(%" PRIu64")", screenId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetOrientationFromWindow(%" PRIu64")", screenId);
|
||||
return abstractScreenController_->SetOrientation(screenId, orientation, true);
|
||||
}
|
||||
|
||||
bool DisplayManagerService::SetRotationFromWindow(ScreenId screenId, Rotation targetRotation)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetRotationFromWindow(%" PRIu64")", screenId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetRotationFromWindow(%" PRIu64")", screenId);
|
||||
return abstractScreenController_->SetRotation(screenId, targetRotation, true);
|
||||
}
|
||||
|
||||
std::shared_ptr<Media::PixelMap> DisplayManagerService::GetDisplaySnapshot(DisplayId displayId)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:GetDisplaySnapshot(%" PRIu64")", displayId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:GetDisplaySnapshot(%" PRIu64")", displayId);
|
||||
if (Permission::CheckCallingPermission("ohos.permission.CAPTURE_SCREEN") ||
|
||||
Permission::IsStartByHdcd()) {
|
||||
return abstractDisplayController_->GetScreenSnapshot(displayId);
|
||||
@@ -307,7 +307,7 @@ bool DisplayManagerService::UnregisterDisplayManagerAgent(const sptr<IDisplayMan
|
||||
|
||||
bool DisplayManagerService::WakeUpBegin(PowerStateChangeReason reason)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:WakeUpBegin(%u)", reason);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:WakeUpBegin(%u)", reason);
|
||||
if (!Permission::IsSystemCalling()) {
|
||||
WLOGFI("permission denied!");
|
||||
return false;
|
||||
@@ -328,7 +328,7 @@ bool DisplayManagerService::WakeUpEnd()
|
||||
|
||||
bool DisplayManagerService::SuspendBegin(PowerStateChangeReason reason)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SuspendBegin(%u)", reason);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SuspendBegin(%u)", reason);
|
||||
if (!Permission::IsSystemCalling()) {
|
||||
WLOGFI("permission denied!");
|
||||
return false;
|
||||
@@ -425,7 +425,7 @@ ScreenId DisplayManagerService::MakeMirror(ScreenId mainScreenId, std::vector<Sc
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
abstractScreenController_->SetShotScreen(mainScreenId, shotScreenIds);
|
||||
WM_SCOPED_TRACE("dms:MakeMirror");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:MakeMirror");
|
||||
if (!allMirrorScreenIds.empty() && !abstractScreenController_->MakeMirror(mainScreenId, allMirrorScreenIds)) {
|
||||
WLOGFE("make mirror failed.");
|
||||
return SCREEN_ID_INVALID;
|
||||
@@ -540,7 +540,7 @@ ScreenId DisplayManagerService::MakeExpand(std::vector<ScreenId> expandScreenIds
|
||||
startPoints.erase(startPointIter);
|
||||
}
|
||||
abstractScreenController_->SetShotScreen(defaultScreenId, shotScreenIds);
|
||||
WM_SCOPED_TRACE("dms:MakeExpand");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:MakeExpand");
|
||||
if (!allExpandScreenIds.empty() && !abstractScreenController_->MakeExpand(allExpandScreenIds, startPoints)) {
|
||||
WLOGFE("make expand failed.");
|
||||
return SCREEN_ID_INVALID;
|
||||
@@ -555,13 +555,14 @@ ScreenId DisplayManagerService::MakeExpand(std::vector<ScreenId> expandScreenIds
|
||||
|
||||
bool DisplayManagerService::SetScreenActiveMode(ScreenId screenId, uint32_t modeId)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetScreenActiveMode(%" PRIu64", %u)", screenId, modeId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetScreenActiveMode(%" PRIu64", %u)", screenId, modeId);
|
||||
return abstractScreenController_->SetScreenActiveMode(screenId, modeId);
|
||||
}
|
||||
|
||||
bool DisplayManagerService::SetVirtualPixelRatio(ScreenId screenId, float virtualPixelRatio)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:SetVirtualPixelRatio(%" PRIu64", %f)", screenId, virtualPixelRatio);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "dms:SetVirtualPixelRatio(%" PRIu64", %f)", screenId,
|
||||
virtualPixelRatio);
|
||||
return abstractScreenController_->SetVirtualPixelRatio(screenId, virtualPixelRatio);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ ohos_shared_library("libwindow_extension_client") {
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_manager",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"input:libmmi-client",
|
||||
]
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <ability_connect_callback_stub.h>
|
||||
#include <ability_manager_client.h>
|
||||
#include <element_name.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <iremote_object.h>
|
||||
|
||||
#include "window_extension_proxy.h"
|
||||
@@ -25,7 +26,6 @@
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -106,7 +106,7 @@ int WindowExtensionConnection::Impl::ConnectExtension(const AppExecFwk::ElementN
|
||||
{
|
||||
AAFwk::Want want;
|
||||
want.SetElement(element);
|
||||
WM_SCOPED_ASYNC_TRACE_BEGIN(static_cast<int32_t>(TraceTaskId::CONNECT_EXTENSION),
|
||||
StartAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::CONNECT_EXTENSION),
|
||||
"WindowExtension %s-%s", element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
want.SetParam(RECT_FORM_KEY_POS_X, rect.posX_);
|
||||
want.SetParam(RECT_FORM_KEY_POS_Y, rect.posY_);
|
||||
@@ -189,7 +189,7 @@ void WindowExtensionConnection::Impl::OnAbilityConnectDone(const AppExecFwk::Ele
|
||||
WLOGFI("GetExtensionWindow");
|
||||
}
|
||||
WLOGFI("call end");
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::CONNECT_EXTENSION),
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::CONNECT_EXTENSION),
|
||||
"WindowExtension %s-%s", element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ ohos_shared_library("libwindow_extension") {
|
||||
"ability_runtime:runtime",
|
||||
"graphic_graphic_2d:surface",
|
||||
"hilog_native:libhilog",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"input:libmmi-client",
|
||||
"utils_base:utils",
|
||||
]
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "js_window_extension.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
#include <napi_common_want.h>
|
||||
#include <native_engine/native_reference.h>
|
||||
#include <native_engine/native_value.h>
|
||||
@@ -27,7 +28,6 @@
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -61,7 +61,7 @@ void JsWindowExtension::Init(const std::shared_ptr<AbilityRuntime::AbilityLocalR
|
||||
std::shared_ptr<AbilityRuntime::AbilityHandler>& handler,
|
||||
const sptr<IRemoteObject>& token)
|
||||
{
|
||||
WM_SCOPED_TRACE("WindowExtension Init");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "WindowExtension Init");
|
||||
WindowExtension::Init(record, application, handler, token);
|
||||
std::string srcPath;
|
||||
GetSrcPath(srcPath);
|
||||
@@ -143,7 +143,7 @@ void JsWindowExtension::GetSrcPath(std::string& srcPath) const
|
||||
|
||||
sptr<IRemoteObject> JsWindowExtension::OnConnect(const AAFwk::Want& want)
|
||||
{
|
||||
WM_SCOPED_TRACE("WindowExtension Init %s-%s",
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "WindowExtension OnConnect %s-%s",
|
||||
want.GetElement().GetAbilityName().c_str(), want.GetElement().GetAbilityName().c_str());
|
||||
WLOGFI("called.");
|
||||
Extension::OnConnect(want);
|
||||
@@ -194,7 +194,7 @@ void JsWindowExtension::OnDisconnect(const AAFwk::Want& want)
|
||||
|
||||
void JsWindowExtension::OnStart(const AAFwk::Want& want)
|
||||
{
|
||||
WM_SCOPED_TRACE("WindowExtension OnStart %s-%s",
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "WindowExtension OnStart %s-%s",
|
||||
want.GetElement().GetAbilityName().c_str(), want.GetElement().GetAbilityName().c_str());
|
||||
Extension::OnStart(want);
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ ohos_shared_library("screenrecorder_napi") {
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:runtime",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
||||
@@ -35,6 +35,7 @@ ohos_executable("snapshot_display") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hitrace_native:hitrace_meter",
|
||||
"multimedia_image_standard:image_native",
|
||||
"utils_base:utils",
|
||||
]
|
||||
@@ -61,6 +62,7 @@ ohos_executable("snapshot_virtual_screen") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hitrace_native:hitrace_meter",
|
||||
"multimedia_image_standard:image_native",
|
||||
"utils_base:utils",
|
||||
]
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
#include "snapshot_utils.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <hitrace_meter.h>
|
||||
#include <sys/time.h>
|
||||
#include <getopt.h>
|
||||
#include <securec.h>
|
||||
#include <png.h>
|
||||
#include "wm_trace.h"
|
||||
|
||||
using namespace OHOS::Media;
|
||||
using namespace OHOS::Rosen;
|
||||
@@ -142,7 +142,7 @@ bool SnapShotUtils::WriteToPng(const std::string &fileName, const WriteToPngPara
|
||||
return false;
|
||||
}
|
||||
|
||||
WM_SCOPED_TRACE("snapshot:WriteToPng(%s)", fileName.c_str());
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "snapshot:WriteToPng(%s)", fileName.c_str());
|
||||
|
||||
png_structp pngStruct = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (pngStruct == nullptr) {
|
||||
|
||||
@@ -39,7 +39,6 @@ ohos_shared_library("libwmutil") {
|
||||
"src/surface_reader_handler_impl.cpp",
|
||||
"src/window_property.cpp",
|
||||
"src/window_transition_info.cpp",
|
||||
"src/wm_trace.cpp",
|
||||
]
|
||||
|
||||
configs = [ ":libwmutil_private_config" ]
|
||||
@@ -57,7 +56,6 @@ ohos_shared_library("libwmutil") {
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"graphic_graphic_2d:surface",
|
||||
"hilog_native:libhilog",
|
||||
"hitrace_native:hitrace_meter",
|
||||
"ipc:ipc_core",
|
||||
"multimedia_image_standard:image_native",
|
||||
"safwk:system_ability_fwk",
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_WM_INCLUDE_WM_TRACE_H
|
||||
#define OHOS_WM_INCLUDE_WM_TRACE_H
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "noncopyable.h"
|
||||
|
||||
#define WM_SCOPED_TRACE(fmt, ...) WmScopedTrace wmScopedTrace(fmt, ##__VA_ARGS__)
|
||||
#ifdef WM_DEBUG
|
||||
#define WM_DEBUG_SCOPED_TRACE(fmt, ...) WmScopedTrace wmScopedTrace(fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define WM_DEBUG_SCOPED_TRACE(fmt, ...)
|
||||
#endif
|
||||
|
||||
#define WM_FUNCTION_TRACE() WM_SCOPED_TRACE(__func__)
|
||||
#define WM_SCOPED_TRACE_BEGIN(fmt, ...) WmTraceBeginWithArgs(fmt, ##__VA_ARGS__)
|
||||
#define WM_SCOPED_TRACE_END() WmTraceEnd()
|
||||
|
||||
#define WM_SCOPED_ASYNC_TRACE_BEGIN(taskId, fmt, ...) WmAsyncTraceWithArgs(true, taskId, fmt, ##__VA_ARGS__)
|
||||
#define WM_SCOPED_ASYNC_END(taskId, fmt, ...) WmAsyncTraceWithArgs(false, taskId, fmt, ##__VA_ARGS__)
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
bool WmTraceEnabled();
|
||||
void WmTraceBegin(const char* name);
|
||||
bool WmTraceBeginWithArgs(const char* format, ...) __attribute__((__format__(printf, 1, 2)));
|
||||
bool WmTraceBeginWithArgv(const char* format, va_list args);
|
||||
void WmTraceEnd();
|
||||
void WmAsyncTraceBegin(int32_t taskId, const char* name);
|
||||
void WmAsyncTraceEnd(int32_t taskId, const char* name);
|
||||
void WmAsyncTraceWithArgs(bool isBegin, int32_t taskId,
|
||||
const char* format, ...) __attribute__((__format__(printf, 3, 4)));
|
||||
void WmAsyncTraceWithArgv(bool isBegin, int32_t taskId, const char* format, va_list args);
|
||||
|
||||
class WmScopedTrace final {
|
||||
public:
|
||||
explicit WmScopedTrace(const char* format, ...) __attribute__((__format__(printf, 2, 3)));
|
||||
~WmScopedTrace();
|
||||
|
||||
WM_DISALLOW_COPY_AND_MOVE(WmScopedTrace);
|
||||
|
||||
private:
|
||||
bool traceEnabled_ { false };
|
||||
};
|
||||
} // namespace OHOS
|
||||
}
|
||||
#endif // OHOS_WM_INCLUDE_WM_TRACE_H
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wm_trace.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
#ifndef WINDOWS_PLATFORM
|
||||
#include <securec.h>
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
const size_t MAX_STRING_SIZE = 128;
|
||||
}
|
||||
|
||||
bool WmTraceEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WmTraceBegin(const char* name)
|
||||
{
|
||||
if (name == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::string nameStr(name);
|
||||
StartTrace(HITRACE_TAG_WINDOW_MANAGER, nameStr);
|
||||
}
|
||||
|
||||
void WmTraceEnd()
|
||||
{
|
||||
if (WmTraceEnabled()) {
|
||||
FinishTrace(HITRACE_TAG_WINDOW_MANAGER);
|
||||
}
|
||||
}
|
||||
|
||||
void WmAsyncTraceBegin(int32_t taskId, const char* name)
|
||||
{
|
||||
if (name == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::string nameStr(name);
|
||||
StartAsyncTrace(HITRACE_TAG_WINDOW_MANAGER, nameStr, taskId);
|
||||
}
|
||||
|
||||
void WmAsyncTraceEnd(int32_t taskId, const char* name)
|
||||
{
|
||||
if (name == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::string nameStr(name);
|
||||
FinishAsyncTrace(HITRACE_TAG_WINDOW_MANAGER, nameStr, taskId);
|
||||
}
|
||||
|
||||
void WmAsyncTraceWithArgs(bool isBegin, int32_t taskId, const char* format, ...)
|
||||
{
|
||||
if (WmTraceEnabled()) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
WmAsyncTraceWithArgv(isBegin, taskId, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
void WmAsyncTraceWithArgv(bool isBegin, int32_t taskId, const char* format, va_list args)
|
||||
{
|
||||
char name[MAX_STRING_SIZE] = { 0 };
|
||||
if (vsnprintf_s(name, sizeof(name), sizeof(name) - 1, format, args) < 0) {
|
||||
return;
|
||||
}
|
||||
if (isBegin) {
|
||||
WmAsyncTraceBegin(taskId, name);
|
||||
} else {
|
||||
WmAsyncTraceEnd(taskId, name);
|
||||
}
|
||||
}
|
||||
|
||||
bool WmTraceBeginWithArgv(const char* format, va_list args)
|
||||
{
|
||||
char name[MAX_STRING_SIZE] = { 0 };
|
||||
if (vsnprintf_s(name, sizeof(name), sizeof(name) - 1, format, args) < 0) {
|
||||
return false;
|
||||
}
|
||||
WmTraceBegin(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WmTraceBeginWithArgs(const char* format, ...)
|
||||
{
|
||||
if (WmTraceEnabled()) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
bool retVal = WmTraceBeginWithArgv(format, args);
|
||||
va_end(args);
|
||||
return retVal;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
WmScopedTrace::WmScopedTrace(const char* format, ...) : traceEnabled_(WmTraceEnabled())
|
||||
{
|
||||
if (traceEnabled_) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
traceEnabled_ = WmTraceBeginWithArgv(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
WmScopedTrace::~WmScopedTrace()
|
||||
{
|
||||
if (traceEnabled_) {
|
||||
WmTraceEnd();
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
@@ -14,10 +14,12 @@
|
||||
*/
|
||||
|
||||
#include "avoid_area_controller.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
#include "display_manager_config.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -70,7 +72,7 @@ void AvoidAreaController::AddOrRemoveOverlayWindowIfNeed(const sptr<WindowNode>&
|
||||
WLOGFE("IsOverlayWindow Failed.");
|
||||
return;
|
||||
}
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
|
||||
uint32_t overlayId = overlayNode->GetWindowId();
|
||||
bool isRecorded = (overlayWindowMap_.find(overlayId) != overlayWindowMap_.end());
|
||||
@@ -150,7 +152,7 @@ void AvoidAreaController::AddOrRemoveKeyboard(const sptr<WindowNode>& keyboardNo
|
||||
void AvoidAreaController::UpdateOverlayWindowIfNeed(const sptr<WindowNode>& node,
|
||||
const std::function<bool(sptr<WindowNode>)>& checkFunc)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
if (WindowHelper::IsOverlayWindow(node->GetWindowType())) {
|
||||
AvoidAreaType type = WindowHelper::IsSystemBarWindow(node->GetWindowType()) ?
|
||||
AvoidAreaType::TYPE_SYSTEM : AvoidAreaType::TYPE_KEYBOARD;
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
|
||||
#include <ability_manager_client.h>
|
||||
#include <common/rs_rect.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <rs_window_animation_finished_callback.h>
|
||||
#include "minimize_app.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
@@ -120,7 +121,7 @@ WMError RemoteAnimation::NotifyAnimationTransition(sptr<WindowTransitionInfo> sr
|
||||
[]() {
|
||||
WLOGFI("RSWindowAnimation: on finish transition with minimizeAll!");
|
||||
MinimizeApp::ExecuteMinimizeAll();
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
"wms:async:ShowRemoteAnimation");
|
||||
}
|
||||
);
|
||||
@@ -181,7 +182,7 @@ WMError RemoteAnimation::NotifyAnimationMinimize(sptr<WindowTransitionInfo> srcI
|
||||
if (weakNode != nullptr && weakNode->abilityToken_ != nullptr) {
|
||||
WLOGFI("minimize windowId: %{public}u, name:%{public}s",
|
||||
weakNode->GetWindowId(), weakNode->GetWindowName().c_str());
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
"wms:async:ShowRemoteAnimation");
|
||||
AAFwk::AbilityManagerClient::GetInstance()->MinimizeAbility(weakNode->abilityToken_, true);
|
||||
}
|
||||
@@ -218,7 +219,8 @@ WMError RemoteAnimation::NotifyAnimationClose(sptr<WindowTransitionInfo> srcInfo
|
||||
weakNode->GetWindowId(), weakNode->GetWindowName().c_str());
|
||||
AAFwk::AbilityManagerClient::GetInstance()->TerminateAbility(weakNode->abilityToken_, -1);
|
||||
}
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION), "wms:async:ShowRemoteAnimation");
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
"wms:async:ShowRemoteAnimation");
|
||||
}
|
||||
};
|
||||
sptr<RSWindowAnimationFinishedCallback> finishedCallback = new(std::nothrow) RSWindowAnimationFinishedCallback(
|
||||
@@ -252,7 +254,8 @@ WMError RemoteAnimation::NotifyAnimationByHome()
|
||||
auto func = []() {
|
||||
WLOGFI("NotifyAnimationByHome in animation callback");
|
||||
MinimizeApp::ExecuteMinimizeAll();
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION), "wms:async:ShowRemoteAnimation");
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
"wms:async:ShowRemoteAnimation");
|
||||
};
|
||||
sptr<RSWindowAnimationFinishedCallback> finishedCallback = new(std::nothrow) RSWindowAnimationFinishedCallback(
|
||||
func);
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
#include "starting_window.h"
|
||||
#include <ability_manager_client.h>
|
||||
#include <display_manager_service_inner.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
#include "remote_animation.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
@@ -107,7 +108,7 @@ void StartingWindow::DrawStartingWindow(sptr<WindowNode>& node,
|
||||
sptr<Media::PixelMap> pixelMap, uint32_t bkgColor, bool isColdStart)
|
||||
{
|
||||
// using snapshot to support hot start since node destroy when hide
|
||||
WM_SCOPED_TRACE("wms:DrawStartingWindow(%u)", node->GetWindowId());
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:DrawStartingWindow(%u)", node->GetWindowId());
|
||||
if (!isColdStart) {
|
||||
return;
|
||||
}
|
||||
@@ -143,7 +144,8 @@ void StartingWindow::HandleClientWindowCreate(sptr<WindowNode>& node, sptr<IWind
|
||||
wptr<WindowNode> weak = node;
|
||||
auto firstFrameCompleteCallback = [weak]() {
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::STARTING_WINDOW), "wms:async:ShowStartingWindow");
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::STARTING_WINDOW),
|
||||
"wms:async:ShowStartingWindow");
|
||||
auto weakNode = weak.promote();
|
||||
if (weakNode == nullptr || weakNode->leashWinSurfaceNode_ == nullptr) {
|
||||
WLOGFE("windowNode or leashWinSurfaceNode_ is nullptr");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <ability_manager_client.h>
|
||||
#include <chrono>
|
||||
#include <hisysevent.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <parameters.h>
|
||||
#include <power_mgr_client.h>
|
||||
#include <rs_window_animation_finished_callback.h>
|
||||
@@ -29,7 +30,6 @@
|
||||
#include "window_manager_hilog.h"
|
||||
#include "window_helper.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -50,7 +50,8 @@ void WindowController::StartingWindow(sptr<WindowTransitionInfo> info, sptr<Medi
|
||||
WLOGFE("info or AbilityToken is nullptr!");
|
||||
return;
|
||||
}
|
||||
WM_SCOPED_ASYNC_TRACE_BEGIN(static_cast<int32_t>(TraceTaskId::STARTING_WINDOW), "wms:async:ShowStartingWindow");
|
||||
StartAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::STARTING_WINDOW),
|
||||
"wms:async:ShowStartingWindow");
|
||||
auto node = windowRoot_->FindWindowNodeWithToken(info->GetAbilityToken());
|
||||
auto layoutMode = windowRoot_->GetCurrentLayoutMode(info->GetDisplayId());
|
||||
if (node == nullptr) {
|
||||
@@ -101,8 +102,9 @@ void WindowController::CancelStartingWindow(sptr<IRemoteObject> abilityToken)
|
||||
WLOGFE("CancelStartingWindow failed because client window has shown id:%{public}u", node->GetWindowId());
|
||||
return;
|
||||
}
|
||||
WM_SCOPED_TRACE("wms:CancelStartingWindow(%u)", node->GetWindowId());
|
||||
WM_SCOPED_ASYNC_END(static_cast<int32_t>(TraceTaskId::STARTING_WINDOW), "wms:async:ShowStartingWindow");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:CancelStartingWindow(%u)", node->GetWindowId());
|
||||
FinishAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::STARTING_WINDOW),
|
||||
"wms:async:ShowStartingWindow");
|
||||
WLOGFI("CancelStartingWindow with id:%{public}u!", node->GetWindowId());
|
||||
node->isAppCrash_ = true;
|
||||
WMError res = windowRoot_->DestroyWindow(node->GetWindowId(), false);
|
||||
@@ -124,7 +126,7 @@ WMError WindowController::NotifyWindowTransition(sptr<WindowTransitionInfo>& src
|
||||
if (!RemoteAnimation::CheckTransition(srcInfo, srcNode, dstInfo, dstNode)) {
|
||||
return WMError::WM_ERROR_NO_REMOTE_ANIMATION;
|
||||
}
|
||||
WM_SCOPED_ASYNC_TRACE_BEGIN(static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
StartAsyncTraceArgs(HITRACE_TAG_WINDOW_MANAGER, static_cast<int32_t>(TraceTaskId::REMOTE_ANIMATION),
|
||||
"wms:async:ShowRemoteAnimation");
|
||||
auto transitionEvent = RemoteAnimation::GetTransitionEvent(srcInfo, dstInfo, srcNode, dstNode);
|
||||
switch (transitionEvent) {
|
||||
@@ -369,7 +371,7 @@ WMError WindowController::RequestFocus(uint32_t windowId)
|
||||
|
||||
WMError WindowController::SetWindowMode(uint32_t windowId, WindowMode dstMode)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
auto node = windowRoot_->GetWindowNode(windowId);
|
||||
if (node == nullptr) {
|
||||
WLOGFE("could not find window");
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
|
||||
#include "window_layout_policy_cascade.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
#include "minimize_app.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_inner_manager.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -121,7 +122,7 @@ void WindowLayoutPolicyCascade::LayoutWindowTree(DisplayId displayId)
|
||||
|
||||
void WindowLayoutPolicyCascade::RemoveWindowNode(const sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
auto type = node->GetWindowType();
|
||||
// affect other windows, trigger off global layout
|
||||
if (avoidTypes_.find(type) != avoidTypes_.end()) {
|
||||
@@ -143,7 +144,7 @@ std::vector<int32_t> WindowLayoutPolicyCascade::GetExitSplitPoints(DisplayId dis
|
||||
|
||||
void WindowLayoutPolicyCascade::UpdateWindowNode(const sptr<WindowNode>& node, bool isAddWindow)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
auto type = node->GetWindowType();
|
||||
const DisplayId& displayId = node->GetDisplayId();
|
||||
// affect other windows, trigger off global layout
|
||||
@@ -174,7 +175,7 @@ void WindowLayoutPolicyCascade::UpdateWindowNode(const sptr<WindowNode>& node, b
|
||||
|
||||
void WindowLayoutPolicyCascade::AddWindowNode(const sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
auto property = node->GetWindowProperty();
|
||||
if (property == nullptr) {
|
||||
WLOGFE("window property is nullptr.");
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
|
||||
#include "window_layout_policy_tile.h"
|
||||
#include <ability_manager_client.h>
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
#include "minimize_app.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_inner_manager.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -117,7 +118,7 @@ void WindowLayoutPolicyTile::InitTileWindowRects(DisplayId displayId)
|
||||
|
||||
void WindowLayoutPolicyTile::AddWindowNode(const sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
|
||||
// update window size limits when add window
|
||||
UpdateWindowSizeLimits(node);
|
||||
@@ -134,7 +135,7 @@ void WindowLayoutPolicyTile::AddWindowNode(const sptr<WindowNode>& node)
|
||||
|
||||
void WindowLayoutPolicyTile::UpdateWindowNode(const sptr<WindowNode>& node, bool isAddWindow)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
WindowLayoutPolicy::UpdateWindowNode(node);
|
||||
if (avoidTypes_.find(node->GetWindowType()) != avoidTypes_.end()) {
|
||||
DisplayId displayId = node->GetDisplayId();
|
||||
@@ -146,7 +147,7 @@ void WindowLayoutPolicyTile::UpdateWindowNode(const sptr<WindowNode>& node, bool
|
||||
|
||||
void WindowLayoutPolicyTile::RemoveWindowNode(const sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
WLOGFI("RemoveWindowNode %{public}u in tile", node->GetWindowId());
|
||||
auto type = node->GetWindowType();
|
||||
auto displayId = node->GetDisplayId();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <ability_manager_client.h>
|
||||
#include <cinttypes>
|
||||
#include <hitrace_meter.h>
|
||||
#include <ipc_skeleton.h>
|
||||
#include <parameters.h>
|
||||
#include <rs_iwindow_animation_controller.h>
|
||||
@@ -36,7 +37,7 @@
|
||||
#include "window_manager_config.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace {
|
||||
@@ -375,7 +376,7 @@ WMError WindowManagerService::CreateWindow(sptr<IWindow>& window, sptr<WindowPro
|
||||
int pid = IPCSkeleton::GetCallingPid();
|
||||
int uid = IPCSkeleton::GetCallingUid();
|
||||
WMError ret = wmsTaskLooper_->ScheduleTask([this, pid, uid, &window, &property, &surfaceNode, &windowId, &token]() {
|
||||
WM_SCOPED_TRACE("wms:CreateWindow(%u)", windowId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:CreateWindow(%u)", windowId);
|
||||
return windowController_->CreateWindow(window, property, surfaceNode, windowId, token, pid, uid);
|
||||
}).get();
|
||||
accessTokenIdMaps_[windowId] = IPCSkeleton::GetCallingTokenID();
|
||||
@@ -400,7 +401,7 @@ WMError WindowManagerService::HandleAddWindow(sptr<WindowProperty>& property)
|
||||
WLOGFI("[WMS] Add: %{public}5d %{public}4d %{public}4d %{public}4d [%{public}4d %{public}4d " \
|
||||
"%{public}4d %{public}4d]", windowId, property->GetWindowType(), property->GetWindowMode(),
|
||||
property->GetWindowFlags(), rect.posX_, rect.posY_, rect.width_, rect.height_);
|
||||
WM_SCOPED_TRACE("wms:AddWindow(%u)", windowId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:AddWindow(%u)", windowId);
|
||||
WMError res = windowController_->AddWindowNode(property);
|
||||
if (property->GetWindowType() == WindowType::WINDOW_TYPE_DRAGGING_EFFECT) {
|
||||
dragController_->StartDrag(windowId);
|
||||
@@ -412,7 +413,7 @@ WMError WindowManagerService::RemoveWindow(uint32_t windowId)
|
||||
{
|
||||
return wmsTaskLooper_->ScheduleTask([this, windowId]() {
|
||||
WLOGFI("[WMS] Remove: %{public}u", windowId);
|
||||
WM_SCOPED_TRACE("wms:RemoveWindow(%u)", windowId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:RemoveWindow(%u)", windowId);
|
||||
return windowController_->RemoveWindowNode(windowId);
|
||||
}).get();
|
||||
}
|
||||
@@ -426,7 +427,7 @@ WMError WindowManagerService::DestroyWindow(uint32_t windowId, bool onlySelf)
|
||||
accessTokenIdMaps_.erase(windowId);
|
||||
return wmsTaskLooper_->ScheduleTask([this, windowId, onlySelf]() {
|
||||
WLOGFI("[WMS] Destroy: %{public}u", windowId);
|
||||
WM_SCOPED_TRACE("wms:DestroyWindow(%u)", windowId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:DestroyWindow(%u)", windowId);
|
||||
auto node = windowRoot_->GetWindowNode(windowId);
|
||||
if (node != nullptr && node->GetWindowType() == WindowType::WINDOW_TYPE_DRAGGING_EFFECT) {
|
||||
dragController_->FinishDrag(windowId);
|
||||
@@ -523,7 +524,7 @@ void WindowManagerService::OnWindowEvent(Event event, const sptr<IRemoteObject>&
|
||||
void WindowManagerService::NotifyDisplayStateChange(DisplayId defaultDisplayId, sptr<DisplayInfo> displayInfo,
|
||||
const std::map<DisplayId, sptr<DisplayInfo>>& displayInfoMap, DisplayStateChangeType type)
|
||||
{
|
||||
WM_SCOPED_TRACE("wms:NotifyDisplayStateChange(%u)", type);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:NotifyDisplayStateChange(%u)", type);
|
||||
DisplayId displayId = (displayInfo == nullptr) ? DISPLAY_ID_INVALID : displayInfo->GetDisplayId();
|
||||
if (type == DisplayStateChangeType::FREEZE) {
|
||||
freezeDisplayController_->FreezeDisplay(displayId);
|
||||
@@ -564,7 +565,7 @@ void WindowManagerService::ProcessPointUp(uint32_t windowId)
|
||||
void WindowManagerService::MinimizeAllAppWindows(DisplayId displayId)
|
||||
{
|
||||
return wmsTaskLooper_->PostTask([this, displayId]() {
|
||||
WM_SCOPED_TRACE("wms:MinimizeAllAppWindows(%" PRIu64")", displayId);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:MinimizeAllAppWindows(%" PRIu64")", displayId);
|
||||
WLOGFI("displayId %{public}" PRIu64"", displayId);
|
||||
windowController_->MinimizeAllAppWindows(displayId);
|
||||
});
|
||||
@@ -573,7 +574,7 @@ void WindowManagerService::MinimizeAllAppWindows(DisplayId displayId)
|
||||
WMError WindowManagerService::ToggleShownStateForAllAppWindows()
|
||||
{
|
||||
wmsTaskLooper_->PostTask([this]() {
|
||||
WM_SCOPED_TRACE("wms:ToggleShownStateForAllAppWindows");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:ToggleShownStateForAllAppWindows");
|
||||
return windowController_->ToggleShownStateForAllAppWindows();
|
||||
});
|
||||
return WMError::WM_OK;
|
||||
@@ -590,7 +591,7 @@ WMError WindowManagerService::SetWindowLayoutMode(WindowLayoutMode mode)
|
||||
{
|
||||
return wmsTaskLooper_->ScheduleTask([this, mode]() {
|
||||
WLOGFI("layoutMode: %{public}u", mode);
|
||||
WM_SCOPED_TRACE("wms:SetWindowLayoutMode");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:SetWindowLayoutMode");
|
||||
return windowController_->SetWindowLayoutMode(mode);
|
||||
}).get();
|
||||
}
|
||||
@@ -608,7 +609,7 @@ WMError WindowManagerService::UpdateProperty(sptr<WindowProperty>& windowPropert
|
||||
return WMError::WM_OK;
|
||||
}
|
||||
return wmsTaskLooper_->ScheduleTask([this, &windowProperty, action]() {
|
||||
WM_SCOPED_TRACE("wms:UpdateProperty");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:UpdateProperty");
|
||||
WMError res = windowController_->UpdateProperty(windowProperty, action);
|
||||
if (action == PropertyChangeAction::ACTION_UPDATE_RECT && res == WMError::WM_OK &&
|
||||
windowProperty->GetWindowSizeChangeReason() == WindowSizeChangeReason::MOVE) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <cinttypes>
|
||||
#include <ctime>
|
||||
#include <display_power_mgr_client.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <power_mgr_client.h>
|
||||
|
||||
#include "common_event_manager.h"
|
||||
@@ -32,7 +33,6 @@
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -361,7 +361,7 @@ void WindowNodeContainer::UpdateSizeChangeReason(sptr<WindowNode>& node, WindowS
|
||||
|
||||
void WindowNodeContainer::UpdateWindowTree(sptr<WindowNode>& node)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
node->priority_ = zorderPolicy_->GetWindowPriority(node->GetWindowType());
|
||||
RaiseInputMethodWindowPriorityIfNeeded(node);
|
||||
RaiseShowWhenLockedWindowIfNeeded(node);
|
||||
@@ -386,7 +386,7 @@ void WindowNodeContainer::UpdateWindowTree(sptr<WindowNode>& node)
|
||||
|
||||
bool WindowNodeContainer::UpdateRSTree(sptr<WindowNode>& node, DisplayId displayId, bool isAdd, bool animationPlayed)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
if (node->GetWindowProperty()->GetCustomAnimation()) {
|
||||
WLOGFI("not need to update RsTree since SystemWindowAnimation is playing");
|
||||
return false;
|
||||
@@ -424,9 +424,9 @@ bool WindowNodeContainer::UpdateRSTree(sptr<WindowNode>& node, DisplayId display
|
||||
// default transition curve: EASE OUT
|
||||
static const Rosen::RSAnimationTimingCurve curve = Rosen::RSAnimationTimingCurve::EASE_OUT;
|
||||
// add window with transition animation
|
||||
WM_SCOPED_TRACE_BEGIN("Animate(%u)", node->GetWindowId());
|
||||
StartTraceArgs(HITRACE_TAG_WINDOW_MANAGER, "Animate(%u)", node->GetWindowId());
|
||||
RSNode::Animate(timingProtocol, curve, updateRSTreeFunc);
|
||||
WM_SCOPED_TRACE_END();
|
||||
FinishTrace(HITRACE_TAG_WINDOW_MANAGER);
|
||||
} else {
|
||||
// add or remove window without animation
|
||||
WLOGFI("add or remove window without animation");
|
||||
@@ -686,7 +686,8 @@ void WindowNodeContainer::HandleKeepScreenOn(const sptr<WindowNode>& node, bool
|
||||
return;
|
||||
}
|
||||
WLOGFI("handle keep screen on: [%{public}s, %{public}d]", node->GetWindowName().c_str(), requireLock);
|
||||
WM_SCOPED_TRACE("container:HandleKeepScreenOn(%s, %d)", node->GetWindowName().c_str(), requireLock);
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "container:HandleKeepScreenOn(%s, %d)",
|
||||
node->GetWindowName().c_str(), requireLock);
|
||||
ErrCode res;
|
||||
// reset ipc identity
|
||||
std::string identity = IPCSkeleton::ResetCallingIdentity();
|
||||
@@ -790,7 +791,7 @@ void WindowNodeContainer::ProcessWindowAvoidAreaChangeWhenDisplayChange() const
|
||||
|
||||
void WindowNodeContainer::NotifyIfSystemBarTintChanged(DisplayId displayId) const
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
auto expectSystemBarProp = GetExpectImmersiveProperty();
|
||||
SystemBarRegionTints tints;
|
||||
SysBarTintMap& sysBarTintMap = displayGroupController_->sysBarTintMaps_[displayId];
|
||||
@@ -810,7 +811,7 @@ void WindowNodeContainer::NotifyIfSystemBarTintChanged(DisplayId displayId) cons
|
||||
|
||||
void WindowNodeContainer::NotifyIfSystemBarRegionChanged(DisplayId displayId) const
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
SystemBarRegionTints tints;
|
||||
SysBarTintMap& sysBarTintMap = displayGroupController_->sysBarTintMaps_[displayId];
|
||||
SysBarNodeMap& sysBarNodeMap = displayGroupController_->sysBarNodeMaps_[displayId];
|
||||
@@ -899,7 +900,7 @@ void WindowNodeContainer::NotifySystemBarTints(std::vector<DisplayId> displayIdV
|
||||
|
||||
void WindowNodeContainer::NotifyDockWindowStateChanged(sptr<WindowNode>& node, bool isEnable)
|
||||
{
|
||||
WM_FUNCTION_TRACE();
|
||||
HITRACE_METER(HITRACE_TAG_WINDOW_MANAGER);
|
||||
WLOGFI("[Immersive] begin isEnable: %{public}d", isEnable);
|
||||
if (isEnable) {
|
||||
for (auto& windowNode : appWindowNode_->children_) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "minimize_app.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "window_helper.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
#include "window_inner_manager.h"
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
#include <cinttypes>
|
||||
#include <display_power_mgr_client.h>
|
||||
#include <hisysevent.h>
|
||||
#include <hitrace_meter.h>
|
||||
#include <transaction/rs_transaction.h>
|
||||
|
||||
#include "display_manager_service_inner.h"
|
||||
#include "window_helper.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "window_manager_service.h"
|
||||
#include "wm_trace.h"
|
||||
#include "window_manager_agent_controller.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -216,7 +216,7 @@ WMError WindowRoot::SaveWindow(const sptr<WindowNode>& node)
|
||||
|
||||
WMError WindowRoot::MinimizeStructuredAppWindowsExceptSelf(sptr<WindowNode>& node)
|
||||
{
|
||||
WM_SCOPED_TRACE("root:MinimizeStructuredAppWindowsExceptSelf");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "root:MinimizeStructuredAppWindowsExceptSelf");
|
||||
auto container = GetOrCreateWindowNodeContainer(node->GetDisplayId());
|
||||
if (container == nullptr) {
|
||||
WLOGFE("MinimizeAbility failed, window container could not be found");
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
*/
|
||||
|
||||
#include "snapshot_controller.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
#include "window_manager_hilog.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_trace.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@@ -46,7 +48,7 @@ WMError SnapshotController::TakeSnapshot(const std::shared_ptr<RSSurfaceNode>& s
|
||||
|
||||
int32_t SnapshotController::GetSnapshot(const sptr<IRemoteObject> &token, Snapshot& snapshot)
|
||||
{
|
||||
WM_SCOPED_TRACE("wms:GetSnapshot");
|
||||
HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "wms:GetSnapshot");
|
||||
if (token == nullptr) {
|
||||
WLOGFE("Get ailityToken failed!");
|
||||
return static_cast<int32_t>(WMError::WM_ERROR_NULLPTR);
|
||||
|
||||
Reference in New Issue
Block a user