|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| figures/ | | 12-May-2024 | - | | |
| frameworks/ | | 12-May-2024 | - | 12,416 | 7,151 |
| interfaces/ | | 12-May-2024 | - | 11,643 | 7,982 |
| sa_profile/ | | 12-May-2024 | - | 33 | 29 |
| services/ | | 12-May-2024 | - | 29,242 | 20,021 |
| test/ | | 12-May-2024 | - | 18,034 | 12,797 |
| tools/ | | 12-May-2024 | - | 3,405 | 2,176 |
| .gitattributes | D | 12-May-2024 | 631 | 16 | 15 |
| BUILD.gn | D | 12-May-2024 | 617 | 15 | 13 |
| CODEOWNERS | D | 12-May-2024 | 669 | 17 | 15 |
| LICENSE | D | 12-May-2024 | 10.1 KiB | 177 | 150 |
| OAT.xml | D | 12-May-2024 | 3.9 KiB | 68 | 15 |
| README_zh.md | D | 12-May-2024 | 45.9 KiB | 585 | 468 |
| bundle.json | D | 12-May-2024 | 5.4 KiB | 149 | 147 |
| event.gni | D | 12-May-2024 | 2.3 KiB | 75 | 52 |
| hisysevent.yaml | D | 12-May-2024 | 2.9 KiB | 69 | 47 |
README_zh.md
1# 公共事件子系统
2
3## 简介
4
5OpenHarmony通过CES(Common Event Service,公共事件服务)为应用程序提供订阅、发布、退订公共事件的能力。
6
7公共事件可分为系统公共事件和自定义公共事件。
8
9- 系统公共事件:系统将收集到的事件信息,根据系统策略发送给订阅该事件的用户程序。 例如:系统关键服务发布的系统事件(例如:hap安装,更新,卸载等)。
10
11- 自定义公共事件:应用自定义一些公共事件用来实现跨应用的事件通信能力。
12
13每个应用都可以按需订阅公共事件,订阅成功且公共事件发布,系统会把其发送给应用。这些公共事件可能来自系统、其他应用和应用自身。
14
15### 架构图
16
17**图1** 子系统架构图
18
19![子系统架构图](figures/cesfwk_architecture_diagram.png "公共事件服务架构图")
20
21
22
23## 目录
24
25```
26/base/notification/common_event_service/
27│── frameworks # 组件目录
28│ |── common/log # 日志组件目录
29│ |── core # native接口内部实现
30│ ├── native # native接口实现
31│── interface # 对外接口声明
32| |── inner_api # native接口声明
33| |── kits/napi # napi接口声明
34├── sa_profile # 服务配置
35├── services # 服务实现
36├── tools # 工具实现
37│── ohos.build # 编译脚本
38
39```
40
41
42
43## 使用说明
44
45### 概述
46
47CommonEvent提供发布公共事件、创建订阅者、订阅、取消订阅等的接口。
48
49公共事件的由string类型的event和CommonEventPublishData类型的options两部分组成,event表示公共事件的名称,options表示公共事件的属性信息。
50
51CommonEventSubscribeInfo类型为订阅信息,用于创建公共事件订阅者,可以指定订阅者要订阅的公共事件,要求发布者需要具备的权限,订阅者的优先级等等。
52
53CommonEventSubscriber类型为公共事件订阅者,用于获取所接受公共事件的相关信息,及设定公共事件的处理信息。
54
55使用功能接口前,需要导入相关模块。
56
57```js
58import CommonEvent from '@ohos.commonevent';
59```
60
61### 发布公共事件
62
63#### CommonEvent.publish(event: string, callback: AsyncCallback<void>)
64
65- 接口说明
66
67 发布公共事件(callback形式)
68
69- publish参数描述
70
71 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
72 | -------- | -------- | ------------------- | ---- | ------------------------------ |
73 | event | 只读 | string | 是 | 表示要发布的公共事件的名称 |
74 | callback | 只读 | AsyncCallback<void> | 是 | 表示发布公共事件方法的回调方法 |
75
76-
77
78 返回值为void
79
80- 示例
81
82```js
83import CommonEvent from '@ohos.commonevent'
84
85function PublishCallBack(err) {
86 console.info("==========================>PublishCallBack=======================>");
87}
88
89CommonEvent.publish("publish_event", PublishCallBack);
90```
91
92#### CommonEvent.publish(event: string, options: CommonEventPublishData, callback: AsyncCallback<void>)
93
94- 接口说明
95
96 发布公共事件指定发布信息(callback形式)
97
98- publish参数描述
99
100 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
101 | -------- | -------- | ---------------------- | ---- | ------------------------------ |
102 | event | 只读 | string | 是 | 表示要发布的公共事件的名称 |
103 | options | 只读 | CommonEventPublishData | 是 | 表示要发布的公共事件的属性信息 |
104 | callback | 只读 | AsyncCallback<void> | 是 | 表示发布公共事件方法的回调方法 |
105
106- CommonEventPublishData类型说明
107
108 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
109 | --------------------- | -------- | ------------- | ---- | ---------------------------- |
110 | bundleName | 只读 | string | 否 | 表示包名称 |
111 | code | 只读 | int | 否 | 表示公共事件的结果代码 |
112 | data | 只读 | string | 否 | 表示公共事件的自定义结果数据 |
113 | subscriberPermissions | 只读 | Array<string> | 否 | 表示订阅者所需的权限 |
114 | isOrdered | 只读 | bool | 否 | 表示是否是有序公共事件 |
115
116-
117
118 返回值为void
119
120- 示例
121
122```js
123import CommonEvent from '@ohos.commonevent'
124
125var CommonEventPublishData = {
126 code: 1,
127 data: "information_data",
128 isOrdered: false
129}
130
131function PublishCallBack(err) {
132 console.info("==========================>PublishCallBack=======================>");
133}
134
135CommonEvent.publish("publish_event", CommonEventPublishData, PublishCallBack);
136```
137
138### 创建订阅者对象
139#### CommonEvent.createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback<CommonEventSubscriber>)
140
141- 接口说明
142
143 创建订阅者对象(callback形式)
144
145- createSubscriber参数描述
146
147 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
148 | ------------- | -------- | ------------------------------------ | ---- | ------------------------ |
149 | subscribeInfo | 只读 | CommonEventSubscribeInfo | 是 | 表示订阅信息 |
150 | callback | 只读 | AsyncCallback<CommonEventSubscriber> | 是 | 表示创建订阅者的回调方法 |
151
152- CommonEventSubscriber 类说明
153
154 | 名称 | 参数 | 返回值 | 描述 |
155 | --------------------- | --------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------ |
156 | getCode | callback: AsyncCallback<number> | void | 获取公共事件的结果代码(callback形式) |
157 | getCode | void | Promise<number> | 获取公共事件的结果代码(Promise形式) |
158 | setCode | code: number, callback: AsyncCallback<void> | void | 设置公共事件的结果代码(callback形式) |
159 | setCode | code: number | Promise<void> | 设置公共事件的结果代码(Promise形式) |
160 | getData | callback: AsyncCallback<string> | void | 获取公共事件的结果数据(callback形式) |
161 | getData | void | Promise<string> | 获取公共事件的结果数据(Promise形式) |
162 | setData | data: string, callback: AsyncCallback<void> | void | 设置公共事件的结果数据(callback形式) |
163 | setData | data: string | Promise<void> | 设置公共事件的结果数据(Promise形式) |
164 | setCodeAndData | code: number, data: string, callback: AsyncCallback<void> | void | 设置公共事件的结果代码和结果数据(callback形式) |
165 | setCodeAndData | code: number, data: string | Promise<void> | 设置公共事件的结果代码和结果数据(Promise形式) |
166 | isOrderedCommonEvent | callback: AsyncCallback<boolean> | void | 查询当前公共事件的是否为有序公共事件,返回true代表是有序公共事件,false代表不是有序公共事件(callback形式) |
167 | isOrderedCommonEvent | void | Promise<bool> | 查询当前公共事件的是否为有序公共事件,返回true代表是有序公共事件,false代表不是有序公共事件(Promise形式) |
168 | abortCommonEvent | callback: AsyncCallback<void> | void | 取消当前的公共事件,仅对有序公共事件有效,取消后,公共事件不再向下一个订阅者传递(callback形式) |
169 | abortCommonEvent | void | Promise<void> | 取消当前的公共事件,仅对有序公共事件有效,取消后,公共事件不再向下一个订阅者传递(Promise形式) |
170 | clearAbortCommonEvent | callback: AsyncCallback<void> | void | 清除当前有序公共事件abort状态(callback形式) |
171 | clearAbortCommonEvent | void | Promise<void> | 清除当前有序公共事件abort状态(Promise形式) |
172 | getAbortCommonEvent | callback: AsyncCallback<boolean> | void | 获取当前有序公共事件是否取消的状态(callback形式) |
173 | getAbortCommonEvent | void | Promise<boolean> | 获取当前有序公共事件是否取消的状态Promise形式) |
174 | getSubscribeInfo | callback: AsyncCallback<CommonEventSubscribeInfo> | void | 获取订阅者的订阅信息(callback形式) |
175 | getSubscribeInfo | void | Promise<CommonEventSubscribeInfo> | 获取订阅者的订阅信息(Promise形式) |
176
177- CommonEventSubscribeInfo类型说明
178
179 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
180 | ------------------- | -------- | ------------- | ---- | ------------------------------------------------------------ |
181 | events | 只读 | Array<string> | 是 | 表示要订阅的公共事件 |
182 | publisherPermission | 只读 | string | 否 | 表示发布者的权限 |
183 | publisherDeviceId | 只读 | int | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID |
184 | userId | 只读 | int | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
185 | priority | 只读 | int | 否 | 表示订阅者的优先级,范围为-100~1000。 |
186
187-
188
189 返回值为void
190
191- 示例
192
193```js
194import CommonEvent from '@ohos.commonevent'
195
196var CommonEventSubscribeInfo = {
197 events: ["event"]
198};
199
200function CreateSubscriberCallBack(err, data) {
201 console.info("==========================>CreateSubscriberCallBack=======================>");
202}
203
204CommonEvent.createSubscriber(CommonEventSubscribeInfo, CreateSubscriberCallBack);
205```
206
207
208#### CommonEvent.createSubscriber(subscribeInfo: CommonEventSubscribeInfo)
209
210- 接口说明
211
212 创建订阅者(Promise形式)
213
214- createSubscriber参数描述
215
216 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
217 | ------------- | -------- | ------------------------ | ---- | ------------ |
218 | subscribeInfo | 只读 | CommonEventSubscribeInfo | 是 | 表示订阅信息 |
219
220- CommonEventSubscribeInfo类型说明
221
222 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
223 | ------------------- | -------- | ------------- | ---- | ------------------------------------------------------------ |
224 | events | 只读 | Array<string> | 是 | 表示要发送的公共事件 |
225 | publisherPermission | 只读 | string | 否 | 表示发布者的权限 |
226 | publisherDeviceId | 只读 | int | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID |
227 | userId | 只读 | int | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
228 | priority | 只读 | int | 否 | 表示订阅者的优先级。值的范围是-100到1000 |
229
230-
231
232 返回值为Promise<CommonEventSubscriber>
233
234- 示例
235
236```js
237import CommonEvent from '@ohos.commonevent'
238
239var CommonEventSubscribeInfo = {
240 events: ["event"]
241};
242
243CommonEvent.createSubscriber(CommonEventSubscribeInfo).then((data) => {
244 console.info("==========================>createSubscriberPromise=======================>");
245});
246```
247
248### 订阅公共事件
249
250#### CommonEvent.subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback<CommonEventData>)
251
252- 接口说明
253
254 订阅公共事件(callback形式)
255
256- subscribe参数描述
257
258 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
259 | ---------- | -------- | ------------------------------ | ---- | ------------------------------ |
260 | subscriber | 只读 | CommonEventSubscriber | 是 | 表示订阅者对象 |
261 | callback | 只读 | AsyncCallback<CommonEventData> | 是 | 表示接收公共事件数据的回调函数 |
262
263- CommonEventData类型说明
264
265 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
266 | ---------- | -------- | ------ | ---- | ------------------------------------------------------- |
267 | event | 只读 | string | 是 | 表示当前接收的公共事件名称 |
268 | bundleName | 只读 | string | 否 | 表示包名称 |
269 | code | 只读 | int | 否 | 表示公共事件的结果代码,用于传递int类型的数据 |
270 | data | 只读 | string | 否 | 表示公共事件的自定义结果数据,用于传递string 类型的数据 |
271
272-
273
274 返回值为void
275
276- 示例
277
278 * 无序事件:
279
280 ```js
281 import CommonEvent from '@ohos.commonevent'
282
283 var CommonEventSubscriber;
284 //订阅者信息
285 var CommonEventSubscribeInfo = {
286 events: ["event"]
287 };
288 //订阅回调
289 function SubscriberCallBack(err, data) {
290 console.info("==========================>SubscriberCallBack=======================>");
291 }
292 //创建订阅者回调
293 function CreateSubscriberCallBack(err, data) {
294 console.info("==========================>CreateSubscriberCallBack=======================>");
295 CommonEventSubscriber = data;
296 //订阅事件
297 CommonEvent.subscribe(CommonEventSubscriber, SubscriberCallBack);
298 }
299 //创建订阅者
300 CommonEvent.createSubscriber(CommonEventSubscribeInfo, CreateSubscriberCallBack);
301 ```
302
303 * 有序事件
304
305 ```js
306 import CommonEvent from '@ohos.commonevent'
307
308 var CommonEventSubscriber1;
309 var CommonEventSubscriber2;
310 //订阅者信息
311 var CommonEventSubscribeInfo1 = {
312 events: ["event"]
313 };
314 var CommonEventSubscribeInfo2 = {
315 events: ["event"]
316 };
317 //发布回调
318 function PublishCallback(err) {
319 console.info("==========================>PublishCallback=======================>");
320 }
321 //setCode回调
322 function setCodeCallBack(err) {
323 console.info("==========================>setCodeCallBack=======================>");
324 }
325 //setData回调
326 function setDataCallBack(err) {
327 console.info("==========================>setDataCallBack=======================>");
328 }
329 //finish回调
330 function finishCommonEventCallBack(err) {
331 console.info("==========================>finishCommonEventCallBack=======================>");
332 }
333 //订阅者1回调
334 function SubscriberCallBack1(err, data) {
335 console.info("==========================>SubscriberCallBack1=======================>");
336 data.setCode(0, setCodeCallBack);
337 data.setData("publish_event_change", setDataCallBack);
338 data.finishCommonEvent(finishCommonEventCallBack)
339 }
340 //订阅者2回调
341 function SubscriberCallBack2(err, data) {
342 console.info("==========================>SubscriberCallBack2=======================>");
343 data.finishCommonEvent(finishCommonEventCallBack)
344 }
345
346 //创建订阅者1回调
347 function CreateSubscriberCallBack1(err, data) {
348 console.info("==========================>CreateSubscriberCallBack1=======================>");
349 CommonEventSubscriber1 = data;
350 await CommonEvent.subscribe(CommonEventSubscriber1, SubscriberCallBack1);
351 }
352 //创建订阅者2回调
353 function CreateSubscriberCallBack2(err, data) {
354 console.info("==========================>CreateSubscriberCallBack2=======================>");
355 CommonEventSubscriber2 = data;
356 await CommonEvent.subscribe(CommonEventSubscriber2, SubscriberCallBack2);
357 }
358
359 //创建订阅者1
360 CommonEvent.createSubscriber(CommonEventSubscribeInfo1, CreateSubscriberCallBack1);
361 //创建订阅者2
362 CommonEvent.createSubscriber(CommonEventSubscribeInfo2, CreateSubscriberCallBack2);
363
364 //发布信息
365 var CommonEventPublishData = {
366 bundleName: "publish_event_bundleName",
367 code: 1,
368 data: "publish_event_init",
369 isOrdered: true
370 }
371 //发布
372 await CommonEvent.publish("event", CommonEventPublishData, PublishCallback);
373 ```
374
375### 取消订阅公共事件
376
377#### CommonEvent.unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback<void>)
378
379- 接口说明
380
381 创建订阅者(callback形式)
382
383- unsubscribe参数描述
384
385 | 名称 | 读写属性 | 类型 | 必填 | 描述 |
386 | ---------- | -------- | --------------------- | ---- | ---------------------- |
387 | subscriber | 只读 | CommonEventSubscriber | 是 | 表示订阅者对象 |
388 | callback | 只读 | AsyncCallback<void> | 否 | 表示取消订阅的回调方法 |
389
390-
391
392 返回值为void
393
394- 示例
395
396```js
397import CommonEvent from '@ohos.commonevent'
398
399var CommonEventSubscriber;
400//订阅者信息
401var CommonEventSubscribeInfo = {
402 events: ["event"]
403};
404//订阅回调
405function SubscriberCallBack(err, data) {
406 console.info("==========================>SubscriberCallBack=======================>");
407}
408//创建订阅者回调
409function CreateSubscriberCallBack(err, data) {
410 console.info("==========================>CreateSubscriberCallBack=======================>");
411 CommonEventSubscriber = data;
412 //订阅事件
413 CommonEvent.subscribe(CommonEventSubscriber, SubscriberCallBack);
414}
415//取消订阅回调
416function UnsubscriberCallBack(err) {
417 console.info("==========================>UnsubscriberCallBack=======================>");
418}
419
420//创建订阅者
421CommonEvent.createSubscriber(CommonEventSubscribeInfo, CreateSubscriberCallBack);
422//取消订阅
423CommonEvent.unsubscriber(CommonEventSubscriber, UnsubscriberCallBack);
424```
425
426### 系统公共事件定义
427
428| 系统公共事件宏 | 系统公共事件名称 | 订阅者所需权限 |
429| ------------------------------------------------------------ | ----------------------------------------------------------- | ---------------------------------------------- |
430| COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED |
431| COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED |
432| COMMON_EVENT_SHUTDOWN | usual.event.SHUTDOWN | 无 |
433| COMMON_EVENT_BATTERY_CHANGED | usual.event.BATTERY_CHANGED | 无 |
434| COMMON_EVENT_BATTERY_LOW | usual.event.BATTERY_LOW | 无 |
435| COMMON_EVENT_BATTERY_OKAY | usual.event.BATTERY_OKAY | 无 |
436| COMMON_EVENT_POWER_CONNECTED | usual.event.POWER_CONNECTED | 无 |
437| COMMON_EVENT_POWER_DISCONNECTED | usual.event.POWER_DISCONNECTED | 无 |
438| COMMON_EVENT_SCREEN_OFF | usual.event.SCREEN_OFF | 无 |
439| COMMON_EVENT_SCREEN_ON | usual.event.SCREEN_ON | 无 |
440| COMMON_EVENT_USER_PRESENT | usual.event.USER_PRESENT | 无 |
441| COMMON_EVENT_TIME_TICK | usual.event.TIME_TICK | 无 |
442| COMMON_EVENT_TIME_CHANGED | usual.event.TIME_CHANGED | 无 |
443| COMMON_EVENT_DATE_CHANGED | usual.event.DATE_CHANGED | 无 |
444| COMMON_EVENT_TIMEZONE_CHANGED | usual.event.TIMEZONE_CHANGED | 无 |
445| COMMON_EVENT_CLOSE_SYSTEM_DIALOGS | usual.event.CLOSE_SYSTEM_DIALOGS | 无 |
446| COMMON_EVENT_BUNDLE_SCAN_FINISHED | usual.event.BUNDLE_SCAN_FINISHED | 无 |
447| COMMON_EVENT_PACKAGE_ADDED | usual.event.PACKAGE_ADDED | 无 |
448| COMMON_EVENT_SANDBOX_PACKAGE_ADDED | usual.event.SANDBOX_PACKAGE_ADDED | 无 |
449| COMMON_EVENT_SANDBOX_PACKAGE_REMOVED | usual.event.SANDBOX_PACKAGE_REMOVED | 无 |
450| COMMON_EVENT_PACKAGE_REPLACED | usual.event.PACKAGE_REPLACED | 无 |
451| COMMON_EVENT_MY_PACKAGE_REPLACED | usual.event.MY_PACKAGE_REPLACED | 无 |
452| COMMON_EVENT_PACKAGE_REMOVED | usual.event.PACKAGE_REMOVED | 无 |
453| COMMON_EVENT_BUNDLE_REMOVED | usual.event.BUNDLE_REMOVED | 无 |
454| COMMON_EVENT_PACKAGE_FULLY_REMOVED | usual.event.PACKAGE_FULLY_REMOVED | 无 |
455| COMMON_EVENT_PACKAGE_CHANGED | usual.event.PACKAGE_CHANGED | 无 |
456| COMMON_EVENT_PACKAGE_RESTARTED | usual.event.PACKAGE_RESTARTED | 无 |
457| COMMON_EVENT_PACKAGE_DATA_CLEARED | usual.event.PACKAGE_DATA_CLEARED | 无 |
458| COMMON_EVENT_PACKAGE_CACHE_CLEARED<sup>9+<sup> | usual.event.PACKAGE_CACHE_CLEARED | 无 |
459| COMMON_EVENT_PACKAGES_SUSPENDED | usual.event.PACKAGES_SUSPENDED | 无 |
460| COMMON_EVENT_PACKAGES_UNSUSPENDED | usual.event.PACKAGES_UNSUSPENDED | 无 |
461| COMMON_EVENT_MY_PACKAGE_SUSPENDED | usual.event.MY_PACKAGE_SUSPENDED | 无 |
462| COMMON_EVENT_MY_PACKAGE_UNSUSPENDED | usual.event.MY_PACKAGE_UNSUSPENDED | 无 |
463| COMMON_EVENT_UID_REMOVED | usual.event.UID_REMOVED | 无 |
464| COMMON_EVENT_PACKAGE_FIRST_LAUNCH | usual.event.PACKAGE_FIRST_LAUNCH | 无 |
465| COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION | usual.event.PACKAGE_NEEDS_VERIFICATION | 无 |
466| COMMON_EVENT_PACKAGE_VERIFIED | usual.event.PACKAGE_VERIFIED | 无 |
467| COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE | usual.event.EXTERNAL_APPLICATIONS_AVAILABLE | 无 |
468| COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE | usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE | 无 |
469| COMMON_EVENT_CONFIGURATION_CHANGED | usual.event.CONFIGURATION_CHANGED | 无 |
470| COMMON_EVENT_LOCALE_CHANGED | usual.event.LOCALE_CHANGED | 无 |
471| COMMON_EVENT_MANAGE_PACKAGE_STORAGE | usual.event.MANAGE_PACKAGE_STORAGE | 无 |
472| COMMON_EVENT_DRIVE_MODE | common.event.DRIVE_MODE | 无 |
473| COMMON_EVENT_HOME_MODE | common.event.HOME_MODE | 无 |
474| COMMON_EVENT_OFFICE_MODE | common.event.OFFICE_MODE | 无 |
475| COMMON_EVENT_USER_STARTED | usual.event.USER_STARTED | 无 |
476| COMMON_EVENT_USER_BACKGROUND | usual.event.USER_BACKGROUND | 无 |
477| COMMON_EVENT_USER_FOREGROUND | usual.event.USER_FOREGROUND | 无 |
478| COMMON_EVENT_USER_SWITCHED | usual.event.USER_SWITCHED | ohos.permission.MANAGE_LOCAL_ACCOUNTS |
479| COMMON_EVENT_USER_STARTING | usual.event.USER_STARTING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS |
480| COMMON_EVENT_USER_UNLOCKED | usual.event.USER_UNLOCKED | 无 |
481| COMMON_EVENT_USER_STOPPING | usual.event.USER_STOPPING | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS |
482| COMMON_EVENT_USER_STOPPED | usual.event.USER_STOPPED | 无 |
483| COMMON_EVENT_HWID_LOGIN | common.event.HWID_LOGIN | 无 |
484| COMMON_EVENT_HWID_LOGOUT | common.event.HWID_LOGOUT | 无 |
485| COMMON_EVENT_HWID_TOKEN_INVALID | common.event.HWID_TOKEN_INVALID | 无 |
486| COMMON_EVENT_HWID_LOGOFF | common.event.HWID_LOGOFF | 无 |
487| COMMON_EVENT_WIFI_POWER_STATE | usual.event.wifi.POWER_STATE | 无 |
488| COMMON_EVENT_WIFI_SCAN_FINISHED | usual.event.wifi.SCAN_FINISHED | ohos.permission.LOCATION |
489| COMMON_EVENT_WIFI_RSSI_VALUE | usual.event.wifi.RSSI_VALUE | ohos.permission.GET_WIFI_INFO |
490| COMMON_EVENT_WIFI_CONN_STATE | usual.event.wifi.CONN_STATE | 无 |
491| COMMON_EVENT_WIFI_HOTSPOT_STATE | usual.event.wifi.HOTSPOT_STATE | 无 |
492| COMMON_EVENT_WIFI_AP_STA_JOIN | usual.event.wifi.WIFI_HS_STA_JOIN | ohos.permission.GET_WIFI_INFO |
493| COMMON_EVENT_WIFI_AP_STA_LEAVE | usual.event.wifi.WIFI_HS_STA_LEAVE | ohos.permission.GET_WIFI_INFO |
494| COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE | usual.event.wifi.mplink.STATE_CHANGE | ohos.permission.MPLINK_CHANGE_STATE |
495| COMMON_EVENT_WIFI_P2P_CONN_STATE | usual.event.wifi.p2p.CONN_STATE_CHANGE | ohos.permission.GET_WIFI_INFO |
496| COMMON_EVENT_WIFI_P2P_STATE_CHANGED | usual.event.wifi.p2p.STATE_CHANGE | ohos.permission.GET_WIFI_INFO |
497| COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED | usual.event.wifi.p2p.DEVICES_CHANGE | ohos.permission.GET_WIFI_INFO |
498| COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED | usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE | ohos.permission.GET_WIFI_INFO |
499| COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED | usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE | ohos.permission.GET_WIFI_INFO |
500| COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED | usual.event.wifi.p2p.GROUP_STATE_CHANGED | ohos.permission.GET_WIFI_INFO |
501| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
502| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH |
503| COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
504| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
505| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE | usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE | ohos.permission.USE_BLUETOOTH |
506| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
507| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
508| COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE | usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH |
509| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED | usual.event.bluetooth.remotedevice.DISCOVERED | ohos.permission.USE_BLUETOOTH |
510| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE | usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH |
511| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED | usual.event.bluetooth.remotedevice.ACL_CONNECTED | ohos.permission.USE_BLUETOOTH |
512| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED | usual.event.bluetooth.remotedevice.ACL_DISCONNECTED | ohos.permission.USE_BLUETOOTH |
513| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE | usual.event.bluetooth.remotedevice.NAME_UPDATE | ohos.permission.USE_BLUETOOTH |
514| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE | usual.event.bluetooth.remotedevice.PAIR_STATE | ohos.permission.USE_BLUETOOTH |
515| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE | usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE | ohos.permission.USE_BLUETOOTH |
516| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT | usual.event.bluetooth.remotedevice.SDP_RESULT | 无 |
517| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE | usual.event.bluetooth.remotedevice.UUID_VALUE | ohos.permission.DISCOVER_BLUETOOTH |
518| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ | usual.event.bluetooth.remotedevice.PAIRING_REQ | ohos.permission.DISCOVER_BLUETOOTH |
519| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL | usual.event.bluetooth.remotedevice.PAIRING_CANCEL | 无 |
520| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ | usual.event.bluetooth.remotedevice.CONNECT_REQ | 无 |
521| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY | usual.event.bluetooth.remotedevice.CONNECT_REPLY | 无 |
522| COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL | usual.event.bluetooth.remotedevice.CONNECT_CANCEL | 无 |
523| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE | 无 |
524| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE | 无 |
525| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT | usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT | 无 |
526| COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE | usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE | 无 |
527| COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE | usual.event.bluetooth.host.STATE_UPDATE | 无 |
528| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE | usual.event.bluetooth.host.REQ_DISCOVERABLE | 无 |
529| COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE | usual.event.bluetooth.host.REQ_ENABLE | ohos.permission.USE_BLUETOOTH |
530| COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE | usual.event.bluetooth.host.REQ_DISABLE | ohos.permission.USE_BLUETOOTH |
531| COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE | usual.event.bluetooth.host.SCAN_MODE_UPDATE | ohos.permission.USE_BLUETOOTH |
532| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED | usual.event.bluetooth.host.DISCOVERY_STARTED | ohos.permission.USE_BLUETOOTH |
533| COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED | usual.event.bluetooth.host.DISCOVERY_FINISHED | ohos.permission.USE_BLUETOOTH |
534| COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE | usual.event.bluetooth.host.NAME_UPDATE | ohos.permission.USE_BLUETOOTH |
535| COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE | usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
536| COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE | usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
537| COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE | usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE | ohos.permission.USE_BLUETOOTH |
538| COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED | usual.event.nfc.action.ADAPTER_STATE_CHANGED | 无 |
539| COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED | usual.event.nfc.action.RF_FIELD_ON_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS |
540| COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED | usual.event.nfc.action.RF_FIELD_OFF_DETECTED | ohos.permission.MANAGE_SECURE_SETTINGS |
541| COMMON_EVENT_DISCHARGING | usual.event.DISCHARGING | 无 |
542| COMMON_EVENT_CHARGING | usual.event.CHARGING | 无 |
543| COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED | usual.event.DEVICE_IDLE_MODE_CHANGED | 无 |
544| COMMON_EVENT_POWER_SAVE_MODE_CHANGED | usual.event.POWER_SAVE_MODE_CHANGED | 无 |
545| COMMON_EVENT_USER_ADDED | usual.event.USER_ADDED | ohos.permission.MANAGE_LOCAL_ACCOUNTS |
546| COMMON_EVENT_USER_REMOVED | usual.event.USER_REMOVED | ohos.permission.MANAGE_LOCAL_ACCOUNTS |
547| COMMON_EVENT_ABILITY_ADDED | common.event.ABILITY_ADDED | ohos.permission.LISTEN_BUNDLE_CHANGE |
548| COMMON_EVENT_ABILITY_REMOVED | common.event.ABILITY_REMOVED | ohos.permission.LISTEN_BUNDLE_CHANGE |
549| COMMON_EVENT_ABILITY_UPDATED | common.event.ABILITY_UPDATED | ohos.permission.LISTEN_BUNDLE_CHANGE |
550| COMMON_EVENT_LOCATION_MODE_STATE_CHANGED | usual.event.location.MODE_STATE_CHANGED | 无 |
551| COMMON_EVENT_IVI_SLEEP | common.event.IVI_SLEEP | 无 |
552| COMMON_EVENT_IVI_PAUSE | common.event.IVI_PAUSE | 无 |
553| COMMON_EVENT_IVI_STANDBY | common.event.IVI_STANDBY | 无 |
554| COMMON_EVENT_IVI_LASTMODE_SAVE | common.event.IVI_LASTMODE_SAVE | 无 |
555| COMMON_EVENT_IVI_VOLTAGE_ABNORMAL | common.event.IVI_VOLTAGE_ABNORMAL | 无 |
556| COMMON_EVENT_IVI_HIGH_TEMPERATURE | common.event.IVI_HIGH_TEMPERATURE | 无 |
557| COMMON_EVENT_IVI_EXTREME_TEMPERATURE | common.event.IVI_EXTREME_TEMPERATURE | 无 |
558| COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL | common.event.IVI_TEMPERATURE_ABNORMAL | 无 |
559| COMMON_EVENT_IVI_VOLTAGE_RECOVERY | common.event.IVI_VOLTAGE_RECOVERY | 无 |
560| COMMON_EVENT_IVI_TEMPERATURE_RECOVERY | common.event.IVI_TEMPERATURE_RECOVERY | 无 |
561| COMMON_EVENT_IVI_ACTIVE | common.event.IVI_ACTIVE | 无 |
562|COMMON_EVENT_USB_STATE | usual.event.hardware.usb.action.USB_STATE | 无 |
563|COMMON_EVENT_USB_PORT_CHANGED | usual.event.hardware.usb.action.USB_PORT_CHANGED | 无 |
564| COMMON_EVENT_USB_DEVICE_ATTACHED | usual.event.hardware.usb.action.USB_DEVICE_ATTACHED | 无 |
565| COMMON_EVENT_USB_DEVICE_DETACHED | usual.event.hardware.usb.action.USB_DEVICE_DETACHED | 无 |
566| COMMON_EVENT_USB_ACCESSORY_ATTACHED | usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED | 无 |
567| COMMON_EVENT_USB_ACCESSORY_DETACHED | usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED | 无 |
568| COMMON_EVENT_DISK_REMOVED | usual.event.data.DISK_REMOVED | ohos.permission.WRITE_USER_STORAGE |
569| COMMON_EVENT_DISK_UNMOUNTED | usual.event.data.DISK_UNMOUNTED | ohos.permission.WRITE_USER_STORAGE |
570| COMMON_EVENT_DISK_MOUNTED | usual.event.data.DISK_MOUNTED | ohos.permission.WRITE_USER_STORAGE |
571| COMMON_EVENT_DISK_BAD_REMOVAL | usual.event.data.DISK_BAD_REMOVAL | ohos.permission.WRITE_USER_STORAGE |
572| COMMON_EVENT_DISK_UNMOUNTABLE | usual.event.data.DISK_UNMOUNTABLE | ohos.permission.WRITE_USER_STORAGE |
573| COMMON_EVENT_DISK_EJECT | usual.event.data.DISK_EJECT | ohos.permission.WRITE_USER_STORAGE |
574| COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED | usual.event.data.VISIBLE_ACCOUNTS_UPDATED | ohos.permission.GET_APP_ACCOUNTS |
575| COMMON_EVENT_ACCOUNT_DELETED | usual.event.data.ACCOUNT_DELETED | ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS |
576| COMMON_EVENT_FOUNDATION_READY | common.event.FOUNDATION_READY | ohos.permission.RECEIVER_STARTUP_COMPLETED |
577| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 |
578| COMMON_EVENT_QUICK_FIX_APPLY_RESULT<sup>9+<sup> | usual.event.QUICK_FIX_APPLY_RESULT | 无 |
579| COMMON_EVENT_QUICK_FIX_REVOKE_RESULT<sup>9+<sup> | usual.event.QUICK_FIX_REVOKE_RESULT | 无 |
580
581## 相关仓
582
583**[公共事件子系统](https://gitee.com/openharmony/notification_common_event_service/blob/master/README_zh.md)**
584
585[通知子系统](https://gitee.com/openharmony/notification_distributed_notification_service/blob/master/README_zh.md)