From 87e9ac0cd335c5f2dfffe50a78edb3f8b123bb53 Mon Sep 17 00:00:00 2001 From: lizhengxing Date: Sat, 23 Aug 2025 19:41:25 +0800 Subject: [PATCH] dh compatity Signed-off-by: lizhengxing --- frameworks/native/src/common_event_support.cpp | 12 ++++++++++++ interfaces/inner_api/common_event_support.h | 6 ++++++ interfaces/kits/napi/support/src/support.cpp | 4 ++++ services/src/common_event_permission_manager.cpp | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/frameworks/native/src/common_event_support.cpp b/frameworks/native/src/common_event_support.cpp index bf513bd7..91354659 100644 --- a/frameworks/native/src/common_event_support.cpp +++ b/frameworks/native/src/common_event_support.cpp @@ -1523,6 +1523,12 @@ const std::string CommonEventSupport::COMMON_EVENT_SECOND_MOUNTED = "usual.event */ const std::string CommonEventSupport::COMMON_EVENT_RESTORE_START = "usual.event.RESTORE_START"; +/** + * Indicates that an application finished restore. + * This is a protected common event that can only be sent by system. + */ +const std::string CommonEventSupport::COMMON_EVENT_RESTORE_END = "usual.event.RESTORE_END"; + /** * Indicates that the managed browser policy is changed. * This is a protected common event that can only be sent by system. @@ -2961,6 +2967,12 @@ void CommonEventSupport::Init() */ commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_RESTORE_START); + /** + * Indicates that an application finished restore. + * This is a protected common event that can only be sent by system. + */ + commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_RESTORE_END); + /** * Indicates that the managed browser policy is changed. * This is a protected common event that can only be sent by system. diff --git a/interfaces/inner_api/common_event_support.h b/interfaces/inner_api/common_event_support.h index 5fb0581f..e1392ab0 100644 --- a/interfaces/inner_api/common_event_support.h +++ b/interfaces/inner_api/common_event_support.h @@ -1380,6 +1380,12 @@ public: */ static const std::string COMMON_EVENT_RESTORE_START; + /** + * Indicates that an application finished restore. + * This is a protected common event that can only be sent by system. + */ + static const std::string COMMON_EVENT_RESTORE_END; + /** * Indicates that the managed browser policy is changed. * This is a protected common event that can only be sent by system. diff --git a/interfaces/kits/napi/support/src/support.cpp b/interfaces/kits/napi/support/src/support.cpp index b3bda289..a05b0dc2 100644 --- a/interfaces/kits/napi/support/src/support.cpp +++ b/interfaces/kits/napi/support/src/support.cpp @@ -674,6 +674,10 @@ napi_value SupportInit(napi_env env, napi_value exports) obj, EventFwk::CommonEventSupport::COMMON_EVENT_RESTORE_START, "COMMON_EVENT_RESTORE_START"); + SetNamedPropertyByStr(env, + obj, + EventFwk::CommonEventSupport::COMMON_EVENT_RESTORE_END, + "COMMON_EVENT_RESTORE_END"); SetNamedPropertyByStr(env, obj, EventFwk::CommonEventSupport::COMMON_EVENT_MANAGED_BROWSER_POLICY_CHANGED, diff --git a/services/src/common_event_permission_manager.cpp b/services/src/common_event_permission_manager.cpp index 3d22070d..e6f70a2e 100644 --- a/services/src/common_event_permission_manager.cpp +++ b/services/src/common_event_permission_manager.cpp @@ -166,6 +166,9 @@ static const std::unordered_map SYSTEM_API_COMMON_EVENTS { CommonEventSupport::COMMON_EVENT_CHARGE_TYPE_CHANGED, CommonEventSupport::COMMON_EVENT_DYNAMIC_ICON_CHANGED, CommonEventSupport::COMMON_EVENT_RESTORE_START, + CommonEventSupport::COMMON_EVENT_RESTORE_END, CommonEventSupport::COMMON_EVENT_DEFAULT_APPLICATION_CHANGED, CommonEventSupport::COMMON_EVENT_SHORTCUT_CHANGED, CommonEventSupport::COMMON_EVENT_TRUSTED_RING_CHECKIN, -- Gitee