1e41f4b71Sopenharmony_ci# Ability Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciCompared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(MR) has the following API changes in the ability subsystem:
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci## cl.ability.1 API Migration
6e41f4b71Sopenharmony_ciThe **requestPermissionsFromUser** API of **UIAbilityContext** is migrated from the ability subsystem to the security subsystem.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_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.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ciYou need to adapt your application.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**Change Impact**
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_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.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**Key API/Component Changes**
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
19e41f4b71Sopenharmony_ci| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
20e41f4b71Sopenharmony_ci| application/UIAbilityContext        | UIAbilityContext        | requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>): void; | Deleted    |
21e41f4b71Sopenharmony_ci| application/UIAbilityContext        | UIAbilityContext        | requestPermissionsFromUser(permissions: Array<string>): Promise<PermissionRequestResult>; | Deleted    |
22e41f4b71Sopenharmony_ci| @ohos.abilityAccessCtrl        | AtManager         | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; | Added    |
23e41f4b71Sopenharmony_ci| @ohos.abilityAccessCtrl        | AtManager         | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; | Added    |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci**Adaptation Guide**
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciThe following illustrates how **requestPermissionsFromUser** is called to show a permission popup.
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ciStage model:
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci```ts
33e41f4b71Sopenharmony_ciimport abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
34e41f4b71Sopenharmony_ci// onWindowStageCreate lifecycle of UIAbility.
35e41f4b71Sopenharmony_cionWindowStageCreate() {
36e41f4b71Sopenharmony_ci    let AtManager = abilityAccessCtrl.createAtManager();
37e41f4b71Sopenharmony_ci    // requestPermissionsFromUser determines whether to display a popup based on the permission authorization status.
38e41f4b71Sopenharmony_ci    AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => {
39e41f4b71Sopenharmony_ci        console.log("data type:" + typeof(data));
40e41f4b71Sopenharmony_ci        console.log("data:" + data);
41e41f4b71Sopenharmony_ci        console.log("data permissions:" + data.permissions);
42e41f4b71Sopenharmony_ci        console.log("data result:" + data.authResults);
43e41f4b71Sopenharmony_ci    }).catch((err) => {
44e41f4b71Sopenharmony_ci        console.error('Failed to start ability', err.code);
45e41f4b71Sopenharmony_ci    })
46e41f4b71Sopenharmony_ci}
47e41f4b71Sopenharmony_ci```
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci## cl.ability.2 Deletion of Deprecated APIs in API Version 9
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciIn the [Ability Exception Rectification](../OpenHarmony_3.2.8.3/changelogs-ability.md) document, some APIs in API version 9 have been marked as deprecated. According to API specifications of OpenHarmony, these APIs should be deleted.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci**Change Impact**
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ciThe application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**Key API/Component Changes**
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ciAPI files are deleted.
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci| Deleted API                                     | New API                                         |
64e41f4b71Sopenharmony_ci| ----------------------------------------------- | ----------------------------------------------- |
65e41f4b71Sopenharmony_ci| @ohos.application.Ability.d.ts                  | @ohos.app.ability.UIAbility.d.ts                |
66e41f4b71Sopenharmony_ci| @ohos.application.AbilityConstant.d.ts          | @ohos.app.ability.AbilityConstant.d.ts          |
67e41f4b71Sopenharmony_ci| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
68e41f4b71Sopenharmony_ci| @ohos.application.AbilityStage.d.ts             | @ohos.app.ability.AbilityStage.d.ts             |
69e41f4b71Sopenharmony_ci| @ohos.application.EnvironmentCallback.d.ts      | @ohos.app.ability.EnvironmentCallback.d.ts      |
70e41f4b71Sopenharmony_ci| @ohos.application.ExtensionAbility.d.ts         | @ohos.app.ability.ExtensionAbility.d.ts         |
71e41f4b71Sopenharmony_ci| @ohos.application.FormExtension.d.ts            | @ohos.app.form.FormExtensionAbility.d.ts        |
72e41f4b71Sopenharmony_ci| @ohos.application.ServiceExtensionAbility.d.ts  | @ohos.app.ability.ServiceExtensionAbility.d.ts  |
73e41f4b71Sopenharmony_ci| @ohos.application.StartOptions.d.ts             | @ohos.app.ability.StartOptions.d.ts             |
74e41f4b71Sopenharmony_ci| @ohos.application.context.d.ts                  | @ohos.app.ability.common.d.ts                   |
75e41f4b71Sopenharmony_ci| @ohos.application.errorManager.d.ts             | @ohos.app.ability.errorManager.d.ts             |
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ciAPIs or attributes are deleted:
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci- @ohos.application.Configuration.d.ts
80e41f4b71Sopenharmony_ci  - **direction**, **screenDensity**, **displayId**, and **hasPointerDevice** of **Configuration** are deleted. Use **Configuration** of **@ohos.app.ability.Configuration.d.ts**.
81e41f4b71Sopenharmony_ci- @ohos.application.ConfigurationConstant.d.ts
82e41f4b71Sopenharmony_ci  - **Direction** and **ScreenDensity** are deleted. Use **Direction** and **ScreenDensity** of **@ohos.app.ability.ConfigurationConstant.d.ts**.
83e41f4b71Sopenharmony_ci- @ohos.application.abilityManager.d.ts
84e41f4b71Sopenharmony_ci  - **getExtensionRunningInfos** and **getTopAbility** are deleted. Use the APIs with the same name in **@ohos.app.ability.abilityManager.d.ts**.
85e41f4b71Sopenharmony_ci- @ohos.application.appManager.d.ts
86e41f4b71Sopenharmony_ci  - **ApplicationState** and **ProcessState** are deleted. Use **ApplicationState** and **ProcessState** of **@ohos.app.ability.appManager.d.ts**.
87e41f4b71Sopenharmony_ci  - **registerApplicationStateObserver** and **getProcessRunningInformation** are deleted. Use the APIs with the same name in **@ohos.app.ability.appManager.d.ts**.
88e41f4b71Sopenharmony_ci- @ohos.application.formHost.d.ts
89e41f4b71Sopenharmony_ci  - **shareForm** and **notifyFormsPrivacyProtected** are deleted. Use the APIs with the same name in **@ohos.app.form.formHost.d.ts**.
90e41f4b71Sopenharmony_ci- @ohos.application.formInfo.d.ts
91e41f4b71Sopenharmony_ci  - **eTS** of **FormType** is deleted. Use **eTS** of **FormType** in **@ohos.app.form.formInfo.d.ts**.
92e41f4b71Sopenharmony_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**.
93e41f4b71Sopenharmony_ci  - **FormInfoFilter** is deleted. Use **FormInfoFilter** of **@ohos.app.form.formInfo.d.ts**.
94e41f4b71Sopenharmony_ci  - **FormDimension** is deleted. Use **FormDimension** of **@ohos.app.form.formInfo.d.ts**.
95e41f4b71Sopenharmony_ci  - **VisibilityType** is deleted. Use **VisibilityType** of **@ohos.app.form.formInfo.d.ts**.
96e41f4b71Sopenharmony_ci- @ohos.wantAgent.d.ts
97e41f4b71Sopenharmony_ci  - **trigger** and **getOperationType** are deleted. Use the APIs with the same name in **@ohos.app.ability.wantAgent.d.ts**.
98e41f4b71Sopenharmony_ci- application/ApplicationContext.d.ts
99e41f4b71Sopenharmony_ci  - **registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback** are deleted. Use **on** and **off**.
100e41f4b71Sopenharmony_ci- application/ServiceExtensionContext.d.ts
101e41f4b71Sopenharmony_ci  - **connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility** are deleted. Use **connectServiceExtensionAbility**, **connectServiceExtensionAbilityWithAccount**, and **disconnectServiceExtensionAbility**.
102e41f4b71Sopenharmony_ci- @ohos.application.FormExtension.d.ts
103e41f4b71Sopenharmony_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**.
104e41f4b71Sopenharmony_ci- @ohos.application.abilityDelegatorRegistry.d.ts
105e41f4b71Sopenharmony_ci  - **AbilityDelegator**, **AbilityDelegatorArgs**, **AbilityMonitor**, and **ShellCmdResult** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityDelegatorRegistry.d.ts**.
106e41f4b71Sopenharmony_ci- @ohos.application.abilityManager.d.ts
107e41f4b71Sopenharmony_ci  - **AbilityRunningInfo** and **ExtensionRunningInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.abilityManager.d.ts**.
108e41f4b71Sopenharmony_ci- @ohos.application.appManager.d.ts
109e41f4b71Sopenharmony_ci  - **AbilityStateData**, **AppStateData**, **ApplicationStateObserver**, **ProcessRunningInfo**, and **ProcessRunningInformation** are deleted. Use the classes with the same name in **@ohos.app.ability.appManager.d.ts**.
110e41f4b71Sopenharmony_ci- @ohos.application.missionManager.d.ts
111e41f4b71Sopenharmony_ci  - **MissionInfo**, **MissionListener**, and **MissionSnapshot** are deleted. Use the classes with the same name in **@ohos.app.ability.missionManager.d.ts**.
112e41f4b71Sopenharmony_ci- @ohos.wantAgent.d.ts
113e41f4b71Sopenharmony_ci  - **TriggerInfo** and **WantAgentInfo** are deleted. Use the classes with the same name in **@ohos.app.ability.wantAgent.d.ts**.
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**Adaptation Guide**
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_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.
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciMost APIs are moved to the new namespace. Therefore, you can modify **import** for adaptation.
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ciFor example, the original API uses **@ohos.application.Ability**:
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci```js
128e41f4b71Sopenharmony_ciimport Ability from '@ohos.application.Ability';
129e41f4b71Sopenharmony_ci```
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ciYou can directly modify **import** to switch to the new namespace:
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci```js
134e41f4b71Sopenharmony_ciimport Ability from '@ohos.app.ability.UIAbility';
135e41f4b71Sopenharmony_ci```
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ciIn addition, exception handling is needed. For details, see the API reference for the new APIs.
138