1# Ability Subsystem Changelog
2
3## cl.ability.1 Auto Startup Related APIs in ApplicationContext Are Deleted
4
5**Access Level**
6
7Public API
8
9**Reason for Change**
10
11According to security and privacy requirements, APIs related to auto startup in **ApplicationContext** are deleted. Applications cannot proactively set the auto startup status.
12
13**Change Impact**
14
15This change is a non-compatible change. If your code uses the involved APIs, delete them.
16
17**API Level**
18
1911
20
21**Change Since**
22
23OpenHarmony SDK 4.1.6.5
24
25**Key API/Component Changes**
26
27```js
28  on(type: 'abilityAutoStartup', callback: AutoStartupCallback): void;
29  off(type: 'abilityAutoStartup', callback?: AutoStartupCallback): void;
30  setAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<void>): void;
31  setAutoStartup(info: AutoStartupInfo): Promise<void>;
32  cancelAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<void>): void;
33  cancelAutoStartup(info: AutoStartupInfo): Promise<void>;
34  isAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<boolean>): void;
35  isAutoStartup(info: AutoStartupInfo): Promise<boolean>;
36```
37
38- Before change:
39
40  ```js
41     /**
42     * Register the listener that watches for current application auto startup state.
43     *
44     * @param { 'abilityAutoStartup' } type - Indicates the type of event.
45     * @param { AutoStartupCallback } callback - Auto startup callback.
46     * @throws { BusinessError } 401 - The parameter check failed.
47     * @syscap SystemCapability.Ability.AbilityRuntime.Core
48     * @StageModelOnly
49     * @since 11
50     */
51    on(type: 'abilityAutoStartup', callback: AutoStartupCallback): void;
52
53    /**
54     * Unregister listener that watches for current application auto startup state.
55     *
56     * @param { 'abilityAutoStartup' } type - Indicates the type of event.
57     * @param { AutoStartupCallback } [callback] - Auto startup callback.
58     * @throws { BusinessError } 401 - The parameter check failed.
59     * @syscap SystemCapability.Ability.AbilityRuntime.Core
60     * @StageModelOnly
61     * @since 11
62     */
63    off(type: 'abilityAutoStartup', callback?: AutoStartupCallback): void;
64
65    /**
66     * Set current application auto startup state.
67     *
68     * @param { AutoStartupInfo } info - The application info.
69     * @param { AsyncCallback<void> } callback - The callback of setAutoStartup.
70     * @throws { BusinessError } 401 - The parameter check failed.
71     * @syscap SystemCapability.Ability.AbilityRuntime.Core
72     * @StageModelOnly
73     * @since 11
74     */
75    setAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<void>): void;
76
77    /**
78     * Set current application auto startup state.
79     *
80     * @param { AutoStartupInfo } info - The application info.
81     * @returns { Promise<void> } The promise returned by the function.
82     * @throws { BusinessError } 401 - The parameter check failed.
83     * @syscap SystemCapability.Ability.AbilityRuntime.Core
84     * @StageModelOnly
85     * @since 11
86     */
87    setAutoStartup(info: AutoStartupInfo): Promise<void>;
88
89    /**
90     * Cancel current application auto startup state.
91     *
92     * @param { AutoStartupInfo } info - The application info.
93     * @param { AsyncCallback<void> } callback - The callback of cancelAutoStartup.
94     * @throws { BusinessError } 401 - The parameter check failed.
95     * @syscap SystemCapability.Ability.AbilityRuntime.Core
96     * @StageModelOnly
97     * @since 11
98     */
99    cancelAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<void>): void;
100
101    /**
102     * Cancel current application auto startup state.
103     *
104     * @param { AutoStartupInfo } info - The application info.
105     * @returns { Promise<void> } The promise returned by the function.
106     * @throws { BusinessError } 401 - The parameter check failed.
107     * @syscap SystemCapability.Ability.AbilityRuntime.Core
108     * @StageModelOnly
109     * @since 11
110     */
111    cancelAutoStartup(info: AutoStartupInfo): Promise<void>;
112
113    /**
114     * Check if the current application is auto startup state.
115     *
116     * @param { AutoStartupInfo } info - The application info.
117     * @param { AsyncCallback<boolean> } callback - The callback of isAutoStartup.
118     * @throws { BusinessError } 401 - The parameter check failed.
119     * @syscap SystemCapability.Ability.AbilityRuntime.Core
120     * @StageModelOnly
121     * @since 11
122     */
123    isAutoStartup(info: AutoStartupInfo, callback: AsyncCallback<boolean>): void;
124
125    /**
126     * Check if the current application is auto startup state.
127     *
128     * @param { AutoStartupInfo } info - The application info.
129     * @returns { Promise<boolean> } The promise returned by the function.
130     * @throws { BusinessError } 401 - The parameter check failed.
131     * @syscap SystemCapability.Ability.AbilityRuntime.Core
132     * @StageModelOnly
133     * @since 11
134     */
135    isAutoStartup(info: AutoStartupInfo): Promise<boolean>;
136  ```
137
138**Adaptation Guide**
139
140Delete the involved APIs from your code.
141
142
143## cl.ability.2 Permission for Using AutoStartupInfo Is Changed
144
145**Access Level**
146
147Public API
148
149**Reason for Change**
150
151After the APIs related to auto startup in **ApplicationContext** are deleted, **AutoStartupInfo** is not available for third-party applications and is changed to a system API.
152
153**Change Impact**
154
155This change is a non-compatible change. If your code uses the involved APIs, delete them.
156
157**API Level**
158
15911
160
161**Change Since**
162
163OpenHarmony SDK 4.1.6.5
164
165**Key API/Component Changes**
166
167```js
168  AutoStartupInfo {
169    bundleName: string;
170    moduleName?: string;
171    abilityName: string;
172    abilityTypeName?: string;
173  }
174```
175
176- Before change:
177
178  ```js
179    /**
180     * Bundle name
181     *
182     * @type { string }
183     * @syscap SystemCapability.Ability.AbilityRuntime.Core
184     * @StageModelOnly
185     * @since 11
186     */
187    bundleName: string;
188
189    /**
190     * Module name
191     *
192     * @type { ?string }
193     * @syscap SystemCapability.Ability.AbilityRuntime.Core
194     * @StageModelOnly
195     * @since 11
196     */
197    moduleName?: string;
198
199    /**
200     * Ability Name
201     *
202     * @type { string }
203     * @syscap SystemCapability.Ability.AbilityRuntime.Core
204     * @StageModelOnly
205     * @since 11
206     */
207    abilityName: string;
208
209    /**
210     * Ability Type Name
211     *
212     * @type { ?string }
213     * @syscap SystemCapability.Ability.AbilityRuntime.Core
214     * @StageModelOnly
215     * @since 11
216     */
217    abilityTypeName?: string;
218  ```
219
220- After change:
221
222  ```js
223    /**
224     * Bundle name
225     *
226     * @type { string }
227     * @syscap SystemCapability.Ability.AbilityRuntime.Core
228     * @systemapi
229     * @StageModelOnly
230     * @since 11
231     */
232    bundleName: string;
233
234    /**
235     * Module name
236     *
237     * @type { ?string }
238     * @syscap SystemCapability.Ability.AbilityRuntime.Core
239     * @systemapi
240     * @StageModelOnly
241     * @since 11
242     */
243    moduleName?: string;
244
245    /**
246     * Ability Name
247     *
248     * @type { string }
249     * @syscap SystemCapability.Ability.AbilityRuntime.Core
250     * @systemapi
251     * @StageModelOnly
252     * @since 11
253     */
254    abilityName: string;
255
256    /**
257     * Ability Type Name
258     *
259     * @type { ?string }
260     * @syscap SystemCapability.Ability.AbilityRuntime.Core
261     * @systemapi
262     * @StageModelOnly
263     * @since 11
264     */
265    abilityTypeName?: string;
266  ```
267
268**Adaptation Guide**
269
270Make sure the APIs are only invoked by system applications.
271
272The code snippet is as follows:
273
274```ts
275import AutoStartupManager from '@ohos.app.ability.autoStartupManager';
276import { BusinessError } from '@ohos.base';
277
278try {
279  AutoStartupManager.setApplicationAutoStartup({
280    bundleName: 'com.example.autostartupapp',
281    abilityName: 'EntryAbility'
282  }).then((data: void) => {
283    console.info('====> setApplicationAutoStartup data: ' + JSON.stringify(data));
284  }).catch((err: BusinessError) => {
285    console.info('====> setApplicationAutoStartup err: ' + JSON.stringify(err));
286  });
287} catch (err) {
288  console.info('====> setApplicationAutoStartup throw err: ' + JSON.stringify(err));
289}
290```
291
292
293## cl.ability.3 Permission for Using AutoStartupCallback Is Changed
294**Access Level**
295
296Public API
297
298**Reason for Change**
299
300After the APIs related to auto startup in **ApplicationContext** are deleted, **AutoStartupCallback** is not available for third-party applications and is changed to a system API.
301
302**Change Impact**
303
304This change is a non-compatible change. If your code uses the involved APIs, delete them.
305
306**API Level**
307
30811
309
310**Change Since**
311
312OpenHarmony SDK 4.1.6.5
313
314**Key API/Component Changes**
315
316- Involved API:
317
318  ```js
319    onAutoStartupOn(info: AutoStartupInfo): void;
320    onAutoStartupOff(info: AutoStartupInfo): void;
321  ```
322
323- Before change:
324
325  ```js
326    /**
327     * When the application's auto startup state is set to on, this function is called.
328     *
329     * @param { AutoStartupInfo } info - Auto startup info.
330     * @syscap SystemCapability.Ability.AbilityRuntime.Core
331     * @StageModelOnly
332     * @since 11
333     */
334    onAutoStartupOn(info: AutoStartupInfo): void;
335
336    /**
337     * When the application's auto startup state is set to off, this function is called.
338     *
339     * @param { AutoStartupInfo } info - Auto startup info.
340     * @syscap SystemCapability.Ability.AbilityRuntime.Core
341     * @StageModelOnly
342     * @since 11
343     */
344    onAutoStartupOff(info: AutoStartupInfo): void;
345  ```
346
347- After change:
348
349  ```js
350    /**
351     * When the application's auto startup state is set to on, this function is called.
352     *
353     * @param { AutoStartupInfo } info - Auto startup info.
354     * @syscap SystemCapability.Ability.AbilityRuntime.Core
355     * @systemapi
356     * @StageModelOnly
357     * @since 11
358     */
359    onAutoStartupOn(info: AutoStartupInfo): void;
360
361    /**
362     * When the application's auto startup state is set to off, this function is called.
363     *
364     * @param { AutoStartupInfo } info - Auto startup info.
365     * @syscap SystemCapability.Ability.AbilityRuntime.Core
366     * @systemapi
367     * @StageModelOnly
368     * @since 11
369     */
370    onAutoStartupOff(info: AutoStartupInfo): void;
371  ```
372
373**Adaptation Guide**
374
375Make sure the APIs are only invoked by system applications.
376
377The code snippet is as follows:
378
379```ts
380import AutoStartupManager from '@ohos.app.ability.autoStartupManager';
381import common from '@ohos.app.ability.common';
382
383try {
384  AutoStartupManager.on('systemAutoStartup', {
385    onAutoStartupOn(data: common.AutoStartupInfo) {
386      console.info('===> autostartupmanager onAutoStartupOn data: ' + JSON.stringify(data));
387    },
388    onAutoStartupOff(data: common.AutoStartupInfo) {
389      console.info('===> autostartupmanager onAutoStartupOff data: ' + JSON.stringify(data));
390    }
391  });
392} catch (err) {
393  console.info('===> autostartupmanager on throw err: ' + JSON.stringify(err));
394}
395```
396