1# Distributed Scheduler Subsystem Changelog 2 3## cl.DistributedManagerService.1 continuationManager on()/off() Changes 4 5- The event types passed to the **continuationManager.on** and **continuationManager.off** APIs do not comply with the OpenHarmony API specifications. 6- The return value of **continuationManager.on** varies with the event type, which does not comply with the OpenHarmony API specifications. 7 8The following changes have been made: 9 10- Changed the event type **deviceConnect** to **deviceSelected** and **deviceDisconnect** to **deviceUnselected** in the **continuationManager.on** and **continuationManager.off** APIs. 11- Changed the return value of **continuationManager.on** to **Callback<Array<ContinuationResult>>** for all events. 12 13**Change Impact** 14 15The application developed based on earlier versions needs to be adapted. Otherwise, the service logic will be affected. 16 17**Key API/Component Changes** 18 19- Involved APIs: 20 21 continuationManager.on; 22 continuationManager.off; 23 24- Before change: 25 26```js 27 function on(type: "deviceConnect", token: number, callback: Callback<Array<ContinuationResult>>): void; 28 function off(type: "deviceConnect", token: number): void; 29 function on(type: "deviceDisconnect", token: number, callback: Callback<Array<string>>): void; 30 function off(type: "deviceDisconnect", token: number): void; 31``` 32 33- After change: 34 35```js 36 function on(type: "deviceSelected", token: number, callback: Callback<Array<ContinuationResult>>): void; 37 function off(type: "deviceSelected", token: number): void; 38 function on(type: "deviceUnselected", token: number, callback: Callback<Array<ContinuationResult>>): void; 39 function off(type: "deviceUnselected", token: number): void; 40``` 41 42**Adaptation Guide** 43Change the event names. The code snippet is as follows: 44 45Event of device selection in **continuationManager.on**: 46 47```ts 48 let token = 1; 49 try { 50 continuationManager.on("deviceSelected", token, (data) => { 51 console.info('onDeviceSelected len: ' + data.length); 52 for (let i = 0; i < data.length; i++) { 53 console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id)); 54 console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type)); 55 console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name)); 56 } 57 }); 58 } catch (err) { 59 console.error('on failed, cause: ' + JSON.stringify(err)); 60 } 61``` 62 63Event of device selection in **continuationManager.off**: 64 65```ts 66 let token = 1; 67 try { 68 continuationManager.off("deviceSelected", token); 69 } catch (err) { 70 console.error('off failed, cause: ' + JSON.stringify(err)); 71 } 72``` 73 74Event of device deselection in **continuationManager.on**: 75 76```ts 77 let token = 1; 78 try { 79 continuationManager.on("deviceUnselected", token, (data) => { 80 console.info('onDeviceUnselected len: ' + data.length); 81 for (let i = 0; i < data.length; i++) { 82 console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id)); 83 console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type)); 84 console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name)); 85 } 86 console.info('onDeviceUnselected finished.'); 87 }); 88 } catch (err) { 89 console.error('on failed, cause: ' + JSON.stringify(err)); 90 } 91``` 92 93Event of device deselection in **continuationManager.off**: 94 95```ts 96 let token = 1; 97 try { 98 continuationManager.off("deviceUnselected", token); 99 } catch (err) { 100 console.error('off failed, cause: ' + JSON.stringify(err)); 101 } 102``` 103 104## cl.DistributedManagerService.2 Adding DATASYNC Permission Verification to continuationManager APIs 105 106In earlier versions, the **continuationManager** APIs do not verify the caller, which does not comply with the OpenHarmony API specifications. 107Now, before using a **continuationManager** API, the caller must apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission. 108 109**Change Impact** 110 111The application developed based on earlier versions needs to apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission in advance. Otherwise, the service logic will be affected. 112 113**Key API/Component Changes** 114 115Involved APIs: 116 117 - continuationManager.registerContinuation; 118 - continuationManager.on; 119 - continuationManager.off; 120 - continuationManager.unregisterContinuation; 121 - continuationManager.updateContinuationState; 122 - continuationManager.startContinuationDeviceManager; 123