diff --git a/displaymanager.yaml b/displaymanager.yaml index 89bd42b85b6bb6b8d06aa7a494a950095f33401d..eadff14f9cf243462768dfdbcb35272282c47242 100644 --- a/displaymanager.yaml +++ b/displaymanager.yaml @@ -31,3 +31,15 @@ AMBIENT_LIGHT: __BASE: {type: STATISTIC, level: MINOR, tag: PowerStats, desc: ambient light information} TYPE: {type: INT32, desc: ambient light type} LEVEL: {type: INT32, desc: ambient light adjusts screen brightness} + +DMS_WAIT_LOCKSCREENON_TIMEOUT: + __BASE: {type: BEHAVIOR, level: CRITICAL, desc: dms wait lockscreenon timeout information} + PACKAGE_NAME: {type: STRING, desc: call package name} + PROCESS_NAME: {type: STRING, desc: call process name} + MSG: {type: STRING, desc: dms wait lockscreenon timeout message} + +DMS_WAIT_LOCKSCREENOFF_TIMEOUT: + __BASE: {type: BEHAVIOR, level: CRITICAL, desc: dms wait lockscreenoff timeout information} + PACKAGE_NAME: {type: STRING, desc: call package name} + PROCESS_NAME: {type: STRING, desc: call process name} + MSG: {type: STRING, desc: dms wait lockscreenoff timeout message} \ No newline at end of file diff --git a/state_manager/service/native/include/screen_action.h b/state_manager/service/native/include/screen_action.h index eb21e067fd07ea106f3ddeda271aba6400f8c661..448c5c1234d545c06a92c4cf3033356e73638dff 100644 --- a/state_manager/service/native/include/screen_action.h +++ b/state_manager/service/native/include/screen_action.h @@ -38,6 +38,7 @@ public: uint32_t GetDisplayId(); DisplayState GetDisplayState(); + void WriteHiSysEvent(DisplayState state, int64_t beginTimeMs); bool SetDisplayState(DisplayState state, const std::function& callback); bool SetDisplayPower(DisplayState state, uint32_t reason); uint32_t GetBrightness(); diff --git a/state_manager/service/native/src/screen_action.cpp b/state_manager/service/native/src/screen_action.cpp index 38ad1de86c7f409920ba174a24919cfabcb455b3..937813e34220c339d1ec98ac420d44e23b142148 100644 --- a/state_manager/service/native/src/screen_action.cpp +++ b/state_manager/service/native/src/screen_action.cpp @@ -14,7 +14,7 @@ */ #include "screen_action.h" - +#include #include #include @@ -85,8 +85,31 @@ bool ScreenAction::EnableSkipSetDisplayState(uint32_t reason) return false; } +void ScreenAction::WriteHiSysEvent(DisplayState state, int64_t beginTimeMs) +{ + constexpr int64_t DMS_WAIT_LOCKSCREENON_TIMEOUT = 300; + constexpr int64_t DMS_WAIT_LOCKSCREENOFF_TIMEOUT = 2000; + int64_t endTimeMs = GetTickCount(); + if ((endTimeMs - beginTimeMs > DMS_WAIT_LOCKSCREENON_TIMEOUT) && state == DisplayState::DISPLAY_ON) { + std::string msg = "Dms Wait Lockscreenon Time Consuming Over 300MS"; + DISPLAY_HILOGI(FEAT_STATE, "dms wait lockscreenon timeout=%{public}lld", (endTimeMs - beginTimeMs)); + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::DISPLAY, "DMS_WAIT_LOCKSCREENON_TIMEOUT", + HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "PACKAGE_NAME", "powermgr", "PROCESS_NAME", + "ScreenAction", "MSG", msg); + } else if ((endTimeMs - beginTimeMs > DMS_WAIT_LOCKSCREENOFF_TIMEOUT) && state == DisplayState::DISPLAY_OFF) { + std::string msg = "Dms Wait Lockscreenoff Time Consuming Over 2000MS"; + DISPLAY_HILOGI(FEAT_STATE, "dms wait lockscreenoff timeout=%{public}lld", (endTimeMs - beginTimeMs)); + HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::DISPLAY, "DMS_WAIT_LOCKSCREENOFF_TIMEOUT", + HiviewDFX::HiSysEvent::EventType::BEHAVIOR, "PACKAGE_NAME", "powermgr", "PROCESS_NAME", + "ScreenAction", "MSG", msg); + } +} + bool ScreenAction::SetDisplayState(DisplayState state, const std::function& callback) { +#ifdef HAS_HIVIEWDFX_HISYSEVENT_PART + int64_t beginTimeMs = GetTickCount(); +#endif DISPLAY_HILOGI(FEAT_STATE, "[UL_POWER] SetDisplayState displayId=%{public}u, state=%{public}u", displayId_, static_cast(state)); Rosen::DisplayState rds = Rosen::DisplayState::UNKNOWN; @@ -120,6 +143,9 @@ bool ScreenAction::SetDisplayState(DisplayState state, const std::function