diff --git a/frameworks/native/src/common_event_support.cpp b/frameworks/native/src/common_event_support.cpp index 7b0b20110898c969e7fb942bf29fb7f226c58e7a..d2bb83fef15bc7844fbe9609f3c2395ef4d06123 100644 --- a/frameworks/native/src/common_event_support.cpp +++ b/frameworks/native/src/common_event_support.cpp @@ -1588,6 +1588,12 @@ const std::string CommonEventSupport::COMMON_EVENT_CUSTOM_CONFIG_POLICY_UPDATED const std::string CommonEventSupport::COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED = "usual.event.CUSTOM_ROAMING_REGION_UPDATED"; +/** + * Indicates that the device screen capture. + * This is a protected common event that can only be sent by system. + */ + const std::string CommonEventSupport::COMMON_EVENT_SCREEN_CAPTURE = "usual.event.SCREEN_CAPTURE"; + CommonEventSupport::CommonEventSupport() { Init(); @@ -3015,6 +3021,12 @@ void CommonEventSupport::Init() * This is a protected common event that can only be sent by system. */ commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED); + + /** + * Indicates that the device has updated the custom roaming region of device. + * This is a protected common event that can only be sent by system. + */ + commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_SCREEN_CAPTURE); return; } diff --git a/interfaces/inner_api/common_event_support.h b/interfaces/inner_api/common_event_support.h index 2723e9f007e017da0604f9710db03bfc56ca5bd5..3bc128fdfa50292e2fc3721d815c819e5a6f6391 100644 --- a/interfaces/inner_api/common_event_support.h +++ b/interfaces/inner_api/common_event_support.h @@ -1439,6 +1439,12 @@ public: */ static const std::string COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED; + /** + * Indicates that the device has updated the custom roaming region of device. + * This is a protected common event that can only be sent by system. + */ + static const std::string COMMON_EVENT_SCREEN_CAPTURE; + public: CommonEventSupport(); diff --git a/interfaces/kits/napi/support/src/support.cpp b/interfaces/kits/napi/support/src/support.cpp index 572629cfffa4145ecb0e3a1bfb236b2df69a62ab..bec0ec630519e04d9424896bf2f54e1d9091b95f 100644 --- a/interfaces/kits/napi/support/src/support.cpp +++ b/interfaces/kits/napi/support/src/support.cpp @@ -714,6 +714,10 @@ napi_value SupportInit(napi_env env, napi_value exports) obj, EventFwk::CommonEventSupport::COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED, "COMMON_EVENT_CUSTOM_ROAMING_REGION_UPDATED"); + SetNamedPropertyByStr(env, + obj, + EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_CAPTURE, + "COMMON_EVENT_SCREEN_CAPTURE"); napi_property_descriptor exportFuncs[] = {DECLARE_NAPI_PROPERTY("Support", obj)}; napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs); diff --git a/interfaces/kits/ndk/include/oh_commonevent_support.h b/interfaces/kits/ndk/include/oh_commonevent_support.h index b8a00bc52dd1e859548218586b88497b35feafbd..e60ac6091273e2f2e756b38a1a3cac921b09dcee 100644 --- a/interfaces/kits/ndk/include/oh_commonevent_support.h +++ b/interfaces/kits/ndk/include/oh_commonevent_support.h @@ -438,6 +438,11 @@ static const char* const COMMON_EVENT_KIOSK_MODE_ON = "usual.event.KIOSK_MODE_ON */ static const char* const COMMON_EVENT_KIOSK_MODE_OFF = "usual.event.KIOSK_MODE_OFF"; +/** + * Indicates that the device has exited kiosk mode. + * This is a protected common event that can only be sent by system. + */ +static const char* const COMMON_EVENT_SCREEN_CAPTURE = "usual.event.SCREEN_CAPTURE"; #ifdef __cplusplus } #endif diff --git a/services/src/common_event_permission_manager.cpp b/services/src/common_event_permission_manager.cpp index 5bfb1987c8f8e58257c82cb3512459d6231f0135..aff87521cf8e18b17bd0c3e282c624208767c2d9 100644 --- a/services/src/common_event_permission_manager.cpp +++ b/services/src/common_event_permission_manager.cpp @@ -181,6 +181,9 @@ static const std::unordered_map SYSTEM_API_COMMON_EVENTS {