1e41f4b71Sopenharmony_ci# Ability Framework Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.ability.1 API Migration
4e41f4b71Sopenharmony_ciThe **requestPermissionsFromUser** API of **UIAbilityContext** is migrated from the ability subsystem to the security subsystem.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciPreviously, the permission popup was implemented based on **UIAbility**, which used the **startAbilityForResult** API of **UIAbilityContext** to return the permission authorization result to the caller. Therefore, **requestPermissionsFromUser** was temporarily placed in **UIAbilityContext**. The permission popup is now implemented based on **ServiceExtensionAbility**, which no longer requires **startAbilityForResult** of **UIAbilityContext**. Therefore, **requestPermissionsFromUser** is migrated to the security subsystem.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciYou need to adapt your application based on the following information.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci **Change Impact**
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciJS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Key API/Component Changes**
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
17e41f4b71Sopenharmony_ci| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
18e41f4b71Sopenharmony_ci| application/UIAbilityContext        | UIAbilityContext        | requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>): void; | Deleted    |
19e41f4b71Sopenharmony_ci| application/UIAbilityContext        | UIAbilityContext        | requestPermissionsFromUser(permissions: Array<string>): Promise<PermissionRequestResult>; | Deleted    |
20e41f4b71Sopenharmony_ci| @ohos.abilityAccessCtrl        | AtManager         | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; | Added    |
21e41f4b71Sopenharmony_ci| @ohos.abilityAccessCtrl        | AtManager         | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; | Added    |
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci**Adaptation Guide**
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ciThe following illustrates how **requestPermissionsFromUser** is called to show a permission popup.
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciStage model:
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci```ts
31e41f4b71Sopenharmony_ciimport abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
32e41f4b71Sopenharmony_ci// onWindowStageCreate lifecycle of UIAbility.
33e41f4b71Sopenharmony_cionWindowStageCreate() {
34e41f4b71Sopenharmony_ci    let AtManager = abilityAccessCtrl.createAtManager();
35e41f4b71Sopenharmony_ci    // requestPermissionsFromUser determines whether to display a popup based on the permission authorization status.
36e41f4b71Sopenharmony_ci    AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => {
37e41f4b71Sopenharmony_ci        console.log("data type:" + typeof(data));
38e41f4b71Sopenharmony_ci        console.log("data:" + data);
39e41f4b71Sopenharmony_ci        console.log("data permissions:" + data.permissions);
40e41f4b71Sopenharmony_ci        console.log("data result:" + data.authResults);
41e41f4b71Sopenharmony_ci    }).catch((err) => {
42e41f4b71Sopenharmony_ci        console.error('Failed to start ability', err.code);
43e41f4b71Sopenharmony_ci    })
44e41f4b71Sopenharmony_ci}
45e41f4b71Sopenharmony_ci```
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci## cl.ability.2 Deletion of Deprecated APIs in API Version 9
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciIn the **Ability Exception Rectification** document, some APIs in API version 9 have been marked as deprecated. According to API specifications of OpenHarmony, these APIs should be deleted.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Change Impact**
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ciThe application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci**Key API/Component Changes**
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ciAPI files are deleted.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci| Deleted API                                     | New API                                         |
62e41f4b71Sopenharmony_ci| ----------------------------------------------- | ----------------------------------------------- |
63e41f4b71Sopenharmony_ci| @ohos.application.Ability.d.ts                  | @ohos.app.ability.UIAbility.d.ts                |
64e41f4b71Sopenharmony_ci| @ohos.application.AbilityConstant.d.ts          | @ohos.app.ability.AbilityConstant.d.ts          |
65e41f4b71Sopenharmony_ci| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
66e41f4b71Sopenharmony_ci| @ohos.application.AbilityStage.d.ts             | @ohos.app.ability.AbilityStage.d.ts             |
67e41f4b71Sopenharmony_ci| @ohos.application.EnvironmentCallback.d.ts      | @ohos.app.ability.EnvironmentCallback.d.ts      |
68e41f4b71Sopenharmony_ci| @ohos.application.ExtensionAbility.d.ts         | @ohos.app.ability.ExtensionAbility.d.ts         |
69e41f4b71Sopenharmony_ci| @ohos.application.FormExtension.d.ts            | @ohos.app.form.FormExtensionAbility.d.ts        |
70e41f4b71Sopenharmony_ci| @ohos.application.ServiceExtensionAbility.d.ts  | @ohos.app.ability.ServiceExtensionAbility.d.ts  |
71e41f4b71Sopenharmony_ci| @ohos.application.StartOptions.d.ts             | @ohos.app.ability.StartOptions.d.ts             |
72e41f4b71Sopenharmony_ci| @ohos.application.context.d.ts                  | @ohos.app.ability.common.d.ts                   |
73e41f4b71Sopenharmony_ci| @ohos.application.errorManager.d.ts             | @ohos.app.ability.errorManager.d.ts             |
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciAPIs or attributes are deleted:
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci- @ohos.application.Configuration.d.ts
78e41f4b71Sopenharmony_ci  - **direction**, **screenDensity**, **displayId**, and **hasPointerDevice** of **Configuration** are deleted. Use **Configuration** of **@ohos.app.ability.Configuration.d.ts**.
79e41f4b71Sopenharmony_ci- @ohos.application.ConfigurationConstant.d.ts
80e41f4b71Sopenharmony_ci  - **Direction** and **ScreenDensity** are deleted. Use **Direction** and **ScreenDensity** of **@ohos.app.ability.ConfigurationConstant.d.ts**.
81e41f4b71Sopenharmony_ci- @ohos.application.abilityManager.d.ts
82e41f4b71Sopenharmony_ci  - **getExtensionRunningInfos** and **getTopAbility** are deleted. Use the APIs with the same name in **@ohos.app.ability.abilityManager.d.ts**.
83e41f4b71Sopenharmony_ci- @ohos.application.appManager.d.ts
84e41f4b71Sopenharmony_ci  - **ApplicationState** and **ProcessState** are deleted. Use **ApplicationState** and **ProcessState** of **@ohos.app.ability.appManager.d.ts**.
85e41f4b71Sopenharmony_ci  - **registerApplicationStateObserver** and **getProcessRunningInformation** are deleted. Use the APIs with the same name in **@ohos.app.ability.appManager.d.ts**.
86e41f4b71Sopenharmony_ci- @ohos.application.formHost.d.ts
87e41f4b71Sopenharmony_ci  - **shareForm** and **notifyFormsPrivacyProtected** are deleted. Use the APIs with the same name in **@ohos.app.form.formHost.d.ts**.
88e41f4b71Sopenharmony_ci- @ohos.application.formInfo.d.ts
89e41f4b71Sopenharmony_ci  - **eTS** of **FormType** is deleted. Use **eTS** of **FormType** in **@ohos.app.form.formInfo.d.ts**.
90e41f4b71Sopenharmony_ci  - **IDENTITY_KEY**, **BUNDLE_NAME_KEY**, **ABILITY_NAME_KEY**, and **DEVICE_ID_KEY** of **FormParam** are deleted. Use the enums with the same name in **@ohos.app.form.formInfo.d.ts**.
91e41f4b71Sopenharmony_ci  - **FormInfoFilter** is deleted. Use **FormInfoFilter** of **@ohos.app.form.formInfo.d.ts**.
92e41f4b71Sopenharmony_ci  - **FormDimension** is deleted. Use **FormDimension** of **@ohos.app.form.formInfo.d.ts**.
93e41f4b71Sopenharmony_ci  - **VisibilityType** is deleted. Use **VisibilityType** of **@ohos.app.form.formInfo.d.ts**.
94e41f4b71Sopenharmony_ci- @ohos.wantAgent.d.ts
95e41f4b71Sopenharmony_ci  - **trigger** and **getOperationType** are deleted. Use the APIs with the same name in **@ohos.app.ability.wantAgent.d.ts**.
96e41f4b71Sopenharmony_ci- application/ApplicationContext.d.ts
97e41f4b71Sopenharmony_ci  - **registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback** are deleted. Use **on** and **off**.
98e41f4b71Sopenharmony_ci- application/ServiceExtensionContext.d.ts
99e41f4b71Sopenharmony_ci  - **connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility** are deleted. Use **connectServiceExtensionAbility**, **connectServiceExtensionAbilityWithAccount**, and **disconnectServiceExtensionAbility**.
100e41f4b71Sopenharmony_ci- @ohos.application.FormExtension.d.ts
101e41f4b71Sopenharmony_ci  - **onCreate**, **onCastToNormal**, **onUpdate**, **onVisibilityChange**, **onEvent**, **onDestroy**, **onAcquireFormState**, and **onShare** are deleted. Use the following lifecycle methods of **@ohos.app.form.FormExtensionAbility.d.ts**: **onAddForm**, **onCastToNormalForm**, **onUpdateForm**, **onChangeFormVisibility**, **onFormEvent**, **onRemoveForm**, **onAcquireFormState**, and **onShareForm**.
102e41f4b71Sopenharmony_ci- @ohos.application.abilityDelegatorRegistry.d.ts
103e41f4b71Sopenharmony_ci  - **AbilityDelegator**, **AbilityDelegatorArgs**, **AbilityMonitor**, and **ShellCmdResult** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityDelegatorRegistry.d.ts**.
104e41f4b71Sopenharmony_ci- @ohos.application.abilityManager.d.ts
105e41f4b71Sopenharmony_ci  - **AbilityRunningInfo** and **ExtensionRunningInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityManager.d.ts**.
106e41f4b71Sopenharmony_ci- @ohos.application.appManager.d.ts
107e41f4b71Sopenharmony_ci  - **AbilityStateData**, **AppStateData**, **ApplicationStateObserver**, **ProcessRunningInfo**, and **ProcessRunningInformation** are deleted. Use the classes with the same name in **@ohos.app.ability.appManager.d.ts**.
108e41f4b71Sopenharmony_ci- @ohos.application.missionManager.d.ts
109e41f4b71Sopenharmony_ci  - **MissionInfo**, **MissionListener**, and **MissionSnapshot** are deleted. Use the classes with the same name in **@ohos.app.ability.missionManager.d.ts**.
110e41f4b71Sopenharmony_ci- @ohos.wantAgent.d.ts
111e41f4b71Sopenharmony_ci  - **TriggerInfo** and **WantAgentInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.wantAgent.d.ts**.
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**Adaptation Guide**
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciAs mentioned above, only several APIs have their names changed in terms of, for example, the registration callbacks (**registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback**) and connection and disconnection **ServiceExtensionAbility** (**connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility**). For such APIs, replace their names with those of their corresponding new APIs in the lifecycle callbacks.
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ciMost APIs are moved to the new namespace. Therefore, you can modify **import** for adaptation.
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ciFor example, the original API uses **@ohos.application.Ability**:
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci```js
122e41f4b71Sopenharmony_ciimport Ability from '@ohos.application.Ability';
123e41f4b71Sopenharmony_ci```
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ciYou can directly modify **import** to switch to the new namespace:
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci```js
128e41f4b71Sopenharmony_ciimport Ability from '@ohos.app.ability.UIAbility';
129e41f4b71Sopenharmony_ci```
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ciIn addition, exception handling is needed. For details, see the API reference for the new APIs.
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci## cl.ability.3 RestartFlag Attribute Names Changed and Unsupported Attribute Deleted in appRecovery
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ciIn the **appRecovery** API, the enum names of **RestartFlag** are changed from **NO_RESTART** upon a specific fault to **RESTART** upon a specific fault. 
136e41f4b71Sopenharmony_ciThe **CPP_CRASH_NO_RESTART** enum is deleted.
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci**Change Impact**
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciIf your application uses the **CPP_CRASH_NO_RESTART**, **JS_CRASH_NO_RESTART**, or **APP_FREEZE_NO_RESTART** attribute in versions earlier than 3.2.10.6, its behavior will change after an upgrade to 3.2.10.6.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci**Key API/Component Changes**
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci**RestartFlag** <sup>9+</sup>
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciBefore change
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci| Name                 | Value    | Description                            |
149e41f4b71Sopenharmony_ci| --------------------- | ------ | -------------------------------- |
150e41f4b71Sopenharmony_ci| ALWAYS_RESTART        | 0      | The application is restarted in all cases.                  |
151e41f4b71Sopenharmony_ci| CPP_CRASH_NO_RESTART  | 0x0001 | The application is **not restarted** in the case of CPP_CRASH. |
152e41f4b71Sopenharmony_ci| JS_CRASH_NO_RESTART   | 0x0002 | The application is **not restarted** in the case of JS_CRASH.  |
153e41f4b71Sopenharmony_ci| APP_FREEZE_NO_RESTART | 0x0004 | The application is **not restarted** in the case of APP_FREEZE.|
154e41f4b71Sopenharmony_ci| NO_RESTART            | 0xFFFF | The application is not restarted in any case.                |
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ciAfter change
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci| Name                   | Value    | Description                          |
159e41f4b71Sopenharmony_ci| ----------------------- | ------ | ------------------------------ |
160e41f4b71Sopenharmony_ci| ALWAYS_RESTART          | 0      | The application is restarted in all cases.                |
161e41f4b71Sopenharmony_ci| CPP_CRASH_NO_RESTART    | NA     | **Deleted.** The restart in this scenario is not supported.|
162e41f4b71Sopenharmony_ci| RESTART_WHEN_JS_CRASH   | 0x0001 | The application is **restarted** in the case of JS_CRASH.  |
163e41f4b71Sopenharmony_ci| RESTART_WHEN_APP_FREEZE | 0x0002 | The application is **restarted** in the case of APP_FREEZE.|
164e41f4b71Sopenharmony_ci| NO_RESTART              | 0xFFFF | The application is not restarted in any case.              |
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Adaptation Guide**
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ciPerform adaptation based on the new semantics.
169