add system event

Signed-off-by: libo429 <libo429@huawei.com>
This commit is contained in:
libo429 2024-10-12 16:48:53 +08:00
parent 196181365f
commit 02581096f2
4 changed files with 27 additions and 1 deletions

View File

@ -1489,6 +1489,12 @@ const std::string CommonEventSupport::COMMON_EVENT_VPN_CONNECTION_STATUS_CHANGED
*/
const std::string CommonEventSupport::COMMON_EVENT_SECOND_MOUNTED = "usual.event.SECOND_MOUNTED";
/**
* Indicates that an application begins to restored.
* This is a protected common event that can only be sent by system.
*/
const std::string CommonEventSupport::COMMON_EVENT_RESTORE_START = "usual.event.RESTORE_START";
CommonEventSupport::CommonEventSupport()
{
Init();
@ -2827,6 +2833,12 @@ void CommonEventSupport::Init()
* This is a protected common event that can only be sent by system.
*/
commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_SECOND_MOUNTED);
/**
* Indicates that an application begins to restored.
* This is a protected common event that can only be sent by system.
*/
commonEventSupport_.emplace_back(CommonEventSupport::COMMON_EVENT_RESTORE_START);
return;
}

View File

@ -1352,6 +1352,12 @@ public:
*/
static const std::string COMMON_EVENT_SECOND_MOUNTED;
/**
* Indicates that an application begins to restored.
* This is a protected common event that can only be sent by system.
*/
static const std::string COMMON_EVENT_RESTORE_START;
public:
CommonEventSupport();

View File

@ -654,6 +654,10 @@ napi_value SupportInit(napi_env env, napi_value exports)
obj,
EventFwk::CommonEventSupport::COMMON_EVENT_SECOND_MOUNTED,
"COMMON_EVENT_SECOND_MOUNTED");
SetNamedPropertyByStr(env,
obj,
EventFwk::CommonEventSupport::COMMON_EVENT_RESTORE_START,
"COMMON_EVENT_RESTORE_START");
napi_property_descriptor exportFuncs[] = {DECLARE_NAPI_PROPERTY("Support", obj)};
napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs);

View File

@ -163,6 +163,9 @@ static const std::unordered_map<std::string, std::pair<PermissionState, std::vec
{CommonEventSupport::COMMON_EVENT_VPN_CONNECTION_STATUS_CHANGED,
{PermissionState::DEFAULT, {"ohos.permission.GET_NETWORK_INFO"}}
},
{CommonEventSupport::COMMON_EVENT_RESTORE_START,
{PermissionState::DEFAULT, {"ohos.permission.START_RESTORE_NOTIFICATION"}}
},
};
static const std::unordered_set<std::string> SYSTEM_API_COMMON_EVENTS {
@ -170,7 +173,8 @@ static const std::unordered_set<std::string> SYSTEM_API_COMMON_EVENTS {
CommonEventSupport::COMMON_EVENT_DEVICE_IDLE_EXEMPTION_LIST_UPDATED,
CommonEventSupport::COMMON_EVENT_PACKAGE_INSTALLATION_STARTED,
CommonEventSupport::COMMON_EVENT_CHARGE_TYPE_CHANGED,
CommonEventSupport::COMMON_EVENT_DYNAMIC_ICON_CHANGED
CommonEventSupport::COMMON_EVENT_DYNAMIC_ICON_CHANGED,
CommonEventSupport::COMMON_EVENT_RESTORE_START
};
static const std::vector<std::string> SENSITIVE_COMMON_EVENTS {