• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Ability Framework Changelog
2
3## cl.ability.1 AreaMode APIs Changed
4
5Duplicate **AreaMode** APIs are deleted.
6
7**Change Impact**
8
9JS 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.
10
11**Key API/Component Changes**
12
13| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
14| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
15| @ohos.app.ability.common.d.ts | common.AreaMode |  | Deleted    |
16| application/Context.d.ts | AreaMode |  | Deleted    |
17
18
19**Adaptation Guide**
20
21Use **AreaMode** in **@ohos.app.ability.contextConstant.d.ts**.
22
23```ts
24import contextConstant from '@ohos.app.ability.contextConstant';
25let area: contextConstant.AreaMode = contextConstant.AreaMode.EL1;
26```
27
28## cl.ability.2 killProcessesBySelf Renamed
29
30The **killProcessesBySelf** API is renamed **killAllProcesses**.
31
32**Change Impact**
33
34JS 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.
35
36**Key API/Component Changes**
37
38| Module                        | Class              | Method/Attribute/Enum/Constant                                  | Change Type|
39| ------------------------------ | ------------------ | ----------------------------------------------------- | -------- |
40| application/ApplicationContext | ApplicationContext | killProcessesBySelf(): Promise\<void\>;               | Deleted    |
41| application/ApplicationContext | ApplicationContext | killProcessesBySelf(callback: AsyncCallback\<void\>); | Deleted    |
42| application/ApplicationContext | ApplicationContext | killAllProcesses(): Promise\<void\>;                  | Added    |
43| application/ApplicationContext | ApplicationContext | killAllProcesses(callback: AsyncCallback\<void\>);    | Added    |
44
45
46**Adaptation Guide**
47
48The following code snippet shows how to call **killProcessesBySelf** in an application.
49
50Code before the change:
51
52```ts
53let context: common.UIAbilityContext = globalThis.abilityContext;
54let appContext = context.getApplicationContext();
55appContext.killProcessesBySelf()
56```
57
58Code after the change:
59
60```ts
61let context: common.UIAbilityContext = globalThis.abilityContext;
62let appContext = context.getApplicationContext();
63appContext.killAllProcesses()
64```
65
66## cl.ability.3 getProcessRunningInformation Renamed
67
68The **getProcessRunningInformation** API is renamed **getRunningProcessInformation**.
69
70**Change Impact**
71
72JS 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.
73
74**Key API/Component Changes**
75
76| Module                             | Class              | Method/Attribute/Enum/Constant                                         | Change Type|
77| ----------------------------------- | ------------------ | ------------------------------------------------------------ | -------- |
78| @ohos.app.ability.appManager.d.ts   | appManager         | function getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation\>\>; | Deleted    |
79| @ohos.app.ability.appManager.d.ts   | appManager         | function getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation\>\>): void; | Deleted    |
80| @ohos.app.ability.appManager.d.ts   | appManager         | function getRunningProcessInformation(): Promise\<Array\<ProcessInformation\>\>; | Added    |
81| @ohos.app.ability.appManager.d.ts   | appManager         | function getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation\>\>): void; | Added    |
82| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation\>\>; | Deleted    |
83| application/ApplicationContext.d.ts | ApplicationContext | getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation\>\>): void; | Deleted    |
84| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(): Promise\<Array\<ProcessInformation\>\>; | Added    |
85| application/ApplicationContext.d.ts | ApplicationContext | getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation\>\>): void; | Added    |
86
87**Adaptation Guide**
88
89The following code snippet shows how to call **getProcessRunningInformation** in an application.
90
91Code before the change:
92
93```ts
94let context: common.UIAbilityContext = globalThis.abilityContext;
95let appContext = context.getApplicationContext();
96appContext.getProcessRunningInformation()
97```
98
99Code after the change:
100
101```ts
102let context: common.UIAbilityContext = globalThis.abilityContext;
103let appContext = context.getApplicationContext();
104appContext.getRunningProcessInformation()
105```
106
107## cl.ability.4 WantConstant.Flags API Changed
108
109**WantConstant.Flags** has multiple invalid flag definitions. These invalid flags are deleted.
110
111**Change Impact**
112
113JS 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.
114
115**Key API/Component Changes**
116
117| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
118| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
119| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_FORWARD_RESULT | Deleted    |
120| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_CONTINUATION | Deleted    |
121| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_NOT_OHOS_COMPONENT | Deleted    |
122| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_FORM_ENABLED | Deleted    |
123| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | Deleted    |
124| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_AUTH_PREFIX_URI_PERMISSION | Deleted    |
125| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITYSLICE_MULTI_DEVICE | Deleted    |
126| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_START_FOREGROUND_ABILITY | Deleted    |
127| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_CONTINUATION_REVERSIBLE | Deleted    |
128| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_INSTALL_WITH_BACKGROUND_MODE | Deleted    |
129| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_CLEAR_MISSION | Deleted    |
130| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_NEW_MISSION | Deleted    |
131| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags  | FLAG_ABILITY_MISSION_TOP | Deleted    |
132
133## cl.ability.5 WantConstant.Action API Changed
134
135**WantConstant.Action** has multiple invalid action definitions. These invalid actions are deleted.
136
137**Change Impact**
138
139JS 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.
140
141**Key API/Component Changes**
142
143| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
144| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
145| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | ACTION_APP_ACCOUNT_AUTH | Deleted    |
146| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | ACTION_MARKET_DOWNLOAD | Deleted    |
147| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | ACTION_MARKET_CROWDTEST | Deleted    |
148| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | DLP_PARAMS_SANDBOX | Deleted    |
149| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | DLP_PARAMS_BUNDLE_NAME | Deleted    |
150| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | DLP_PARAMS_MODULE_NAME | Deleted    |
151| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action  | DLP_PARAMS_ABILITY_NAME | Deleted    |
152
153## cl.ability.6 Caller APIs Changed
154
155Caller APIs use the **Parcelable** and **MessageSequence** objects provided by RPC in API version 9 to replace the deprecated **Sequenceable** and **MessageParcel** object.
156
157**Change Impact**
158
159JS 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.
160
161**Key API/Component Changes**
162
163| Module                   | Class               | Method/Attribute/Enum/Constant                                         | Change Type|
164| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
165| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | Changed to **(indata: rpc.MessageSequence): rpc.Parcelable;**.    |
166| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise<void>; | Changed to **call(method: string, data: rpc.Parcelable): Promise<void>;**.    |
167| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; | Changed to **callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>;**.    |
168
169**Adaptation Guide**
170
171The following illustrates how to call the caller APIs in your application.
172
173Code before the change:
174
175```ts
176  class MyMessageAble{
177      name:""
178      str:""
179      num: 1
180      constructor(name, str) {
181        this.name = name;
182        this.str = str;
183      }
184      marshalling(messageParcel) {
185          messageParcel.writeInt(this.num);
186          messageParcel.writeString(this.str);
187          console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
188          return true;
189      }
190      unmarshalling(messageParcel) {
191          this.num = messageParcel.readInt();
192          this.str = messageParcel.readString();
193          console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
194          return true;
195      }
196  };
197  let method = 'call_Function';
198  function funcCallBack(pdata) {
199      console.log('Callee funcCallBack is called ' + pdata);
200      let msg = new MyMessageAble("test", "");
201      pdata.readSequenceable(msg);
202      return new MyMessageAble("test1", "Callee test");
203  }
204  export default class MainUIAbility extends UIAbility {
205    onCreate(want, launchParam) {
206      console.log('Callee onCreate is called');
207      try {
208        this.callee.on(method, funcCallBack);
209      } catch (error) {
210        console.log('Callee.on catch error, error.code: ' + error.code +
211          ' error.message: ' + error.message);
212      }
213    }
214  }
215```
216
217Code after the change:
218
219```ts
220  class MyMessageAble{
221      name:""
222      str:""
223      num: 1
224      constructor(name, str) {
225        this.name = name;
226        this.str = str;
227      }
228      marshalling(messageSequence) {
229          messageSequence.writeInt(this.num);
230          messageSequence.writeString(this.str);
231          console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
232          return true;
233      }
234      unmarshalling(messageSequence) {
235          this.num = messageSequence.readInt();
236          this.str = messageSequence.readString();
237          console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
238          return true;
239      }
240  };
241  let method = 'call_Function';
242  function funcCallBack(pdata) {
243      console.log('Callee funcCallBack is called ' + pdata);
244      let msg = new MyMessageAble("test", "");
245      pdata.readParcelable(msg);
246      return new MyMessageAble("test1", "Callee test");
247  }
248  export default class MainUIAbility extends UIAbility {
249    onCreate(want, launchParam) {
250      console.log('Callee onCreate is called');
251      try {
252        this.callee.on(method, funcCallBack);
253      } catch (error) {
254        console.log('Callee.on catch error, error.code: ' + error.code +
255          ' error.message: ' + error.message);
256      }
257    }
258  }
259```
260
261## cl.ability.7 WantConstant.Flags API Changed
262
263The **wantConstant** API had two similar enums. Now the two enums are combined into one.
264
265**Change Impact**
266
267JS 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.
268
269**Key API/Component Changes**
270
271| Module                             | Class                  | Method/Attribute/Enum/Constant                | Change Type|
272| ----------------------------------- | ---------------------- | ----------------------------------- | -------- |
273| @ohos.app.ability.wantConstant.d.ts | wantConstant.Parameter | ABILITY_BACK_TO_OTHER_MISSION_STACK | Deleted    |
274| @ohos.app.ability.wantConstant.d.ts | wantConstant.Params    | ABILITY_BACK_TO_OTHER_MISSION_STACK | Added    |
275
276**Adaptation Guide**
277
278Use **ABILITY_BACK_TO_OTHER_MISSION_STACK** in **@ohos.app.ability.wantConstant.d.ts**.
279
280```ts
281import wantConstant from '@ohos.app.ability.wantConstant';
282let backToOtherMissionStack: wantConstant.Params = wantParam.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK;
283```
284