diff --git a/frameworks/native/src/common_event_support.cpp b/frameworks/native/src/common_event_support.cpp index b51fc8ae8b526c6c23963ce94d4ddead65d2e0a2..d04507213c3d8d2d3b0ce9d18d9e4a5c757cdc4b 100644 --- a/frameworks/native/src/common_event_support.cpp +++ b/frameworks/native/src/common_event_support.cpp @@ -1333,6 +1333,19 @@ const std::string CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED = "usual.event. */ const std::string CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED = "usual.event.SCREEN_UNLOCKED"; +/** + * Indicates the action of a common event about special code. + * This is a protected common event that can only be sent by system. + */ +const std::string CommonEventSupport::COMMON_EVENT_SPECIAL_CODE = "common.event.SPECIAL_CODE"; + +/** + * Indicates the action of a common event that the call audio quality information has been updated. + * This is a protected common event that can only be sent by system. + */ +const std::string CommonEventSupport::COMMON_EVENT_AUDIO_QUALITY_CHANGE = + "usual.event.AUDIO_QUALITY_CHANGE"; + CommonEventSupport::CommonEventSupport() { Init(); @@ -1664,6 +1677,11 @@ void CommonEventSupport::Init() commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED); commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED); + + commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_SPECIAL_CODE); + + commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_AUDIO_QUALITY_CHANGE); + return; } diff --git a/interfaces/inner_api/common_event_support.h b/interfaces/inner_api/common_event_support.h index 3ceea09f332e698f61ab1fe2485ce929e8e3b224..997535b852658194d2e0ed7ff8cf0099af624082 100644 --- a/interfaces/inner_api/common_event_support.h +++ b/interfaces/inner_api/common_event_support.h @@ -1210,6 +1210,18 @@ public: */ static const std::string COMMON_EVENT_SCREEN_UNLOCKED; + /** + * Indicates the action of a common event about special code. + * This is a protected common event that can only be sent by system. + */ + static const std::string COMMON_EVENT_SPECIAL_CODE; + + /** + * Indicates the action of a common event that the call audio quality information has been updated. + * This is a protected common event that can only be sent by system. + */ + static const std::string COMMON_EVENT_AUDIO_QUALITY_CHANGE; + public: CommonEventSupport(); diff --git a/interfaces/kits/js/@ohos.commonEvent.d.ts b/interfaces/kits/js/@ohos.commonEvent.d.ts index b1fe4ed11cf6a77cb3da56ddedca464691828d59..fe0e3ddd5bf960cd57118b499e8b6e0e57c40bf6 100644 --- a/interfaces/kits/js/@ohos.commonEvent.d.ts +++ b/interfaces/kits/js/@ohos.commonEvent.d.ts @@ -1120,7 +1120,22 @@ declare namespace commonEvent { * To subscribe to this protected common event that can only be sent by system. * @since 10 */ - COMMON_EVENT_HTTP_PROXY_CHANGE = "usual.event.HTTP_PROXY_CHANGE" + COMMON_EVENT_HTTP_PROXY_CHANGE = "usual.event.HTTP_PROXY_CHANGE", + + /** + * Indicates the action of a common event about special code. + * This is a protected common event that can only be sent by system. + * @systemapi + * @since 10 + */ + COMMON_EVENT_SPECIAL_CODE = "usual.event.SPECIAL_CODE", + + /** + * Indicates the action of a common event that the call audio quality information has been updated. + * This is a protected common event that can only be sent by system. + * @since 10 + */ + COMMON_EVENT_AUDIO_QUALITY_CHANGE = "usual.event.AUDIO_QUALITY_CHANGE" } } diff --git a/interfaces/kits/napi/support/src/support.cpp b/interfaces/kits/napi/support/src/support.cpp index c44fc4d255c9ae28f64a36aa93dbd46f6bafe43e..af3059d45fe90a44964e4ce7d0a180610c7449d8 100644 --- a/interfaces/kits/napi/support/src/support.cpp +++ b/interfaces/kits/napi/support/src/support.cpp @@ -574,6 +574,14 @@ napi_value SupportInit(napi_env env, napi_value exports) obj, EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED, "COMMON_EVENT_SCREEN_UNLOCKED"); + SetNamedPropertyByStr(env, + obj, + EventFwk::CommonEventSupport::COMMON_EVENT_SPECIAL_CODE, + "COMMON_EVENT_SPECIAL_CODE"); + SetNamedPropertyByStr(env, + obj, + EventFwk::CommonEventSupport::COMMON_EVENT_AUDIO_QUALITY_CHANGE, + "COMMON_EVENT_AUDIO_QUALITY_CHANGE"); napi_property_descriptor exportFuncs[] = {DECLARE_NAPI_PROPERTY("Support", obj)}; napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs);