1e41f4b71Sopenharmony_ci# Distributed Scheduler Subsystem ChangeLog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.DistributedManagerService.1 continuationManager API Changes
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci- Event names passed to the **continuationManager** API do not comply with the OpenHarmony API specifications.
6e41f4b71Sopenharmony_ci- The **continuationManager.on** API does not have a unified return value for various events, which does not comply with the OpenHarmony API specifications.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciThe following changes have been made:
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci- The device selection event name of **continuationManager.on** and **continuationManager.off** is changed from **deviceConnect** to **deviceSelected**, and the device deselection event name is changed from **deviceDisconnect** to **deviceUnselected**.
11e41f4b71Sopenharmony_ci- The **continuationManager.on** API returns **Callback<Array<ContinuationResult>>** for all events.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci**Change Impacts**
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThe application developed based on earlier versions needs to adapt the new APIs. Otherwise, the original service logic will be affected.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Key API/Component Changes**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci- Involved APIs:
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci  continuationManager.on;
22e41f4b71Sopenharmony_ci  continuationManager.off;
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci- Before change:
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci```js
27e41f4b71Sopenharmony_ci  function on(type: "deviceConnect", token: number, callback: Callback<Array<ContinuationResult>>): void;
28e41f4b71Sopenharmony_ci  function off(type: "deviceConnect", token: number): void;
29e41f4b71Sopenharmony_ci  function on(type: "deviceDisconnect", token: number, callback: Callback<Array<string>>): void;
30e41f4b71Sopenharmony_ci  function off(type: "deviceDisconnect", token: number): void;
31e41f4b71Sopenharmony_ci```
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci- After change:
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci```js
36e41f4b71Sopenharmony_ci  function on(type: "deviceSelected", token: number, callback: Callback<Array<ContinuationResult>>): void;
37e41f4b71Sopenharmony_ci  function off(type: "deviceSelected", token: number): void;
38e41f4b71Sopenharmony_ci  function on(type: "deviceUnselected", token: number, callback: Callback<Array<ContinuationResult>>): void;
39e41f4b71Sopenharmony_ci  function off(type: "deviceUnselected", token: number): void;
40e41f4b71Sopenharmony_ci```
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci**Adaptation Guide**
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ciChange the event names. The sample code is as follows:
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciDevice selection event of **continuationManager.on**:
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci```ts
49e41f4b71Sopenharmony_ci  let token = 1;
50e41f4b71Sopenharmony_ci  try {
51e41f4b71Sopenharmony_ci    continuationManager.on("deviceSelected", token, (data) => {
52e41f4b71Sopenharmony_ci      console.info('onDeviceSelected len: ' + data.length);
53e41f4b71Sopenharmony_ci      for (let i = 0; i < data.length; i++) {
54e41f4b71Sopenharmony_ci        console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id));
55e41f4b71Sopenharmony_ci        console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type));
56e41f4b71Sopenharmony_ci        console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name));
57e41f4b71Sopenharmony_ci      }
58e41f4b71Sopenharmony_ci    });
59e41f4b71Sopenharmony_ci  } catch (err) {
60e41f4b71Sopenharmony_ci    console.error('on failed, cause: ' + JSON.stringify(err));
61e41f4b71Sopenharmony_ci  }
62e41f4b71Sopenharmony_ci```
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ciDevice selection event of **continuationManager.off**:
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci```ts
67e41f4b71Sopenharmony_ci  let token = 1;
68e41f4b71Sopenharmony_ci  try {
69e41f4b71Sopenharmony_ci    continuationManager.off("deviceSelected", token);
70e41f4b71Sopenharmony_ci  } catch (err) {
71e41f4b71Sopenharmony_ci    console.error('off failed, cause: ' + JSON.stringify(err));
72e41f4b71Sopenharmony_ci  }
73e41f4b71Sopenharmony_ci```
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciDevice deselection event of **continuationManager.on**:
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci```ts
78e41f4b71Sopenharmony_ci  let token = 1;
79e41f4b71Sopenharmony_ci  try {
80e41f4b71Sopenharmony_ci    continuationManager.on("deviceUnselected", token, (data) => {
81e41f4b71Sopenharmony_ci      console.info('onDeviceUnselected len: ' + data.length);
82e41f4b71Sopenharmony_ci      for (let i = 0; i < data.length; i++) {
83e41f4b71Sopenharmony_ci        console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id));
84e41f4b71Sopenharmony_ci        console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type));
85e41f4b71Sopenharmony_ci        console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name));
86e41f4b71Sopenharmony_ci      }
87e41f4b71Sopenharmony_ci      console.info('onDeviceUnselected finished.');
88e41f4b71Sopenharmony_ci    });
89e41f4b71Sopenharmony_ci  } catch (err) {
90e41f4b71Sopenharmony_ci    console.error('on failed, cause: ' + JSON.stringify(err));
91e41f4b71Sopenharmony_ci  }
92e41f4b71Sopenharmony_ci```
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ciDevice deselection event of **continuationManager.off**:
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci```ts
97e41f4b71Sopenharmony_ci  let token = 1;
98e41f4b71Sopenharmony_ci  try {
99e41f4b71Sopenharmony_ci    continuationManager.off("deviceUnselected", token);
100e41f4b71Sopenharmony_ci  } catch (err) {
101e41f4b71Sopenharmony_ci    console.error('off failed, cause: ' + JSON.stringify(err));
102e41f4b71Sopenharmony_ci  }
103e41f4b71Sopenharmony_ci```
104