1e41f4b71Sopenharmony_ci# Ability Subsystem ChangeLog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.ability.1 Application Component Startup Rule Change
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe rules for starting application components of the ability subsystem are changed in the following scenarios:
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci - Start application components when the application is in the background.
8e41f4b71Sopenharmony_ci - Start invisible application components across applications.
9e41f4b71Sopenharmony_ci - Start **serviceAbility** and **dataAbility** of the FA model across applications.
10e41f4b71Sopenharmony_ci - Use the **startAbilityByCall** API.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciYou need to adapt your application based on the following information.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Change Impacts**
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ciIf new rules are not adapted, application components cannot be started in the previous scenarios.
17e41f4b71Sopenharmony_ci> **NOTE** 
18e41f4b71Sopenharmony_ci>
19e41f4b71Sopenharmony_ci> Starting application components refers to any behavior starting or connecting to an ability.
20e41f4b71Sopenharmony_ci>
21e41f4b71Sopenharmony_ci> 1. Start an ability using APIs such as **startAbility**, **startServiceExtensionAbility**, and **startAbilityByCall**.
22e41f4b71Sopenharmony_ci> 2. Connect to an ability using APIs such as **connectAbility**, **connectServiceExtensionAbility**, **acquireDataAbilityHelper**, and **createDataShareHelper**.
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci**Key API/Component Changes**
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci - Involved application components
27e41f4b71Sopenharmony_ci   - Stage model
28e41f4b71Sopenharmony_ci     - Ability
29e41f4b71Sopenharmony_ci     - ServiceExtension
30e41f4b71Sopenharmony_ci     - DataShareExtension
31e41f4b71Sopenharmony_ci   - FA model
32e41f4b71Sopenharmony_ci     - PageAbility
33e41f4b71Sopenharmony_ci     - ServiceAbility
34e41f4b71Sopenharmony_ci     - DataAbility 
35e41f4b71Sopenharmony_ci - Involved APIs
36e41f4b71Sopenharmony_ci   - Stage model
37e41f4b71Sopenharmony_ci     - startAbility(want: Want, callback: AsyncCallback<void>): void;
38e41f4b71Sopenharmony_ci     - startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
39e41f4b71Sopenharmony_ci     - startAbility(want: Want, options?: StartOptions): Promise<void>;
40e41f4b71Sopenharmony_ci     - startAbilityByCall(want: Want): Promise<Caller>;
41e41f4b71Sopenharmony_ci     - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
42e41f4b71Sopenharmony_ci     - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
43e41f4b71Sopenharmony_ci     - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>;
44e41f4b71Sopenharmony_ci     - startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
45e41f4b71Sopenharmony_ci     - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
46e41f4b71Sopenharmony_ci     - startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
47e41f4b71Sopenharmony_ci     - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback<AbilityResult>): void;
48e41f4b71Sopenharmony_ci     - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback<void>): void;
49e41f4b71Sopenharmony_ci     - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<AbilityResult>;
50e41f4b71Sopenharmony_ci     - startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
51e41f4b71Sopenharmony_ci     - startServiceExtensionAbility(want: Want): Promise<void>;
52e41f4b71Sopenharmony_ci     - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
53e41f4b71Sopenharmony_ci     - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
54e41f4b71Sopenharmony_ci     - stopServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
55e41f4b71Sopenharmony_ci     - stopServiceExtensionAbility(want: Want): Promise<void>;
56e41f4b71Sopenharmony_ci     - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void;
57e41f4b71Sopenharmony_ci     - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise<void>;
58e41f4b71Sopenharmony_ci     - connectAbility(want: Want, options: ConnectOptions): number;
59e41f4b71Sopenharmony_ci     - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
60e41f4b71Sopenharmony_ci     - createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void
61e41f4b71Sopenharmony_ci   - FA model
62e41f4b71Sopenharmony_ci     - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
63e41f4b71Sopenharmony_ci     - startAbility(parameter: StartAbilityParameter): Promise<number>;
64e41f4b71Sopenharmony_ci     - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
65e41f4b71Sopenharmony_ci     - startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
66e41f4b71Sopenharmony_ci     - acquireDataAbilityHelper(uri: string): DataAbilityHelper;
67e41f4b71Sopenharmony_ci     - connectAbility(request: Want, options:ConnectOptions ): number;
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci**Adaptation Guide**
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ciStartup rules for different scenarios are as follows:
72e41f4b71Sopenharmony_ci - **Start application components when the application is in the background.**
73e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
74e41f4b71Sopenharmony_ci     
75e41f4b71Sopenharmony_ci      - Starting application components when the application is in the background is not restricted.
76e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
77e41f4b71Sopenharmony_ci     - When the application is in the background, starting application components requires authentication. The following permission needs to be applied for:
78e41f4b71Sopenharmony_ci        ```json
79e41f4b71Sopenharmony_ci        {
80e41f4b71Sopenharmony_ci            "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
81e41f4b71Sopenharmony_ci            "grantMode": "system_grant",
82e41f4b71Sopenharmony_ci            "availableLevel": "system_basic",  
83e41f4b71Sopenharmony_ci            "provisionEnable": true,
84e41f4b71Sopenharmony_ci            "distributedSceneEnable": false
85e41f4b71Sopenharmony_ci        }
86e41f4b71Sopenharmony_ci        ```
87e41f4b71Sopenharmony_ci          > **NOTE**  
88e41f4b71Sopenharmony_ci          >
89e41f4b71Sopenharmony_ci          > 1. Starting components of the same application is also restricted by this rule. 
90e41f4b71Sopenharmony_ci          > 2. For SDKs of API version 8 or earlier, starting **serviceAbility** and **dataAbility** is not restricted by this rule.
91e41f4b71Sopenharmony_ci   
92e41f4b71Sopenharmony_ci - **Start invisible application components across applications.**
93e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
94e41f4b71Sopenharmony_ci     
95e41f4b71Sopenharmony_ci     - For applications whose APL is normal, invisible application components cannot be started across applications.
96e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
97e41f4b71Sopenharmony_ci     - For all applications, starting invisible application components across applications requires authentication. The following permission needs to be applied for:
98e41f4b71Sopenharmony_ci       ```json
99e41f4b71Sopenharmony_ci        {
100e41f4b71Sopenharmony_ci            "name": "ohos.permission.START_INVISIBLE_ABILITY",
101e41f4b71Sopenharmony_ci            "grantMode": "system_grant",
102e41f4b71Sopenharmony_ci            "availableLevel": "system_core",
103e41f4b71Sopenharmony_ci            "provisionEnable": true,
104e41f4b71Sopenharmony_ci            "distributedSceneEnable": false
105e41f4b71Sopenharmony_ci        }
106e41f4b71Sopenharmony_ci       ```
107e41f4b71Sopenharmony_ci   
108e41f4b71Sopenharmony_ci - **Start serviceAbility and dataAbility of the FA model across applications.**
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
111e41f4b71Sopenharmony_ci     - Starting **serviceAbility** and **dataAbility** across applications is not restricted.
112e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
113e41f4b71Sopenharmony_ci     - Associated startup needs to be configured for the provider of **serviceAbility** and **dataAbility**. Otherwise, **serviceAbility** and **dataAbility** cannot be started across applications. (Associated startup cannot be configured for common applications.)
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci - **Use the startAbilityByCall API.**
117e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
118e41f4b71Sopenharmony_ci     
119e41f4b71Sopenharmony_ci     - The API call is not restricted.
120e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
121e41f4b71Sopenharmony_ci     
122e41f4b71Sopenharmony_ci     - The **startAbilityByCall** API cannot be called by the same application.
123e41f4b71Sopenharmony_ci   - Calling the **startAbilityByCall** API across applications requires authentication. The following permission needs to be applied for:
124e41f4b71Sopenharmony_ci   
125e41f4b71Sopenharmony_ci        ```json
126e41f4b71Sopenharmony_ci        {
127e41f4b71Sopenharmony_ci            "name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
128e41f4b71Sopenharmony_ci            "grantMode": "system_grant",
129e41f4b71Sopenharmony_ci            "availableLevel": "system_basic",
130e41f4b71Sopenharmony_ci            "provisionEnable": true,
131e41f4b71Sopenharmony_ci            "distributedSceneEnable": false
132e41f4b71Sopenharmony_ci        }
133e41f4b71Sopenharmony_ci        ```
134e41f4b71Sopenharmony_ci        > **NOTE**
135e41f4b71Sopenharmony_ci        >
136e41f4b71Sopenharmony_ci        > Using the **startAbilityByCall** API is also restricted by the background startup and across-application invisible component startup rules.
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci## cl.ability.2 Cross-Device Application Component Startup Rule Change (for System Applications Only)
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciThe rules for starting cross-device application components of the ability subsystem are changed in the following scenarios:
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci - Start application components when the application is in the background.
143e41f4b71Sopenharmony_ci - Start invisible application components across applications.
144e41f4b71Sopenharmony_ci - Start **serviceAbility** of the FA model across applications.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciYou need to adapt your application based on the following information.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci**Change Impacts**
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ciIf new rules are not adapted, application components cannot be started in the previous scenarios.
152e41f4b71Sopenharmony_ci>**NOTE**
153e41f4b71Sopenharmony_ci>
154e41f4b71Sopenharmony_ci>Starting application components refers to any behavior starting or connecting to an ability.
155e41f4b71Sopenharmony_ci>
156e41f4b71Sopenharmony_ci>1. Start an ability using APIs such as **startAbility**, **startAbilityForResult**, and **startAbilityByCall**.
157e41f4b71Sopenharmony_ci>2. Connect to an ability using APIs such as **connectAbility**.
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci**Key API/Component Changes**
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci - Involved application components
162e41f4b71Sopenharmony_ci   - Stage model
163e41f4b71Sopenharmony_ci     - Ability
164e41f4b71Sopenharmony_ci     - ServiceExtension
165e41f4b71Sopenharmony_ci   - FA model
166e41f4b71Sopenharmony_ci     - PageAbility
167e41f4b71Sopenharmony_ci     - ServiceAbility
168e41f4b71Sopenharmony_ci - Involved APIs
169e41f4b71Sopenharmony_ci   - Stage model
170e41f4b71Sopenharmony_ci     - startAbility(want: Want, callback: AsyncCallback<void>): void;
171e41f4b71Sopenharmony_ci     - startAbilityByCall(want: Want): Promise<Caller>;
172e41f4b71Sopenharmony_ci     - startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
173e41f4b71Sopenharmony_ci     - connectAbility(want: Want, options: ConnectOptions): number;
174e41f4b71Sopenharmony_ci   - FA model
175e41f4b71Sopenharmony_ci     - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
176e41f4b71Sopenharmony_ci     - startAbility(parameter: StartAbilityParameter): Promise<number>;
177e41f4b71Sopenharmony_ci     - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
178e41f4b71Sopenharmony_ci     - startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
179e41f4b71Sopenharmony_ci     - connectAbility(request: Want, options:ConnectOptions ): number;
180e41f4b71Sopenharmony_ci
181e41f4b71Sopenharmony_ci**Adaptation Guide**
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ciStartup rules for different scenarios are as follows:
184e41f4b71Sopenharmony_ci - **Start application components when the application is in the background.**
185e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
186e41f4b71Sopenharmony_ci     
187e41f4b71Sopenharmony_ci      - Starting application components when the application is in the background is not restricted.
188e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
189e41f4b71Sopenharmony_ci     - When the application is in the background, starting application components requires authentication. The following permission needs to be applied for:
190e41f4b71Sopenharmony_ci        ```json
191e41f4b71Sopenharmony_ci        {
192e41f4b71Sopenharmony_ci            "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
193e41f4b71Sopenharmony_ci            "grantMode": "system_grant",
194e41f4b71Sopenharmony_ci            "availableLevel": "system_basic",  
195e41f4b71Sopenharmony_ci            "provisionEnable": true,
196e41f4b71Sopenharmony_ci            "distributedSceneEnable": false
197e41f4b71Sopenharmony_ci        }
198e41f4b71Sopenharmony_ci        ```
199e41f4b71Sopenharmony_ci          > **NOTE** 
200e41f4b71Sopenharmony_ci          >
201e41f4b71Sopenharmony_ci          > 1. Starting components of the same application is also restricted by this rule. 
202e41f4b71Sopenharmony_ci          > 2. For SDKs of API version 8 or earlier, starting **serviceAbility** is not restricted by this rule.
203e41f4b71Sopenharmony_ci   
204e41f4b71Sopenharmony_ci - **Start invisible application components across applications.**
205e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
206e41f4b71Sopenharmony_ci     
207e41f4b71Sopenharmony_ci     - Invisible application components cannot be started across applications.
208e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
209e41f4b71Sopenharmony_ci     - Starting invisible application components across applications requires authentication. The following permission needs to be applied for:
210e41f4b71Sopenharmony_ci       ```json
211e41f4b71Sopenharmony_ci        {
212e41f4b71Sopenharmony_ci            "name": "ohos.permission.START_INVISIBLE_ABILITY",
213e41f4b71Sopenharmony_ci            "grantMode": "system_grant",
214e41f4b71Sopenharmony_ci            "availableLevel": "system_core",
215e41f4b71Sopenharmony_ci            "provisionEnable": true,
216e41f4b71Sopenharmony_ci            "distributedSceneEnable": false
217e41f4b71Sopenharmony_ci        }
218e41f4b71Sopenharmony_ci       ```
219e41f4b71Sopenharmony_ci   
220e41f4b71Sopenharmony_ci - **Start serviceAbility of the FA model across applications.**
221e41f4b71Sopenharmony_ci
222e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta3 rules:
223e41f4b71Sopenharmony_ci     
224e41f4b71Sopenharmony_ci     - Starting **serviceAbility** across applications is not restricted.
225e41f4b71Sopenharmony_ci   - OpenHarmony 3.2 Beta4 rules:
226e41f4b71Sopenharmony_ci     - Associated startup needs to be configured for the **serviceAbility** provider application. Otherwise, **serviceAbility** cannot be started across applications. (Associated startup cannot be configured for common applications.)
227e41f4b71Sopenharmony_ci     - Configure associated startup as follows:
228e41f4b71Sopenharmony_ci       ```json
229e41f4b71Sopenharmony_ci        {
230e41f4b71Sopenharmony_ci            "bundleName": "",
231e41f4b71Sopenharmony_ci            "app_signature": ["xxxxxxxxxxxxxxxxxxx"],
232e41f4b71Sopenharmony_ci            "associatedWakeUp": true
233e41f4b71Sopenharmony_ci        }
234e41f4b71Sopenharmony_ci       ```
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ci## cl.ability.3 API Exception Handling Method Change
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ciCertain APIs of the ability subsystem use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony.
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_ci**Change Impacts**
241e41f4b71Sopenharmony_ci
242e41f4b71Sopenharmony_ciThe application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected.
243e41f4b71Sopenharmony_ci
244e41f4b71Sopenharmony_ci**Key API/Component Changes**
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ciFor adaptation to the unified API exception handling mode, certain ability subsystem APIs are deprecated (original APIs in the following table) and corresponding new APIs in the following table are added. (In the following table, original APIs in API version 9 will be deleted, and APIs in API version 8 and earlier will be deprecated.) The newly added APIs support unified error code handling specifications and function the same as the original APIs.
247e41f4b71Sopenharmony_ci
248e41f4b71Sopenharmony_ci| Original API                                         | New API                                         |
249e41f4b71Sopenharmony_ci| ----------------------------------------------- | ----------------------------------------------- |
250e41f4b71Sopenharmony_ci| @ohos.ability.wantConstant.d.ts                 | @ohos.app.ability.wantConstant.d.ts             |
251e41f4b71Sopenharmony_ci| @ohos.application.Ability.d.ts                  | @ohos.app.ability.UIAbility.d.ts                |
252e41f4b71Sopenharmony_ci| @ohos.application.AbilityConstant.d.ts          | @ohos.app.ability.AbilityConstant.d.ts          |
253e41f4b71Sopenharmony_ci| @ohos.application.abilityDelegatorRegistry.d.ts | @ohos.app.ability.abilityDelegatorRegistry.d.ts |
254e41f4b71Sopenharmony_ci| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
255e41f4b71Sopenharmony_ci| @ohos.application.abilityManager.d.ts           | @ohos.app.ability.abilityManager.d.ts           |
256e41f4b71Sopenharmony_ci| @ohos.application.AbilityStage.d.ts             | @ohos.app.ability.AbilityStage.d.ts             |
257e41f4b71Sopenharmony_ci| @ohos.application.appManager.d.ts               | @ohos.app.ability.appManager.d.ts               |
258e41f4b71Sopenharmony_ci| @ohos.application.Configuration.d.ts            | @ohos.app.ability.Configuration.d.ts            |
259e41f4b71Sopenharmony_ci| @ohos.application.ConfigurationConstant.d.ts    | @ohos.app.ability.ConfigurationConstant.d.ts    |
260e41f4b71Sopenharmony_ci| @ohos.application.context.d.ts                  | @ohos.app.ability.common.d.ts                   |
261e41f4b71Sopenharmony_ci| @ohos.application.EnvironmentCallback.d.ts      | @ohos.app.ability.EnvironmentCallback.d.ts      |
262e41f4b71Sopenharmony_ci| @ohos.application.errorManager.d.ts             | @ohos.app.ability.errorManager.d.ts             |
263e41f4b71Sopenharmony_ci| @ohos.application.ExtensionAbility.d.ts         | @ohos.app.ability.ExtensionAbility.d.ts         |
264e41f4b71Sopenharmony_ci| @ohos.application.formBindingData.d.ts          | @ohos.app.form.formBindingData.d.ts             |
265e41f4b71Sopenharmony_ci| @ohos.application.FormExtension.d.ts            | @ohos.app.form.FormExtensionAbility.d.ts        |
266e41f4b71Sopenharmony_ci| @ohos.application.formHost.d.ts                 | @ohos.app.form.formHost.d.ts                    |
267e41f4b71Sopenharmony_ci| @ohos.application.formInfo.d.ts                 | @ohos.app.form.formInfo.d.ts                    |
268e41f4b71Sopenharmony_ci| @ohos.application.formProvider.d.ts             | @ohos.app.form.formProvider.d.ts                |
269e41f4b71Sopenharmony_ci| @ohos.application.missionManager.d.ts           | @ohos.app.ability.missionManager.d.ts           |
270e41f4b71Sopenharmony_ci| @ohos.application.quickFixManager.d.ts          | @ohos.app.ability.quickFixManager.d.ts          |
271e41f4b71Sopenharmony_ci| @ohos.application.ServiceExtensionAbility.d.ts  | @ohos.app.ability.ServiceExtensionAbility.d.ts  |
272e41f4b71Sopenharmony_ci| @ohos.application.StartOptions.d.ts             | @ohos.app.ability.StartOptions.d.ts             |
273e41f4b71Sopenharmony_ci| @ohos.application.Want.d.ts                     | @ohos.app.ability.Want.d.ts                     |
274e41f4b71Sopenharmony_ci| @ohos.wantAgent.d.ts                            | @ohos.app.ability.wantAgent.d.ts                |
275e41f4b71Sopenharmony_ci
276e41f4b71Sopenharmony_ci**Adaptation Guide**
277e41f4b71Sopenharmony_ci
278e41f4b71Sopenharmony_ciThe original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem.
279e41f4b71Sopenharmony_ci
280e41f4b71Sopenharmony_ciIf the original API uses **@ohos.application.missionManager**:
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci```js
283e41f4b71Sopenharmony_ciimport missionManager from '@ohos.application.missionManager';
284e41f4b71Sopenharmony_ci```
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ciYou can directly modify **import** to switch to the new namespace:
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci```js
289e41f4b71Sopenharmony_ciimport missionManager from '@ohos.app.ability.missionManager';
290e41f4b71Sopenharmony_ci```
291e41f4b71Sopenharmony_ci
292e41f4b71Sopenharmony_ciIn addition, exception handling is needed. For details, see the API reference for the new APIs.
293e41f4b71Sopenharmony_ci
294e41f4b71Sopenharmony_ci## cl.ability.4 API Change
295e41f4b71Sopenharmony_ci
296e41f4b71Sopenharmony_ciThe names of some ability subsystem APIs are changed.
297e41f4b71Sopenharmony_ci
298e41f4b71Sopenharmony_ci**Key API/Component Changes**
299e41f4b71Sopenharmony_ci
300e41f4b71Sopenharmony_ci| Module                                   | Class                   | Method/Attribute/Enumeration/Constant                                         | Change Type|
301e41f4b71Sopenharmony_ci| ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------- |
302e41f4b71Sopenharmony_ci| @ohos.application.Ability                 | Caller                  | onRelease(callback: OnReleaseCallBack): **void**;            | Deprecated    |
303e41f4b71Sopenharmony_ci| @ohos.app.ability.UIAbility               | Caller                  | on(**type**: "release", callback: OnReleaseCallBack): **void**; | Added    |
304e41f4b71Sopenharmony_ci| @ohos.application.Ability                 | Ability                 | dump(params: Array<**string**>): Array<**string**>;          | Deprecated    |
305e41f4b71Sopenharmony_ci| @ohos.app.ability.UIAbility               | UIAbility               | onDump(params: Array<**string**>): Array<**string**>;        | Added    |
306e41f4b71Sopenharmony_ci| @ohos.application.appManager              | appManager              | **function** registerApplicationStateObserver(observer: ApplicationStateObserver): **number**; | Deprecated    |
307e41f4b71Sopenharmony_ci| @ohos.application.appManager              | appManager              | **function** registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | Deprecated    |
308e41f4b71Sopenharmony_ci| @ohos.application.appManager              | appManager              | **function** unregisterApplicationStateObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
309e41f4b71Sopenharmony_ci| @ohos.application.appManager              | appManager              | **function** unregisterApplicationStateObserver(observerId: **number**): Promise<**void**>; | Deprecated    |
310e41f4b71Sopenharmony_ci| @ohos.app.ability.appManager              | appManager              | **function** on(**type**: "applicationState", observer: ApplicationStateObserver): **number**; | Added    |
311e41f4b71Sopenharmony_ci| @ohos.app.ability.appManager              | appManager              | **function** on(**type**: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | Added    |
312e41f4b71Sopenharmony_ci| @ohos.app.ability.appManager              | appManager              | **function** off(**type**: "applicationState", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
313e41f4b71Sopenharmony_ci| @ohos.app.ability.appManager              | appManager              | **function** off(**type**: "applicationState", observerId: **number**): Promise<**void**>; | Added    |
314e41f4b71Sopenharmony_ci| @ohos.application.errorManager            | errorManager            | **function** registerErrorObserver(observer: ErrorObserver): **number**; | Deprecated    |
315e41f4b71Sopenharmony_ci| @ohos.application.errorManager            | errorManager            | **function** unregisterErrorObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
316e41f4b71Sopenharmony_ci| @ohos.application.errorManager            | errorManager            | **function** unregisterErrorObserver(observerId: **number**): Promise<**void**>; | Deprecated    |
317e41f4b71Sopenharmony_ci| @ohos.app.ability.errorManager            | errorManager            | **function** on(**type**: "error", observer: ErrorObserver): **number**; | Added    |
318e41f4b71Sopenharmony_ci| @ohos.app.ability.errorManager            | errorManager            | **function** off(**type**: "error", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
319e41f4b71Sopenharmony_ci| @ohos.app.ability.errorManager            | errorManager            | **function** off(**type**: "error", observerId: **number**): Promise<**void**>; | Added    |
320e41f4b71Sopenharmony_ci| @ohos.application.missionManager          | missionManager          | **function** registerMissionListener(listener: MissionListener): **number**; | Deprecated    |
321e41f4b71Sopenharmony_ci| @ohos.application.missionManager          | missionManager          | **function** unregisterMissionListener(listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
322e41f4b71Sopenharmony_ci| @ohos.application.missionManager          | missionManager          | **function** unregisterMissionListener(listenerId: **number**): Promise<**void**>; | Deprecated    |
323e41f4b71Sopenharmony_ci| @ohos.app.ability.missionManager          | missionManager          | **function** on(**type**: "mission", listener: MissionListener): **number**; | Added    |
324e41f4b71Sopenharmony_ci| @ohos.app.ability.missionManager          | missionManager          | **function** off(**type**: "mission", listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
325e41f4b71Sopenharmony_ci| @ohos.app.ability.missionManager          | missionManager          | **function** off(**type**: "mission", listenerId: **number**): Promise<**void**>; | Added    |
326e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onCreate(want: Want): formBindingData.FormBindingData;       | Deprecated    |
327e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onCastToNormal(formId: **string**): **void**;                | Deprecated    |
328e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onUpdate(formId: **string**): **void**;                      | Deprecated    |
329e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onVisibilityChange(newStatus: { [key: **string**]: **number** }): **void**; | Deprecated    |
330e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onEvent(formId: **string**, message: **string**): **void**;  | Deprecated    |
331e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onDestroy(formId: **string**): **void**;                     | Deprecated    |
332e41f4b71Sopenharmony_ci| @ohos.application.FormExtension           | FormExtension           | onShare?(formId: **string**): {[key: **string**]: **any**};  | Deprecated    |
333e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onAddForm(want: Want): formBindingData.FormBindingData;      | Added    |
334e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onCastToNormalForm(formId: **string**): **void**;            | Added    |
335e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onUpdateForm(formId: **string**): **void**;                  | Added    |
336e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onChangeFormVisibility(newStatus: { [key: **string**]: **number** }): **void**; | Added    |
337e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onFormEvent(formId: **string**, message: **string**): **void**; | Added    |
338e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onRemoveForm(formId: **string**): **void**;                  | Added    |
339e41f4b71Sopenharmony_ci| @ohos.app.form.FormExtensionAbility       | FormExtensionAbility    | onShareForm?(formId: **string**): {[key: **string**]: **any**}; | Added    |
340e41f4b71Sopenharmony_ci| @ohos.application.formHost.d.ts           | formHost                | **function** castTempForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
341e41f4b71Sopenharmony_ci| @ohos.application.formHost.d.ts           | formHost                | **function** castTempForm(formId: **string**): Promise<**void**>; | Deprecated    |
342e41f4b71Sopenharmony_ci| @ohos.app.form.formHost.d.ts              | formHost                | **function** castToNormalForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | Added    |
343e41f4b71Sopenharmony_ci| @ohos.app.form.formHost.d.ts              | formHost                | **function** castToNormalForm(formId: **string**): Promise<**void**>; | Added    |
344e41f4b71Sopenharmony_ci| @ohos.application.ServiceExtensionAbility | ServiceExtensionAbility | dump(params: Array<**string**>): Array<**string**>;          | Deprecated    |
345e41f4b71Sopenharmony_ci| @ohos.app.ability.ServiceExtensionAbility | ServiceExtensionAbility | onDump(params: Array<**string**>): Array<**string**>;        | Added    |
346e41f4b71Sopenharmony_ci| application/AbilityContext                | AbilityContext          | connectAbility(want: Want, options: ConnectOptions): **number**; | Deprecated    |
347e41f4b71Sopenharmony_ci| application/AbilityContext                | AbilityContext          | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Deprecated    |
348e41f4b71Sopenharmony_ci| application/AbilityContext                | AbilityContext          | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
349e41f4b71Sopenharmony_ci| application/AbilityContext                | AbilityContext          | disconnectAbility(connection: **number**): Promise<**void**>; | Deprecated    |
350e41f4b71Sopenharmony_ci| application/UIAbilityContext              | UIAbilityContext        | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added    |
351e41f4b71Sopenharmony_ci| application/UIAbilityContext              | UIAbilityContext        | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added    |
352e41f4b71Sopenharmony_ci| application/UIAbilityContext              | UIAbilityContext        | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
353e41f4b71Sopenharmony_ci| application/UIAbilityContext              | UIAbilityContext        | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | Added    |
354e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; | Deprecated    |
355e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
356e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | unregisterAbilityLifecycleCallback(callbackId: **number**): Promise<**void**>; | Deprecated    |
357e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | Deprecated    |
358e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
359e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | unregisterEnvironmentCallback(callbackId: **number**): Promise<**void**>; | Deprecated    |
360e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | on(**type**: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; | Added    |
361e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | off(**type**: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
362e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | off(**type**: "abilityLifecycle", callbackId: **number**): Promise<**void**>; | Added    |
363e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | on(**type**: "environment", callback: EnvironmentCallback): **number**; | Added    |
364e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | off(**type**: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
365e41f4b71Sopenharmony_ci| application/ApplicationContext            | ApplicationContext      | off(**type**: "environment", callbackId: **number**): Promise<**void**>; | Added    |
366e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | connectAbility(want: Want, options: ConnectOptions): **number**; | Deprecated    |
367e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Deprecated    |
368e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated    |
369e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | disconnectAbility(connection: **number**): Promise<**void**>; | Deprecated    |
370e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | connectServiceExtensionAbility(want: Want, options: ConnectOptions): **number**; | Added    |
371e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added    |
372e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Added    |
373e41f4b71Sopenharmony_ci| application/ServiceExtensionContext       | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | Added    |
374