提交 eaf91488 编写于 作者: G Gloria

Update docs against 12301 and more

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 1f75a43c
# Security Subsystem ChangeLog
## cl.security.1 setSeed API Change of Random from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- setSeed(seed : DataBlob, callback : AsyncCallback\<void>) : void;
- setSeed(seed : DataBlob) : Promise\<void>;
API prototype after change:
setSeed(seed : DataBlob) : void;
**Adaptation Guide**
See the API adaptation guide of **setSeed** in the API reference: [Crypto Framework - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cryptoFramework.md)
## cl.security.2 Migration of interface DataArray from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface DataArray** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.3 Migration of interface EncodingFormat from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface EncodingFormat** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.4 Migration of interface EncodingBlob from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface EncodingBlob** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.5 Migration of interface CertChainData from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface CertChainData** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.6 Migration of interface X509Cert from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface X509Cert** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.7 Migration of function createX509Cert from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **function createX509Cert** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.8 Migration of interface X509CrlEntry from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts.
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface X509CrlEntry** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.9 Migration of interface X509Crl from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface X509Crl** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.10 Migration of function createX509Crl from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **function createX509Crl** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.11 Migration of interface CertChainValidator from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **interface CertChainValidator** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.12 Migration of function createCertChainValidator from @ohos.security.cryptoFramework.d.ts to @ohos.security.cert.d.ts
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
Migrated **function createCertChainValidator** from **@ohos.security.cryptoFramework.d.ts** to **@ohos.security.cert.d.ts**.
**Adaptation Guide**
Import and use the new .d.ts file:
import cryptoCert from '@ohos.security.cert';
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.13 getPublicKey API Change of X509Cert from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getPublicKey(callback : AsyncCallback\<PubKey>) : void;
- getPublicKey() : Promise\<PubKey>;
API prototype after change:
getPublicKey() : cryptoFramework.PubKey;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.14 checkValidityWithDate API Change of X509Cert from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- checkValidityWithDate(date: string, callback : AsyncCallback\<void>) : void;
- checkValidityWithDate(date: string) : Promise\<void>;
API prototype after change:
checkValidityWithDate(date: string) : void;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.15 getCertIssuer API Change of X509CrlEntry from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getCertIssuer(callback : AsyncCallback\<DataBlob>) : void;
- getCertIssuer() : Promise\<DataBlob>;
API prototype after change:
getCertIssuer() : DataBlob;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.16 getRevocationDate API Change of X509CrlEntry from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getRevocationDate(callback : AsyncCallback\<string>) : void;
- getRevocationDate() : Promise\<string>;
API prototype after change:
getRevocationDate() : string;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.17 isRevoked API Change of X509Crl from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- isRevoked(cert : X509Cert, callback : AsyncCallback\<boolean>) : void;
- isRevoked(cert : X509Cert) : Promise\<boolean>;
API prototype after change:
isRevoked(cert : X509Cert) : boolean;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.18 getRevokedCert API Change of X509Crl from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getRevokedCert(serialNumber : number, callback : AsyncCallback\<X509CrlEntry>) : void;
- getRevokedCert(serialNumber : number) : Promise\<X509CrlEntry>;
API prototype after change:
getRevokedCert(serialNumber : number) : X509CrlEntry;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.19 getRevokedCertWithCert API Change of X509Crl from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback\<X509CrlEntry>) : void;
- getRevokedCertWithCert(cert : X509Cert) : Promise\<X509CrlEntry>;
API prototype after change:
getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
## cl.security.20 getTbsInfo API Change of X509Crl from Asynchronous to Synchronous
**Change Impacts**
Behavior of released JavaScript APIs will be changed.
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
API prototype before change:
- getTbsInfo(callback : AsyncCallback\<DataBlob>) : void;
- getTbsInfo() : Promise\<DataBlob>;
API prototype after change:
getTbsInfo() : DataBlob;
**Adaptation Guide**
See the corresponding API adaptation guide in the API reference: [Certificate - API Reference](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-cert.md)
<!--no_check-->
\ No newline at end of file
# ChangeLog of JS API Changes of the Ability Subsystem
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(Mr) has the following API changes in the ability subsystem:
## cl.ability.1 API Migration
The **requestPermissionsFromUser** API of **UIAbilityContext** is migrated from the ability subsystem to the security subsystem.
Previously, 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.
You need to adapt your applications based on the following information:
**Change Impacts**
JS APIs in API version 9 are affected. The application needs to adapt these APIs so that it can properly implement functions in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ---------------------------- | ---------------- | ------------------------------------------------------------ | -------- |
| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>): void; | Deleted |
| application/UIAbilityContext | UIAbilityContext | requestPermissionsFromUser(permissions: Array<string>): Promise<PermissionRequestResult>; | Deleted |
| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; | Added |
| @ohos.abilityAccessCtrl | AtManager | requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; | Added |
**Adaptation Guide**
The following illustrates how **requestPermissionsFromUser** is called to show a permission popup.
Stage model:
```ts
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
// onWindowStageCreate lifecycle of UIAbility.
onWindowStageCreate() {
let AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser determines whether to display a popup based on the permission authorization status.
AtManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => {
console.log("data type:" + typeof(data));
console.log("data:" + data);
console.log("data permissions:" + data.permissions);
console.log("data result:" + data.authResults);
}).catch((err) => {
console.error('Failed to start ability', err.code);
})
}
```
## cl.ability.2 Deletion of Deprecated APIs in API Version 9
In 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.
**Change Impacts**
The application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
**Key API/Component Changes**
API files are deleted.
| Deleted API | New API |
| ----------------------------------------------- | ----------------------------------------------- |
| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts |
| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts |
| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts |
| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts |
| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts |
| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts |
| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts |
| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts |
| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts |
| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts |
| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts |
APIs or attributes are deleted:
- @ohos.application.Configuration.d.ts
- **direction**, **screenDensity**, **displayId**, and **hasPointerDevice** of **Configuration** are deleted. Replace it with **Configuration** of **@ohos.app.ability.Configuration.d.ts**.
- @ohos.application.ConfigurationConstant.d.ts
- **Direction** and **ScreenDensity** are deleted. Replace them with **Direction** and **ScreenDensity** of **@ohos.app.ability.ConfigurationConstant.d.ts**.
- @ohos.application.abilityManager.d.ts
- **getExtensionRunningInfos** and **getTopAbility** are deleted. Replace them with synonymous methods of **@ohos.app.ability.abilityManager.d.ts**.
- @ohos.application.appManager.d.ts
- **ApplicationState** and **ProcessState** are deleted. Replace them with **ApplicationState** and **ProcessState** of **@ohos.app.ability.appManager.d.ts**.
- **registerApplicationStateObserver** and **getProcessRunningInformation** are deleted. Replace them with synonymous methods of **@ohos.app.ability.appManager.d.ts**.
- @ohos.application.formHost.d.ts
- **shareForm** and **notifyFormsPrivacyProtected** are deleted. Replace them with synonymous methods of **@ohos.app.form.formHost.d.ts**.
- @ohos.application.formInfo.d.ts
- **eTS** of **FormType** is deleted. Replace it with **eTS** of **FormType** in **@ohos.app.form.formInfo.d.ts**.
- **IDENTITY_KEY**, **BUNDLE_NAME_KEY**, **ABILITY_NAME_KEY**, and **DEVICE_ID_KEY** of **FormParam** are deleted. Replace them with synonymous enumerations of **@ohos.app.form.formInfo.d.ts**.
- **FormInfoFilter** is deleted. Replace it with **FormInfoFilter** of **@ohos.app.form.formInfo.d.ts**.
- **FormDimension** is deleted. Replace it with **FormDimension** of **@ohos.app.form.formInfo.d.ts**.
- **VisibilityType** is deleted. Replace it with **VisibilityType** of **@ohos.app.form.formInfo.d.ts**.
- @ohos.wantAgent.d.ts
- **trigger** and **getOperationType** are deleted. Replace them with synonymous methods of **@ohos.app.ability.wantAgent.d.ts**.
- application/ApplicationContext.d.ts
- **registerAbilityLifecycleCallback**, **unregisterAbilityLifecycleCallback**, **registerEnvironmentCallback**, and **unregisterEnvironmentCallback** are deleted. Replace them with **on** and **off**.
- application/ServiceExtensionContext.d.ts
- **connectAbility**, **connectAbilityWithAccount**, and **disconnectAbility** are deleted. Replace them with **connectServiceExtensionAbility**, **connectServiceExtensionAbilityWithAccount**, and **disconnectServiceExtensionAbility**.
- @ohos.application.ExtensionAbility.d.ts
- **onCreate**, **onCastToNormal**, **onUpdate**, **onVisibilityChange**, **onEvent**, **onDestroy**, **onAcquireFormState**, and **onShare** are deleted. Replace them with the following lifecycle methods of **@ohos.app.form.FormExtensionAbility.d.ts**: **onAddForm**, **onCastToNormalForm**, **onUpdateForm**, **onChangeFormVisibility**, **onFormEvent**, **onRemoveForm**, **onAcquireFormState**, and **onShareForm**.
- @ohos.application.abilityDelegatorRegistry.d.ts
- **AbilityDelegator**, **AbilityDelegatorArgs**, **AbilityMonitor**, and **ShellCmdResult** are deleted. Replace them with synonymous classes of **@ohos.app.ability.abilityDelegatorRegistry.d.ts**.
- @ohos.application.abilityManager.d.ts
- **AbilityRunningInfo** and **ExtensionRunningInfo** are deleted. Replace them with synonymous classes of **@ohos.app.ability.abilityManager.d.ts**.
- @ohos.application.appManager.d.ts
- **AbilityStateData**, **AppStateData**, **ApplicationStateObserver**, **ProcessRunningInfo**, and **ProcessRunningInformation** are deleted. Replace them with synonymous classes of **@ohos.app.ability.appManager.d.ts**.
- @ohos.application.missionManager.d.ts
- **MissionInfo**, **MissionListener**, and **MissionSnapshot** are deleted. Replace them with synonymous classes of **@ohos.app.ability.missionManager.d.ts**.
- @ohos.wantAgent.d.ts
- **TriggerInfo** and **WantAgentInfo** are deleted. Replace them with synonymous classes of **@ohos.app.ability.wantAgent.d.ts**.
**Adaptation Guide**
As 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.
Most APIs are moved to the new namespace. Therefore, you can modify **import** for adaption.
For example, the original API uses **@ohos.application.Ability**:
```js
import Ability from '@ohos.application.Ability';
```
You can directly modify **import** to switch to the new namespace:
```js
import Ability from '@ohos.app.ability.UIAbility';
```
In addition, exception processing is needed. For details, see the API reference for the new APIs.
# ChangeLog of JS API Changes in the commonlibrary Subsystem
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(Mr) has the following API changes in the commonlibrary subsystem.
## cl.commonlibrary.1 Error Code and Information Change
Changed error codes and information returned by APIs of the **ArrayList**, **List**, **LinkedList**, **Stack**, **Queue**, **Deque**, **PlainArray**, **LightWeightMap**, **LightWeightSet**, **HashMap**, **HashSet**, **TreeMap**, and **TreeSet** classes in the commonlibrary subsystem.
For details about the changed error codes, see [error codes of language basic class libraries](../../../application-dev/reference/errorcodes/errorcode-utils.md).
No adaptation is required for applications developed using these APIs.
**Key API/Component Changes**
Error code information is redefined for APIs in these classes and marked using **'@throws'** in the `*.d.ts` file of the corresponding module.
The sample code is as follows:
**ArrayList** class before the change:
constructor();
**ArrayList** class after the change:
@throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked.
constructor();
**Change Impacts**
None
# ChangeLog of JS API Changes of the Distributed Data Management Subsystem
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(Mr) has the following API changes in the distributed data management subsystem:
## cl.distributeddatamgr.1 API Change
APIs in the **kv_store** component of the distributed data management subsystem are changed:
**createKVManager** is changed from asynchronous to synchronous, because the execution duration is fixed and short and there is no need to asynchronously wait for the execution result. Therefore, the original APIs **function createKVManager(config: KVManagerConfig): Promise\<KVManager\>;** and **function createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void;** are changed to **function createKVManager(config: KVManagerConfig): KVManager;**.
You need to adapt your applications based on the following information:
**Change Impacts**
JS APIs in API version 9 are affected. The application needs to adapt these APIs so that it can properly implement functions in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ------------------------ | ------------------ | ------------------------------------------------------------ | -------- |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\<KVManager\>; | Deleted |
| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | Changed |
**Adaptation Guide**
The following illustrates how to call **createKVManager** to create a **KVManager** object.
Stage model:
```ts
import AbilityStage from '@ohos.application.Ability'
let kvManager;
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
let context = this.context
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
}
}
```
FA model:
```ts
import featureAbility from '@ohos.ability.featureAbility'
let kvManager;
let context = featureAbility.getContext()
const kvManagerConfig = {
context: context,
bundleName: 'com.example.datamanagertest',
}
try {
kvManager = distributedKVStore.createKVManager(kvManagerConfig);
} catch (e) {
console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
}
```
## cl.distributeddatamgr.2 Migration of function getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts.
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
APIs:
```ts
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback<RdbStoreV9>): void;
function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise<RdbStoreV9>;
```
The APIs are migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void;
function getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>;
```
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant methods should be changed according to the preceding changes.
## cl.distributeddatamgr.3 Migration of function deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
APIs:
```ts
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
The APIs are migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant methods should be changed according to the preceding changes.
## cl.distributeddatamgr.4 Migration of interface StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
**interface StoreConfigV9** is migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface StoreConfig**.
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant APIs should be changed according to the preceding changes.
## cl.distributeddatamgr.5 Migration of enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
**enum SecurityLevel** is migrated from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant APIs should be changed according to the preceding changes.
## cl.distributeddatamgr.6 Migration of interface RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
**interface RdbStoreV9** is migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface RdbStore**.
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant APIs should be changed according to the preceding changes.
## cl.distributeddatamgr.7 Migration of class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
**class RdbPredicatesV9** is migrated from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface RdbPredicates**.
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The names of relevant APIs should be changed according to the preceding changes.
## cl.distributeddatamgr.8 Migration of interface ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts
**Change Impacts**
The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
**interface ResultSetV9** is migrated from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface ResultSet**.
**Adaptation Guide**
* `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`.
* The **ResultSetV9** instance is obtained only via **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**.
## cl.multimedia.av_session.001 Change of All av_session APIs to System APIs
All av_session APIs are changed to system APIs.
**Change Impacts**
Non-system applications and applications without system API permission cannot call system APIs.
**Key API/Component Changes**
All APIs are changed to system APIs. The table below describes the APIs.
| API, Enumeration, or Variable| Type| Is System API|
| -------- | -------- | ------- |
| SessionToken | interface | Yes|
| AVMetadata | interface | Yes|
| AVPlaybackState | interface | Yes|
| PlaybackPosition | interface | Yes|
| OutputDeviceInfo | interface | Yes|
| AVSessionDescriptor | interface | Yes|
| AVSessionController | interface | Yes|
| AVControlCommand | interface | Yes|
| createAVSession | function | Yes|
| getAllSessionDescriptors | function | Yes|
| createController | function | Yes|
| castAudio | function | Yes|
| on | function | Yes|
| off | function | Yes|
| sendSystemAVKeyEvent | function | Yes|
| sendSystemControlCommand | function | Yes|
| sessionId | variable | Yes|
| setAVMetadata | function | Yes|
| setAVPlaybackState | function | Yes|
| setLaunchAbility | function | Yes|
| getController | function | Yes|
| getOutputDevice | function | Yes|
| activate | function | Yes|
| deactivate | function | Yes|
| destroy | function | Yes|
| getAVPlaybackState | function | Yes|
| getAVMetadata | function | Yes|
| getOutputDevice | function | Yes|
| sendAVKeyEvent | function | Yes|
| getLaunchAbility | function | Yes|
| getRealPlaybackPositionSync | function | Yes|
| isActive | function | Yes|
| getValidCommands | function | Yes|
| sendControlCommand | function | Yes|
| AVSessionType | type | Yes|
| AVControlCommandType | type | Yes|
| LoopMode | enum | Yes|
| PlaybackState | enum | Yes|
| AVSessionErrorCode | enum | Yes|
# Common Event and Notification Subsystem ChangeLog
## cl.notification.1 Deleting Deprecated APIs (Version 9)
In the [event notification exception handling rectification](../OpenHarmony_3.2.8.3/changelogs-notification.md), some APIs in API version 9 are marked as deprecated, and these APIs need to be deleted, according to OpenHarmony API specifications.
**Change Impacts**
The application developed based on earlier versions needs to use new APIs to replace the deleted ones. Otherwise, the application compilation will be affected.
**Key API/Component Changes**
Deprecated APIs in API version 9 will be deleted, and they will be replaced with new ones with same names.
| Original API | New API |
| ----------------------- | -------------------------------- |
| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationManager.d.ts |
| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts |
APIs or attributes are deleted:
- @ohos.notification.d.ts
- The **publishAsBundle**, **cancelAsBundle**, **isNotificationSlotEnabled**, **setSyncNotificationEnabledWithoutApp**, and **getSyncNotificationEnabledWithoutApp** APIs are deleted. Replace them with APIs with same names in **api/@ohos.notificationManager.d.ts**.
- The **enableNotificationSlot** API is deleted. Replace it with **setNotificationEnableSlot** in **api/@ohos.notificationManager.d.ts**.
- The export classes **NotificationActionButton**, **NotificationBasicContent**, **NotificationContent**, **NotificationLongTextContent**, **NotificationMultiLineContent**, **NotificationPictureContent**, **NotificationFlags**, **NotificationFlagStatus**, **NotificationRequest**, **DistributedOptions**, **NotificationSlot**, **NotificationSorting**, **NotificationTemplate**, and **NotificationUserInput** are deleted. Replace them with the export classes with the same names in **api/@ohos.notificationManager.d.ts**.
- The export classes **NotificationSubscribeInfo**, **NotificationSubscriber**, **SubscribeCallbackData**, and **EnabledNotificationCallbackData** are deleted. Replace them with the export classes with the same names in **api/@ohos.notificationSubscribe.d.ts**.
**Adaptation Guide**
The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem.
If the original API uses **@ohos.commonEvent**:
```js
import commonEvent from '@ohos.commonEvent';
```
You can directly modify **import** to switch to the new namespace:
```js
import commonEvent from '@ohos.commonEventManager';
```
**@ohos.notification** is split into two namespaces. You need to select a new namespace for adaptation.
In addition, exception handling is needed. For details, see the API reference for the new APIs.
# Time Subsystem ChangeLog
## cl.time.1 API Error Change
Errors thrown by timer APIs of the time subsystem: **202** (non-system application) and **401** (invalid parameters).
**Change Impacts**
The API change is forward compatible. Applications developed based on earlier versions can still use the APIs, and corresponding error handling is added. The original functions are not affected.
**Key API/Component Changes**
Before change:
- The API throws an error message without an error code.
After change:
- The API throws an error message with an error code. Error code **202** indicates that the application is not a system application, and error code **401** indicates that the parameters are invalid.
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ----------------- | ----------- | ------------------------------------------------------------ | -------- |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions, callback: AsyncCallback<number>): void | Changed |
| @ohos.systemTimer | systemTimer | function createTimer(options: TimerOptions): Promise<number> | Changed |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function startTimer(timer: number, triggerTime: number): Promise<void> | Changed |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number, callback: AsyncCallback<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function stopTimer(timer: number): Promise<void> | Changed |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number, callback: AsyncCallback<void>): void | Changed |
| @ohos.systemTimer | systemTimer | function destroyTimer(timer: number): Promise<void> | Changed |
**Adaptation Guide**
Refer to the code below to capture errors when **systemTimer** APIs are called in applications.
createTimer callback mode:
**Example**:
```js
export default {
systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
systemTimer.createTimer(options, (error, data) => {
if (error) {
// Capture the permission denial error.
console.info(`Failed to create timer. message:${error.message}, code:${error.code}`);
}
});
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to create timer. message:${e.message}, code:${e.code}`);
}
}
}
```
createTimer promise mode:
**Example**:
```js
export default {
systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat: false
};
try {
systemTimer.createTimer(options).then((data) => {
console.info(`Succeeded in creating timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to create timer. message:${error.message}, code:${error.code}`);
});
} catch(e) {
// Capture the parameter verification error.
console.info(`Failed to create timer. message:${e.message}, code:${e.code}`);
}
}
}
```
startTimer callback mode:
**Example**:
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
try {
systemTimer.startTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to start timer. message:${error.message}, code:${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to start timer. message:${e.message}, code:${e.code}`);
}
}
}
```
startTimer promise mode:
**Example**:
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
try {
systemTimer.startTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in startting timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to start timer. message:${error.message}, code:${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to start timer. message:${e.message}, code:${e.code}`);
}
}
}
```
stopTimer callback mode:
**Example**:
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
try {
systemTimer.stopTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to stop timer. message:${error.message}, code:${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`);
}
}
}
```
stopTimer promise mode:
**Example**:
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
try {
systemTimer.stopTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in stop timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to stop timer. message:${error.message}, code:${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to stop timer. message:${e.message}, code:${e.code}`);
}
}
}
```
destroyTimer callback mode:
**Example**:
```js
export default {
async systemTimer () {
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
systemTimer.stopTimer(timerId);
try {
systemTimer.destroyTimer(timerId, triggerTime, (error) => {
if (error) {
// Capture the permission denial error.
console.error(`Failed to destroy timer. message:${error.message}, code:${error.code}`);
}
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to destroy timer. message:${e.message}, code:${e.code}`);
}
}
}
```
destroyTimer promise mode:
**Example**:
```js
export default {
async systemTimer (){
let options = {
type: systemTimer.TIMER_TYPE_REALTIME,
repeat:false
}
let timerId = await systemTimer.createTimer(options);
let triggerTime = new Date().getTime();
triggerTime += 3000;
systemTimer.startTimer(timerId, triggerTime);
systemTimer.stopTimer(timerId);
try {
systemTimer.destroyTimer(timerId, triggerTime).then((data) => {
console.log(`Succeeded in destroy timer. Data:` + data);
}).catch((error) => {
// Capture the permission denial error.
console.info(`Failed to destroy timer. message:${error.message}, code:${error.code}`);
});
} catch (e) {
// Capture the parameter verification error.
console.info(`Failed to destroy timer. message:${e.message}, code:${e.code}`);
}
}
}
```
# ChangeLog of JS API Changes in the URL Subsystem
Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(Mr) has the following API changes in the URL subsystem:
## cl.url.1 URLParams Class API Changes
APIs in the **URLParams** class in the URL subsystem are changed:
**constructor(init?: string[][] | Record<string, string> | string | URLSearchParams)** is changed to **constructor(init?: string[][] | Record<string, string> | string | URLParams)**, and the parameter type is changed from URLSearchParams to URLParams.
You need to adapt your application based on the following information.
**Change Impacts**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement functions in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| :-------- | --------- | ------------------------------------------------------------ | -------- |
| @ohos.url | URLParams | constructor(string[][] \| Record&lt;string, string&gt; \| string \| URLSearchParams) | Deleted |
| @ohos.url | URLParams | constructor(string[][] \| Record&lt;string, string&gt; \| string \| URLParams)| Changed|
**Adaptation Guide**
The following illustrates how to create a **URLParams** object in your application:
Example:
```ts
import url from '@ohos.url'
try {
let params1 = new Url.URLParams('?user=abc&query=xyz')
let params2 = new Url.URLParams(params1)
var result= params2.toString()
console.log(result) //"user=abc&query=xyz"
} catch (err) {
console.error(`Fail to ceate URLParams.codeis${err.code},message is ${err.message}`);
}
```
## cl.url.2 URL Attribute Changes of URLParams Class APIs
URL attributes in the URL subsystem are changed:
The **searchParams: URLSearchParams** attribute is deprecated, and the **params: URLParams** attribute is added.
You need to adapt your application based on the following information.
**Change Impacts**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement functions in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class| Method/Attribute/Enumeration/Constant | Change Type |
| :-------- | ---- | ------------------------------ | --------------- |
| @ohos.url | URL | searchParams: URLSearchParams; | Deprecated (in API version 9)<br>|
| @ohos.url | URL | params: URLParams; | Added |
**Adaptation Guide**
The following illustrates how to create a **URLParams** object in your application:
Example:
```ts
import url from '@ohos.url'
let that = new Url.URL('http://username:password@host:8080/directory/file?Hello=china#qwer=da')
let params = that.URLParams
var result = params.toString()
console.log(result) //%E4%BD%A0%E5%A5%BD=china
```
# Account Subsystem ChangeLog
## cl.account_os_account.1 Change of Definition and Return Mode of Error Codes
To solve the issues that error code definitions of the account subsystem APIs were inconsistent and that the return mode of the error codes did not comply with relevant specifications of OpenHarmony, the following changes are made and take effect in API version 9 and later:
- Added the following unified error code definitions:
- [Account Error Codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-account.md)
- [App Account Error Codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-app-account.md)
- Returned an error code in either of the following ways, according to the API type:
- Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**. An error message related to the parameter type or quantity is returned via an exception.
- Synchronous API: An error message is returned via an exception.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
The mentioned changes involve the following APIs:
- class AccountManager
- activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void;
- removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void;
- setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean, callback: AsyncCallback&lt;void&gt;): void;
- setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;void&gt;): void;
- queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void;
- queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&gt;): void;
- createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;): void;
- setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback&lt;void&gt;): void;
- on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&gt;): void;
- off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number&gt;): void;
- isMainOsAccount(callback: AsyncCallback&lt;boolean&gt;): void;
- queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback&lt;Array&lt;ConstraintSourceTypeInfo&gt;&gt;): void;
- class UserAuth
- constructor();
- getVersion(): number;
- getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
- getProperty(request: GetPropertyRequest, callback: AsyncCallback&lt;ExecutorProperty&gt;): void;
- setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;number&gt;): void;
- auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
- authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
- cancelAuth(contextID: Uint8Array): number;
- class PINAuth
- constructor();
- registerInputer(inputer: IInputer): boolean;
- unregisterInputer(authType: AuthType): void;
- class UserIdentityManager
- constructor();
- openSession(callback: AsyncCallback&lt;Uint8Array&gt;): void;
- addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
- updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
- closeSession(): void;
- cancel(challenge: Uint8Array): number;
- delUser(token: Uint8Array, callback: IIdmCallback): void;
- delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;
- getAuthInfo(callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void;
- interface IInputData
- onSetData: (authSubType: AuthSubType, data: Uint8Array) =&gt; void;
**Adaptation Guide**
The following uses **activateOsAccount** as an example to illustrate the error information processing logic of an asynchronous API:
```ts
import account_osAccount from "@ohos.account.osAccount"
let accountMgr = account_osAccount.getAccountManager()
let callbackFunc = (err) => {
if (err != null) { // Handle the business error.
console.log("account_osAccount failed, error: " + JSON.stringify(err));
} else {
console.log("account_osAccount successfully");
}
}
try {
accountMgr.activateOsAccount("100", callbackFunc);
} catch (err) { // Process the error that is related to the parameter type.
console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err));
}
try {
accountMgr.activateOsAccount();
} catch (err) { // Process the error that is related to the parameter quantity.
console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err));
}
```
The following uses **registerInputer** as an example to illustrate the error information processing logic of a synchronous API:
```ts
import account_osAccount from "@ohos.account.osAccount"
let pinAuth = new account_osAccount.PINAuth()
try {
pinAuth.registerInputer({})
} catch (err) { // Process the error that is related to the parameter type.
console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err));
}
try {
pinAuth.registerInputer()
} catch (err) { // Process the error that is related to the parameter quantity.
console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err));
}
```
# Device Manager ChangeLog
## cl.device_manager.1 Error Information Return Method Change of APIs
The device manager API uses service logic return values to indicate the error information, which does not comply with the API error code specifications of OpenHarmony. The following changes are made in API version 9 and later:
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Error code processing is added for the following APIs:
- createDeviceManager(bundleName: string, callback: AsyncCallback&lt;DeviceManager&gt;): void;
- release(): void;
- getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt;
- getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): void;
- getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt;
- getLocalDeviceInfoSync(): DeviceInfo;
- getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void;
- getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt;
- startDeviceDiscovery(subscribeInfo: SubscribeInfo): void;
- startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void;
- stopDeviceDiscovery(subscribeId: number): void;
- publishDeviceDiscovery(publishInfo: PublishInfo): void;
- unPublishDeviceDiscovery(publishId: number): void;
- authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback&lt;{deviceId: string, pinToken ?: number}&gt;): void;
- unAuthenticateDevice(deviceInfo: DeviceInfo): void;
- verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback&lt;{deviceId: string, level: number}&gt;): void;
- setUserOperation(operateAction: number, params: string): void;
- on(type: 'uiStateChange', callback: Callback&lt;{ param: string}&gt;): void;
- off(type: 'uiStateChange', callback?: Callback&lt;{ param: string}&gt;): void;
- on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChangeAction, device: DeviceInfo }&gt;): void;
- off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChangeAction, device: DeviceInfo }&gt;): void;
- on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: DeviceInfo }&gt;): void;
- off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: DeviceInfo }&gt;): void;
- on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: number }&gt;): void;
- off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason: number }&gt;): void;
- on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): void;
- off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): void;
- on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: number }&gt;): void;
- off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: number }&gt;): void;
- on(type: 'serviceDie', callback: () =&gt; void): void;
- off(type: 'serviceDie', callback?: () =&gt; void): void;
**Adaptation Guide**
The following uses **getTrustedDeviceList** as an example for asynchronous APIs:
```ts
import account_osAccount from "@ohos.distributedHardware.deviceManager"
dmInstance.getTrustedDeviceList((err, data) => {
console.log("getTrustedDeviceList err: " + JSON.stringify(err));
console.log('get trusted device info: ' + JSON.stringify(data));
});
try {
dmInstance.getTrustedDeviceList((err, data) => {
if (err) {
console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message);
return;
}
console.log('get trusted device info: ' + JSON.stringify(data));
});
} catch (err) {
console.error("getTrustedDeviceList errCode:" + err.code + ",errMessage:" + err.message);
}
```
The following uses **startDeviceDiscovery** as an example for synchronous APIs:
```ts
// Automatically generate a unique subscription ID.
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": 0xAA, // Active discovery
"medium": 0, // Automatic. Multiple media can be used for device discovery.
"freq": 2, // High frequency
"isSameAccount": false,
"isWakeRemote": false,
"capability": 1
};
dmInstance.startDeviceDiscovery(subscribeInfo); // The deviceFound callback is called to notify the application when a device is discovered.
// Automatically generate a unique subscription ID.
var subscribeId = Math.floor(Math.random() * 10000 + 1000);
var subscribeInfo = {
"subscribeId": subscribeId,
"mode": 0xAA, // Active discovery
"medium": 0, // Automatic. Multiple media can be used for device discovery.
"freq": 2, // High frequency
"isSameAccount": false,
"isWakeRemote": false,
"capability": 1
};
try {
dmInstance.startDeviceDiscovery(subscribeInfo); // The deviceFound callback is called to notify the application when a device is discovered.
} catch (err) {
console.error("startDeviceDiscovery errCode:" + err.code + ",errMessage:" + err.message);
}
```
# USB Manager ChangeLog
## cl.usb_manager.1 Error Information Return Method Change of APIs
The USB manager API uses service logic return values to indicate the error information, which does not comply with the API error code specifications of OpenHarmony. Beginning from API version 9, error information is returned by throwing exceptions.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Changed the USB module name from **@ohos.usb.d.ts** to **@ohos.usbV9.d.ts**, and added error code processing for all APIs in the module.
**Adaptation Guide**
Take the **getDevices** API as an example. The sample code is as follows:
```ts
import usbV9 from '@ohos.usbV9'
try {
usbV9.getDevices(); // If an improper parameter is passed to this API, an exception will be thrown.
} catch (err) {
console.error("getDevices errCode:" + err.code + ",errMessage:" + err.message);
}
```
# DSoftBus Subsystem ChangeLog
## IPC&RPC APIs support the exception handling mode and the selection of synchronous or asynchronous message sending by passing a Boolean value or a numeric value.
1. Some IPC&RPC APIs of DSoftBus use service logic return values to indicate the error information, which does not comply with the API error code specifications of OpenHarmony.
2. A Boolean value can be passed to specify the mode of sending information as asynchronous or synchronous.
#### Change Impacts
This version is compatible with earlier versions and no adaptation is required. Newly added APIs can be called to support the following changes:
1. Supports exception handling and return of error codes.
2. Supports selection of synchronous or asynchronous message sending by passing a Boolean value or by passing 0 or a non-0 number.
#### **Key API/Component Changes**
For adaptation to the unified API exception handling mode, related IPC&RPC APIs are deprecated, and corresponding new APIs and methods are added. The newly added APIs support unified error code handling specifications and function the same as the original APIs.
| Class| Deprecated API | New Class | New API |
| ------------ | ------------ | ------------ | ------------ |
| MessageParcel | static create(): MessageParcel | MessageSequence | static create(): MessageSequence |
| MessageParcel | reclaim(): void | MessageSequence | reclaim(): void |
| MessageParcel | writeRemoteObject(object: IRemoteObject): boolean| MessageSequence |writeRemoteObject(object: IRemoteObject): void|
| MessageParcel | readRemoteObject(): IRemoteObject | MessageSequence | readRemoteObject(): IRemoteObject |
| MessageParcel | writeInterfaceToken(token: string): boolean | MessageSequence | writeInterfaceToken(token: string): void |
| MessageParcel | readInterfaceToken(): string | MessageSequence | readInterfaceToken(): string |
| MessageParcel | getSize(): number | MessageSequence | getSize(): number |
| MessageParcel | getCapacity(): number | MessageSequence | getCapacity(): number|
| MessageParcel | setSize(size: number): boolean | MessageSequence | setCapacity(size: number): void |
| MessageParcel | getReadableBytes(): number | MessageSequence | getReadableBytes(): number |
| MessageParcel | getReadPosition(): number | MessageSequence | getReadPosition(): number |
| MessageParcel | getWritePosition(): number | MessageSequence | getWritePosition(): number |
| MessageParcel | rewindRead(pos: number): boolean | MessageSequence | rewindRead(pos: number): void |
| MessageParcel | rewindWrite(pos: number): boolean | MessageSequence | rewindWrite(pos: number): void |
| MessageParcel | writeNoException(): void | MessageSequence | writeNoException(): void |
| MessageParcel | readException(): void | MessageSequence | readException(): void |
| MessageParcel | writeByte(val: number): boolean | MessageSequence | writeByte(val: number): void |
| MessageParcel | writeShort(val: number): boolean | MessageSequence | writeShort(val: number): void |
| MessageParcel | writeInt(val: number): boolean | MessageSequence | writeInt(val: number): void |
| MessageParcel | writeLong(val: number): boolean | MessageSequence | writeLong(val: number): void |
| MessageParcel | writeFloat(val: number): boolean | MessageSequence | writeFloat(val: number): void |
| MessageParcel | writeDouble(val: number): boolean | MessageSequence | writeDouble(val: number): void |
| MessageParcel | writeBoolean(val: boolean): boolean | MessageSequence | writeBoolean(val: boolean): void |
| MessageParcel | writeChar(val: number): boolean | MessageSequence | writeChar(val: number): void |
| MessageParcel | writeString(val: string): boolean | MessageSequence | writeString(val: string): void |
| MessageParcel | writeSequenceable(val: Sequenceable): boolean | MessageSequence | writeParcelable(val: Parcelable): void |
| MessageParcel | writeByteArray(byteArray: number[]): boolean | MessageSequence | writeByteArray(byteArray: number[]): void |
| MessageParcel | writeShortArray(shortArray: number[]): boolean | MessageSequence | writeShortArray(shortArray: number[]): void |
| MessageParcel | writeIntArray(intArray: number[]): boolean | MessageSequence | writeIntArray(intArray: number[]): void |
| MessageParcel | writeLongArray(longArray: number[]): boolean | MessageSequence | writeLongArray(longArray: number[]): void |
| MessageParcel | writeFloatArray(floatArray: number[]): boolean | MessageSequence | writeFloatArray(floatArray: number[]): void |
| MessageParcel | writeDoubleArray(doubleArray: number[]): boolean | MessageSequence | writeDoubleArray(doubleArray: number[]): void |
| MessageParcel | writeBooleanArray(booleanArray: boolean[]): boolean | MessageSequence | writeBooleanArray(booleanArray: boolean[]): void |
| MessageParcel | writeCharArray(charArray: number[]): boolean | MessageSequence | writeCharArray(charArray: number[]): void |
| MessageParcel | writeStringArray(stringArray: string[]): boolean | MessageSequence | writeStringArray(stringArray: string[]): void |
| MessageParcel | writeSequenceableArray(sequenceableArray: Sequenceable[]): boolean | MessageSequence | writeParcelableArray(sequenceableArray: Parcelable[]): void |
| MessageParcel | writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean | MessageSequence | writeRemoteObjectArray(objectArray: IRemoteObject[]): void |
| MessageParcel | readByte(): number | MessageSequence | readByte(): number |
| MessageParcel | readShort(): number | MessageSequence | readShort(): number |
| MessageParcel | readLong(): number | MessageSequence | readLong(): number |
| MessageParcel | readFloat(): number | MessageSequence | readFloat(): number |
| MessageParcel | readDouble(): number | MessageSequence | readDouble(): number |
| MessageParcel | readBoolean(): boolean | MessageSequence | readBoolean(): boolean |
| MessageParcel | readChar(): number | MessageSequence | readChar(): number |
| MessageParcel | readString(): string | MessageSequence | readString(): string |
| MessageParcel | readSequenceable(dataIn: Sequenceable) : boolean | MessageSequence | readSequenceable(dataIn: Parcelable) : void |
| MessageParcel | readByteArray(dataIn: number[]) : void | MessageSequence | readByteArray(dataIn: number[]) : void |
| MessageParcel | readByteArray(): number[] | MessageSequence | readByteArray(): number[] |
| MessageParcel | readShortArray(dataIn: number[]) : void | MessageSequence | readShortArray(dataIn: number[]) : void |
| MessageParcel | readShortArray(): number[] | MessageSequence | readShortArray(): number[] |
| MessageParcel | readIntArray(dataIn: number[]) : void | MessageSequence | readIntArray(dataIn: number[]) : void |
| MessageParcel | readIntArray() : number[] | MessageSequence | readIntArray() : number[] |
| MessageParcel | readLongArray(dataIn: number[]) : void | MessageSequence | readLongArray(dataIn: number[]) : void |
| MessageParcel | readLongArray(): number[] | MessageSequence | readLongArray(): number[] |
| MessageParcel | readFloatArray(dataIn: number[]) : void | MessageSequence | readFloatArray(dataIn: number[]) : void |
| MessageParcel | readFloatArray(): number[] | MessageSequence | readFloatArray(): number[] |
| MessageParcel | readDoubleArray(dataIn: number[]) : void | MessageSequence | readDoubleArray(dataIn: number[]) : void |
| MessageParcel | readDoubleArray(): number[] | MessageSequence | readDoubleArray(): number[] |
| MessageParcel | readBooleanArray(dataIn: boolean[]) : void | MessageSequence | readBooleanArray(dataIn: boolean[]) : void |
| MessageParcel | readBooleanArray(): boolean[] | MessageSequence | readBooleanArray(): boolean[] |
| MessageParcel | readCharArray(dataIn: number[]) : void | MessageSequence | readCharArray(dataIn: number[]) : void |
| MessageParcel | readCharArray(): number[] | MessageSequence | readCharArray(): number[] |
| MessageParcel | readStringArray(dataIn: string[]) : void | MessageSequence | readStringArray(dataIn: string[]) : void |
| MessageParcel | readStringArray(): string[] | MessageSequence | readStringArray(): string[] |
| MessageParcel | readSequenceableArray(sequenceableArray: Sequenceable[]): void | MessageSequence | readSequenceableArray(sequenceableArray: Parcelable[]): void |
| MessageParcel | readRemoteObjectArray(objects: IRemoteObject[]): void | MessageSequence | readRemoteObjectArray(objects: IRemoteObject[]): void |
| MessageParcel | readRemoteObjectArray(): IRemoteObject[] | MessageSequence | readRemoteObjectArray(): IRemoteObject[] |
| MessageParcel | static closeFileDescriptor(fd: number): void | MessageSequence | static closeFileDescriptor(fd: number): void |
| MessageParcel | static dupFileDescriptor(fd: number) :number | MessageSequence | static dupFileDescriptor(fd: number) :number |
| MessageParcel | containFileDescriptors(): boolean | MessageSequence | containFileDescriptors(): boolean |
| MessageParcel | writeFileDescriptor(fd: number): boolean | MessageSequence | writeFileDescriptor(fd: number): void |
| MessageParcel | readFileDescriptor(): number | MessageSequence | readFileDescriptor(): number |
| MessageParcel | writeAshmem(ashmem: Ashmem): boolean | MessageSequence | writeAshmem(ashmem: Ashmem): void |
| MessageParcel | readAshmem(): Ashmem | MessageSequence | readAshmem(): Ashmem |
| MessageParcel | writeRawData(rawData: number[], size: number): boolean | MessageSequence | writeRawData(rawData: number[], size: number): void |
| MessageParcel | readRawData(size: number): number[] | MessageSequence | readRawData(size: number): number[] |
| Sequenceable | marshalling(dataOut: MessageParcel): boolean | Parcelable | marshalling(dataOut: MessageSequence): boolean |
| Sequenceable | unmarshalling(dataIn: MessageParcel) : boolean | Parcelable | unmarshalling(dataIn: MessageSequence) : boolean |
| SendRequestResult | errCode: number | RequestResult | errCode: number |
| SendRequestResult | code: number | RequestResult | code: number |
| SendRequestResult | data: MessageParcel | RequestResult | data: MessageSequence |
| SendRequestResult | reply: MessageParcel | RequestResult | reply: MessageSequence |
| IRemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker |
| IRemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string |
| IRemoteObject | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void |
| IRemoteObject | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void |
| IRemoteObject | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> |
| IRemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption,callback: AsyncCallback<RequestResult>): void |
| MessageOption | NA | NA | isAsync(): boolean |
| MessageOption | NA | NA | setAsync(async: boolean): void |
| MessageOption | NA | NA | constructor(async?: boolean) |
| RemoteObject | queryLocalInterface(descriptor: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker |
| RemoteObject | attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void | NA | modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void |
| RemoteObject | getInterfaceDescriptor(): string | NA | getDescriptor(): string |
| RemoteObject | onRemoteRequestEx(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean&nbsp;\|&nbsp;Promise<boolean> | NA | onRemoteMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): boolean&nbsp;\|&nbsp;Promise<boolean> |
| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise<SendRequestResult> | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> |
| RemoteObject | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void |
| RemoteProxy | queryLocalInterface(interface: string): IRemoteBroker | NA | getLocalInterface(descriptor: string): IRemoteBroker |
| RemoteProxy | getInterfaceDescriptor(): string | NA | getDescriptor(): string |
| RemoteProxy | addDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | registerDeathRecipient(recipient: DeathRecipient, flags: number): void |
| RemoteProxy | removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean | NA | unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void |
| RemoteProxy | NA | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> |
| RemoteProxy | sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void | NA | sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void |
| IPCSkeleton | static flushCommands(object: IRemoteObject): number | NA | static flushCmdBuffer(object: IRemoteObject): void |
| IPCSkeleton | static setCallingIdentity(identity: string): boolean | NA | static restoreCallingIdentity(identity: string): void |
| Ashmem | static createAshmem(name: string, size: number): Ashmem | NA | static create(name: string, size: number): Ashmem |
| Ashmem | static createAshmemFromExisting(ashmem: Ashmem): Ashmem | NA | static create(ashmem: Ashmem): Ashmem |
| Ashmem | mapAshmem(mapType: number): boolean | NA | mapTypedAshmem(mapType: number): void |
| Ashmem | mapReadAndWriteAshmem(): boolean | NA | mapReadWriteAshmem(): void |
| Ashmem | mapReadOnlyAshmem(): boolean | NA | mapReadonlyAshmem(): void |
| Ashmem | setProtection(protectionType: number): boolean | NA | setProtectionType(protectionType: number): void |
| Ashmem | writeToAshmem(buf: number[], size: number, offset: number): boolean | NA | writeAshmem(buf: number[], size: number, offset: number): void |
| Ashmem | readFromAshmem(size: number, offset: number): number[] | NA | readAshmem(size: number, offset: number): number[] |
#### Adaptation Guide
The newly added APIs return error codes and corresponding error information by throwing exceptions. Take the **create** API in **MessageParcel** as an example. The sample code is as follows:
```js
import rpc from '@ohos.rpc'
try {
var data = rpc.MessageParcel.create();
data.reclaim();
} catch (error) {
console.info("create meassageParcel failed, errorCode = " + error.errCode);
console.info("create meassageParcel failed, errorMessage = " + error.errorMessage);
}
```
For details about sample code of more APIs, see [RPC API reference](../../../application-dev/reference/apis/js-apis-rpc.md).
# File Management Subsystem ChangeLog
## cl.filemanagement.1 File I/O API Changes
The return value of file I/O APIs of **file_api** does not contain the error code. The original APIs are deprecated, and new APIs are added.
**Change Impacts**
For applications developed based on earlier versions, pay attention to the iterative update of discarded APIs. The specifications of the new APIs are slightly adjusted. Pay attention to the usage of the new APIs.
**Key API/Component Changes**
For the adaptation to the unified API exception handling mode, related file I/O APIs are deprecated, and corresponding new APIs are added. Original APIs are stored in **@ohos.fileio**, and the new ones are stored in **@ohos.file.fs**. The newly added APIs support unified error code handling specifications and function the same as the original APIs. The parameters are slightly adjusted.
| Module | Method/Attribute/Enumeration/Constant | Change Type|
| ------------- | ------------------------------------------------------------ | -------- |
| @ohos.fileio | **function** open(path: string, flags?: number, mode?: number, callback?: AsyncCallback<number>): void \| Promise<number>; | Deprecated |
| @ohos.fileio | **function** openSync(path: string, flags?: number, mode?: number): number; | Deprecated |
| @ohos.file.fs | **function** open(path: string, mode?: number, callback?: AsyncCallback<File>): void \| Promise<File>; | Added |
| @ohos.file.fs | **function** openSync(path: string, mode?: number): File; | Added |
| @ohos.fileio | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback<ReadOut>): void \| Promise<ReadOut>; | Deprecated |
| @ohos.fileio | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number; | Deprecated |
| @ohos.file.fs | **function** read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback<number>): void \| Promise<number>; | Added |
| @ohos.file.fs | **function** readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number; | Added |
| @ohos.fileio | **function** stat(path: string, callback?: AsyncCallback<Stat>): void \| Promise<Stat>; | Deprecated |
| @ohos.fileio | **function** statSync(path: string): Stat; | Deprecated |
| @ohos.fileio | **function** fstat(fd: number, callback?: AsyncCallback<Stat>): void \| Promise<Stat>; | Deprecated |
| @ohos.fileio | **function** fstatSync(fd: number): Stat; | Deprecated |
| @ohos.file.fs | **function** stat(file: string \| number, callback?: AsyncCallback<Stat>): void \| Promise<Stat>; | Added |
| @ohos.file.fs | **function** statSync(file: string \| number): Stat; | Added |
| @ohos.fileio | **function** truncate(path: string, len?: number, callback?: AsyncCallback<void>): void \| Promise<void>; | Deprecated |
| @ohos.fileio | **function** truncateSync(path: string, len?: number): void; | Deprecated |
| @ohos.fileio | **function** ftruncate(fd: number, len?: number, callback?: AsyncCallback<void>): void \| Promise<void>; | Deprecated |
| @ohos.fileio | **function** ftruncateSync(fd: number, len?: number): void; | Deprecated |
| @ohos.file.fs | **function** truncate(file: string \| number, len?: number, callback?: AsyncCallback<void>): void \| Promise<void>; | Added |
| @ohos.file.fs | **function** truncateSync(file: string \| number, len?: number): void; | Added |
| @ohos.fileio | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback<number>): void \| Promise<void>; | Deprecated |
| @ohos.fileio | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number; | Deprecated |
| @ohos.file.fs | **function** write(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<number>): void \| Promise<void>; | Added |
| @ohos.file.fs | **function** writeSync(fd: number, buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number; | Added |
**Adaptation Guide**
The original APIs use **@ohos.fileio**, which is imported as follows:
```js
import fileio from '@ohos.fileio';
```
The new APIs use **@ohos.file.fs**, which is imported as follows:
```js
import fs from '@ohos.file.fs';
```
In addition, exception handling needs to be adapted. Sample code for synchronous API exception handling is as follows:
```js
import fs from '@ohos.file.fs'
try {
let file = fs.openSync(path, fs.OpenMode.READ_ONLY);
} catch (err) {
console.error("openSync errCode:" + err.code + ", errMessage:" + err.message);
}
```
Sample code for handling exceptions of the **promise** method of an asynchronous API:
```js
import fs from '@ohos.file.fs'
try {
let file = await fs.open(path, fs.OpenMode.READ_ONLY);
} catch (err) {
console.error("open promise errCode:" + err.code + ", errMessage:" + err.message);
}
```
Sample code for handling exceptions of the **callback** method of an asynchronous API:
```js
import fs from '@ohos.file.fs'
try {
fs.open(path, fs.OpenMode.READ_ONLY, function(e, file){ // Asynchronous thread (such as system call) errors are obtained from the callback.
if (e) {
console.error("open in async errCode:" + e.code + ", errMessage:" + e.message);
}
});
} catch (err) {// Errors (such as invalid parameters) of the main thread are obtained through try catch.
console.error("open callback errCode:" + err.code + ", errMessage:" + err.message);
}
```
# Globalization Subsystem ChangeLog
## cl.global.1 Support of Error Codes for the Internalization Module
APIs provided by the internationalization component of the globalization subsystem are changed to support error codes in the following scenarios. The following changes are made in API version 9 and later:
- Obtaining the local expression of a country or language
- Obtaining the list of languages supported by the system and the list of areas supported by a language
- Checking whether a language matches an area
- Obtaining and setting the system language, country or region, and area
- Obtaining and setting the 24-hour format of the system
- Obtaining, adding, and removing the preferred language
- Obtaining and setting localized numbers
You need to adapt your applications based on the following information:
**Change Impacts**
The preceding APIs are changed to the static methods of the **System** class. When such an API is called, add the class name to the end of the module name.
The return value data type of the setting APIs (for example, **setSystemLanguage**) is changed from boolean to void.
When a call to an API fails, an error code is returned according to the failure cause. For example, when permissions are not correctly configured for an application, **201** is returned.
**Key API/Component Changes**
Involved APIs:
- getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;
- getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;
- getSystemLanguages(): Array<string>;
- getSystemCountries(language: string): Array<string>;
- isSuggested(language: string, region?: string): boolean;
- getSystemLanguage(): string;
- setSystemLanguage(language: string): void;
- getSystemRegion(): string;
- setSystemRegion(region: string): void;
- getSystemLocale(): string;
- setSystemLocale(locale: string): void;
- is24HourClock(): boolean;
- set24HourClock(option: boolean): void;
- addPreferredLanguage(language: string, index?: number): void;
- removePreferredLanguage(index: number): void;
- getPreferredLanguageList(): Array<string>;
- getFirstPreferredLanguage(): string;
- getAppPreferredLanguage(): string;
- setUsingLocalDigit(flag: boolean): void;
- getUsingLocalDigit(): boolean;
**Adaptation Guide**
Use the **try-catch** block to capture errors returned by an API.
```
import I18n from '@ohos.i18n'
try {
I18n.System.setSystemLanguage('zh');
} catch(error) {
console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`)
}
```
# Input Method Framework ChangeLog
## cl.inputmethod_frameworks.1 API Error Information Return Method Change
The internal APIs of the following modules used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.
- Input method framework module: system API, @ohos.inputmethod.d.ts
- Input method service module: system API, @ohos.inputmethodengine.d.ts
- Input method ExtentionAbility module: system API, @ohos.inputmethodextensionability.d.ts
- Input method ExtentionContext module: system API, @ohos.inputmethodextensioncontext.d.ts
- Input method subtype module: system API, @ohos.inputMethodSubtype.d.ts
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Error code processing is added for the following APIs:
- getSetting(): InputMethodSetting;
- getController(): InputMethodController;
- switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolean>): void;
- switchInputMethod(target: InputMethodProperty): Promise<boolean>;
- switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback<boolean>): void;
- switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean>;
- switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback<boolean>): void;
- switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise<boolean>;
- listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback<Array<InputMethodSubtype>>): void;
- listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Array<InputMethodSubtype>>;
- listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSubtype>>): void;
- listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>;
- getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
- getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
- showOptionalInputMethods(callback: AsyncCallback<boolean>): void;
- showOptionalInputMethods(): Promise<boolean>;
- stopInputSession(callback: AsyncCallback<boolean>): void;
- stopInputSession(): Promise<boolean>;
- showSoftKeyboard(callback: AsyncCallback<void>): void;
- showSoftKeyboard():Promise<void>;
- hideSoftKeyboard(callback: AsyncCallback<void>): void;
- hideSoftKeyboard():Promise<void>;
- hide(callback: AsyncCallback<void>): void;
- hide(): Promise<void>;
- onCreate(want: Want): void;
- onDestroy(): void;
In **InputClient**:
- sendKeyFunction(action: number, callback: AsyncCallback<boolean>): void;
- sendKeyFunction(action: number): Promise<boolean>;
- deleteForward(length: number, callback: AsyncCallback<boolean>): void;
- deleteForward(length: number): Promise<boolean>;
- deleteBackward(length: number, callback: AsyncCallback<boolean>): void;
- deleteBackward(length: number): Promise<boolean>;
- insertText(text: string, callback: AsyncCallback<boolean>): void;
- insertText(text: string): Promise<boolean>;
- getForward(length: number, callback: AsyncCallback<string>): void;
- getForward(length: number): Promise<string>;
- getBackward(length: number, callback: AsyncCallback<string>): void;
- getBackward(length: number): Promise<string>;
- getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void;
- getEditorAttribute(): Promise<EditorAttribute>;
- moveCursor(direction: number, callback: AsyncCallback<void>): void;
- moveCursor(direction: number): Promise<void>;
In **InputMethodExtensionAbility**:
- onCreate(want: Want): void;
- onDestroy(): void;
**Adaptation Guide**
The following uses **showOptionalInputMethods** as an example for asynchronous APIs:
Callback mode:
```js
import inputMethod from '@ohos.inputmethod';
let inputMethodSetting = inputMethod.getSetting();
try {
inputMethodSetting.showOptionalInputMethods((err, data) => {
if (err !== undefined) {
console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
return;
}
console.info('Succeeded in showing optionalInputMethods.');
});
} catch (err) {
console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
}
```
Promise mode:
```js
import inputMethod from '@ohos.inputmethod';
let inputMethodSetting = inputMethod.getSetting();
inputMethodSetting.showOptionalInputMethods().then((data) => {
console.info('Succeeded in showing optionalInputMethods.');
}).catch((err) => {
console.error('Failed to showOptionalInputMethods: ' + JSON.stringify(err));
})
```
## cl.inputmethod_frameworks.2 Deprecation of Some APIs
Deprecated APIs:
- getInputMethodSetting(): InputMethodSetting;
- getInputMethodController(): InputMethodController;
- listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>): void;
- listInputMethod(): Promise<Array<InputMethodProperty>>;
- displayOptionalInputMethod(callback: AsyncCallback<void>): void;
- displayOptionalInputMethod(): Promise<void>;
- stopInput(callback: AsyncCallback<boolean>): void;
- stopInput(): Promise<boolean>;
interface InputMethodProperty:
- readonly packageName: string;
- readonly methodId: string;
- getInputMethodEngine(): InputMethodEngine;
- createKeyboardDelegate(): KeyboardDelegate;
- hideKeyboard(callback: AsyncCallback<void>): void;
- hideKeyboard(): Promise<void>;
Substitute APIs:
- getSetting(): InputMethodSetting;
- getController(): InputMethodController;
- getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
- getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
- showOptionalInputMethods(callback: AsyncCallback<boolean>): void;
- showOptionalInputMethods(): Promise<boolean>;
- stopInputSession(callback: AsyncCallback<boolean>): void;
- stopInputSession(): Promise<boolean>;
interface InputMethodProperty:
- readonly name: string;
- readonly id: string;
- getInputMethodAbility(): InputMethodAbility;
- getKeyboardDelegate(): KeyboardDelegate;
- hide(callback: AsyncCallback<void>): void;
- hide(): Promise<void>;
**NOTE**
- Use the **getInputMethodAbility()** API to obtain an **InputMethodAbility** object, and do not use **getInputMethodEngine()** to obtain an **InputMethodEngine** object.
- Use methods in **InputMethodAbility**, and do not use methods in **InputMethodEngine**.
- Use the **on('inputStart')** method in **InputMethodAbility** to obtain a **KeyboardController** instance and an **InputClient** instance, and do not use the **on('inputStart')** method in **InputMethodEngine** to obtain a **TextInputClient** instance.
Before:
```js
inputMethodEngine.getInputMethodEngine().on('inputStart', (kbController, textClient) => {
let keyboardController = kbController;
let textInputClient = textClient; // Obtain a TextInputClient instance.
});
```
After:
```js
inputMethodEngine.getInputMethodAbility().on('inputStart', (kbController, client) => {
let keyboardController = kbController;
let inputClient = client; // // Obtain an InputClient instance.
});
```
## cl.inputmethod_frameworks.3 Change of Some APIs
Before change:
- listInputMethod(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
- listInputMethod(enable: boolean): Promise<Array<InputMethodProperty>>;
- terminateSelf(callback: AsyncCallback<void>): void;
- terminateSelf(): Promise<void>;
After change:
- getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
- getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
- destroy(callback: AsyncCallback<void>): void;
- destroy(): Promise<void>;
Deleted APIs in API version 9:
- startAbility(want: Want, callback: AsyncCallback<void>): void;
- startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
- startAbility(want: Want, options?: StartOptions): Promise<void>;
Added APIs:
- on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;
- off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;
- interface InputMethodProperty:
- readonly label?: string;
- readonly icon?: string;
- readonly iconId?: number;
- extra: object;
- interface InputMethodAbility:
- on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;
- off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;
# Multimodal Input ChangeLog
## cl.multimodalinput.1 Error Information Return Method Change of APIs
The internal APIs of the following modules used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.
- Input device management module (**@ohos.multimodalInput.inputDevice.d.ts**): third-party APIs
- Input consumer module (**@ohos.multimodalInput.inputConsumer.d.ts**): system APIs
- Screen hopping module (**@ohos.multimodalInput.inputDeviceCooperate.d.ts**): system APIs
- Key injection module (**@ohos.multimodalInput.inputEventClient.d.ts**): system APIs
- Input listening module (**@ohos.multimodalInput.inputMonitor.d.ts**): system APIs
- Mouse pointer module (**@ohos.multimodalInput.pointer.d.ts**): system APIs and third-party APIs
Asynchronous APIs in the preceding modules have the following changes: A parameter check error is returned synchronously; a service logic error is returned via **AsyncCallback** or the **error** object of **Promise**. No change is made to synchronous APIs.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback&lt;Array&lt;boolean&gt;&gt;): void;
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;boolean&gt;&gt;;
- getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void; &gt;
- getKeyboardType(deviceId: number): Promise&lt;KeyboardType&gt;;
- setPointerSpeed(speed: number, callback: AsyncCallback&lt;void&gt;): void;
- setPointerSpeed(speed: number): Promise&lt;void&gt;;
- getPointerSpeed(callback: AsyncCallback&lt;number&gt;): void;
- getPointerSpeed(): Promise&lt;number&gt;;
- setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback&lt;void&gt;): void;
- setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise&lt;void&gt;;
- getPointerStyle(windowId: number, callback: AsyncCallback&lt;PointerStyle&gt;): void;
- getPointerStyle(windowId: number): Promise&lt;PointerStyle&gt;;
- setPointerVisible(visible: boolean, callback: AsyncCallback&lt;void&gt;): void;
- setPointerVisible(visible: boolean): Promise&lt;void&gt;;
- isPointerVisible(callback: AsyncCallback&lt;boolean&gt;): void;
- isPointerVisible(): Promise&lt;boolean&gt;;
- on(type:"touch", receiver:TouchEventReceiver):void;
- on(type:"mouse", receiver:Callback&lt;MouseEvent&gt;):void;
- off(type:"touch", receiver?:TouchEventReceiver):void;
- off(type:"mouse", receiver?:Callback&lt;MouseEvent&gt;):void;
- injectEvent({KeyEvent: KeyEvent}): void;
- enable(enable: boolean, callback: AsyncCallback&lt;void&gt;): void;
- enable(enable: boolean): Promise&lt;void&gt;;
- start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback&lt;void&gt;): void;
- start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise&lt;void&gt;;
- stop(callback: AsyncCallback&lt;void&gt;): void;
- stop(): Promise&lt;void&gt;;
- getState(deviceDescriptor: string, callback: AsyncCallback&lt;{ state: boolean }&gt;): void;
- getState(deviceDescriptor: string): Promise&lt;{ state: boolean }&gt;;
- on(type: 'cooperation', callback: AsyncCallback&lt;{ deviceDescriptor: string, eventMsg: EventMsg }&gt;): void;
- off(type: 'cooperation', callback?: AsyncCallback&lt;void&gt;): void;
- on(type: "key", keyOptions: KeyOptions, callback: Callback&lt;KeyOptions&gt;): void;
- off(type: "key", keyOptions: KeyOptions, callback?: Callback&lt;KeyOptions&gt;): void;
Deprecated APIs:
- getDeviceIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void;
- getDeviceIds(): Promise&lt;Array&lt;number&gt;&gt;;
- getDevice(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void;
- getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;;
Substitute APIs:
- getDeviceList(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void;
- getDeviceList(): Promise&lt;Array&lt;number&gt;&gt;;
- getDeviceInfo(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void;
- getDeviceInfo(deviceId: number): Promise&lt;InputDeviceData&gt;;
Changed APIs:
Before change:
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: Callback&lt;Array&lt;boolean&gt;&gt;): void;
- getKeyboardType(deviceId: number, callback: Callback&lt;KeyboardType&gt;): void;
After change:
- supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback&lt;Array&lt;boolean&gt;&gt;): void;
- getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void;
**Adaptation Guide**
The following uses **setPointerVisible** as an example:
```ts
import pointer from '@ohos.multimodalInput.pointer';
pointer.setPointerVisible(true, (error) => {
console.log(`Set pointer visible success`);
});
try {
pointer.setPointerVisible(true, (error) => {
if (error) {
console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Set pointer visible success`);
});
} catch (error) {
console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
# Power Subsystem ChangeLog
## cl.powermgr.1 Error Information Return Method Change of APIs
The following APIs used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.
- Power consumption statistics: [@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md)
- Brightness: [@ohos.brightness](../../../application-dev/reference/apis/js-apis-brightness.md)
- Power manager: [@ohos.power](../../../application-dev/reference/apis/js-apis-power.md)
- RunningLock: [@ohos.runningLock](../../../application-dev/reference/apis/js-apis-runninglock.md)
- Thermal manager: [@ohos.thermal](../../../application-dev/reference/apis/js-apis-thermal.md)
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
#### Change Impacts
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
#### Key API/Component Changes
Error code processing is added for the following APIs:
- getBatteryStats(callback: AsyncCallback<Array&lt;BatteryStatsInfo&gt;>): void
- getAppPowerValue(uid: number): number
- getAppPowerPercent(uid: number): number
- getHardwareUnitPowerValue(type: ConsumptionType): number
- getHardwareUnitPowerPercent(type: ConsumptionType): number
- setValue(value: number): void
- shutdown(reason: string): void;
- isActive(): boolean
- wakeup(detail: string): void
- suspend(): void
- getPowerMode(): DevicePowerMode
- setPowerMode(mode: DevicePowerMode, callback: AsyncCallback&lt;void&gt;): void
- setPowerMode(mode: DevicePowerMode): Promise&lt;void&gt;
- hold(timeout: number): void
- isHolding(): boolean
- unhold(): void
- isSupported(type: RunningLockType): boolean
- isSupported(type: RunningLockType): boolean
- create(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLock&gt;): void
- create(name: string, type: RunningLockType): Promise&lt;RunningLock&gt;
- registerThermalLevelCallback(callback: Callback&lt;ThermalLevel&gt;): void
- unregisterThermalLevelCallback(callback?: Callback&lt;void&gt;): void
- getLevel(): ThermalLevel
#### Adaptation Guide
For details, see the API reference document of each API.
## cl.powermgr.2 System API Change
#### Change Impacts
The application developed based on earlier versions needs to adapt to new API names and the new method for returning API error information. Otherwise, the original service logic will be affected.
#### Key API/Component Changes
| Bundle Name | Original API | New API |
| ----------- | ------------------------------------ | ------------------------------ |
| @ohos.power | shutdownDevice(reason: string): void | shutdown(reason: string): void |
| @ohos.power | rebootDevice(reason: string): void | reboot(reason: string): void |
| @ohos.power | wakeupDevice(detail: string): void | wakeup(detail: string): void |
| @ohos.power | suspendDevice(): void | suspend(): void |
#### Adaptation Guide
For details, see [@ohos.power](../../../application-dev/reference/apis/js-apis-power.md).
# Upload and Download Subsystem ChangeLog
Compared with OpenHarmony 3.2 Beta3, OpenHarmony 3.2.8.1 has the following changes in its upload and download subsystem:
## cl.request.1 Changes of Error Code Definitions and Some API Names
- The processing of the [upload and download error codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-request.md) is added to the upload and download APIs.
- An error message is returned via **AsyncCallback** or the **error** object of **Promise**. An error message related to the parameter type or quantity is returned via an exception.
- Some APIs need to be replaced with new APIs, and the parameters remain unchanged.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| -------------- | -------------------------- | ------------------------------------------------------------ | -------- |
| ohos.request | request | EXCEPTION_PERMISSION | Added |
| ohos.request | request | EXCEPTION_PARAMCHECK | Added |
| ohos.request | request | EXCEPTION_UNSUPPORTED | Added |
| ohos.request | request | EXCEPTION_FILEIO | Added |
| ohos.request | request | EXCEPTION_FILEPATH | Added |
| ohos.request | request | EXCEPTION_SERVICE | Added |
| ohos.request | request | EXCEPTION_OTHERS | Added |
| ohos.request | request | ERROR_OFFLINE | Added |
| ohos.request | request | ERROR_UNSUPPORTED_NETWORK_TYPE | Added |
| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void; | Added |
| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>; | Added |
| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void; | Added |
| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>; | Added |
| ohos.request | DownloadTask | delete(callback: AsyncCallback<boolean>): void; | Added |
| ohos.request | DownloadTask | delete(): Promise<boolean>; | Added |
| ohos.request | DownloadTask | suspend(callback: AsyncCallback<boolean>): void; | Added |
| ohos.request | DownloadTask | suspend(): Promise<boolean>; | Added |
| ohos.request | DownloadTask | restore(callback: AsyncCallback<boolean>): void; | Added |
| ohos.request | DownloadTask | restore(): Promise<boolean>; | Added |
| ohos.request | DownloadTask | getTaskInfo(callback: AsyncCallback<DownloadInfo>): void; | Added |
| ohos.request | DownloadTask | getTaskInfo(): Promise<DownloadInfo>; | Added |
| ohos.request | DownloadTask | getTaskMimeType(callback: AsyncCallback<string>): void; | Added |
| ohos.request | DownloadTask | getTaskMimeType(): Promise<string>; | Added |
| ohos.request | UploadTask | delete(callback: AsyncCallback<boolean>): void; | Added |
| ohos.request | UploadTask | delete(): Promise<boolean>; | Added |
| ohos.request | request | function download(config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;<br>Substitute API: function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;| Deprecated |
| ohos.request | request | function download(config: DownloadConfig): Promise<DownloadTask>;<br>Substitute API: function downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>; | Deprecated |
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;<br>Substitute API: function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void; | Deprecated |
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>;<br>Substitute API: function downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>; | Deprecated |
| ohos.request | request | function upload(config: UploadConfig, callback: AsyncCallback<UploadTask>): void;<br>Substitute API: function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void; | Deprecated |
| ohos.request | request | function upload(config: UploadConfig): Promise<UploadTask>;<br>Substitute API: function uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>; | Deprecated |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void;<br>Substitute API: function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void; | Deprecated |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise<UploadTask>;<br>Substitute API: function uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>; | Deprecated |
| ohos.request | DownloadTask | remove(callback: AsyncCallback<boolean>): void;<br>Substitute API: delete(callback: AsyncCallback<boolean>): void | Deprecated |
| ohos.request | DownloadTask | remove(): Promise<boolean>;<br>Substitute API: delete(): Promise<boolean>; | Deprecated |
| ohos.request | DownloadTask | pause(callback: AsyncCallback<boolean>): void;<br>Substitute API: suspend(callback: AsyncCallback<boolean>): void; | Deprecated |
| ohos.request | DownloadTask | pause(): Promise<boolean>;<br>Substitute API: suspend(): Promise<boolean>; | Deprecated |
| ohos.request | DownloadTask | resume(callback: AsyncCallback<boolean>): void;<br>Substitute API: restore(callback: AsyncCallback<boolean>): void; | Deprecated |
| ohos.request | DownloadTask | resume(): Promise<boolean>;<br>Substitute API: restore(): Promise<boolean>; | Deprecated |
| ohos.request | DownloadTask | query(callback: AsyncCallback<DownloadInfo>): void;<br>Substitute API: getTaskInfo(callback: AsyncCallback<DownloadInfo>): void; | Deprecated |
| ohos.request | DownloadTask | query(): Promise<DownloadInfo>;<br>Substitute API: getTaskInfo(): Promise<DownloadInfo>; | Deprecated |
| ohos.request | DownloadTask | queryMimeType(callback: AsyncCallback<string>): void;<br>Substitute API: getTaskMimeType(callback: AsyncCallback<string>): void; | Deprecated |
| ohos.request | DownloadTask | queryMimeType(): Promise<string>;<br>Substitute API: getTaskMimeType(): Promise<string>; | Deprecated |
| ohos.request | UploadTask | remove(callback: AsyncCallback<boolean>): void;<br>Substitute API: delete(callback: AsyncCallback<boolean>): void; | Deprecated |
| ohos.request | UploadTask | remove(): Promise<boolean>;<br>Substitute API: delete(): Promise<boolean>; | Deprecated |
| system.request | UploadResponse | code | Deprecated |
| system.request | UploadResponse | data | Deprecated |
| system.request | UploadResponse | headers | Deprecated |
| system.request | DownloadResponse | token | Deprecated |
| system.request | OnDownloadCompleteResponse | uri | Deprecated |
| system.request | RequestFile | filename | Deprecated |
| system.request | RequestFile | name | Deprecated |
| system.request | RequestFile | uri | Deprecated |
| system.request | RequestFile | type | Deprecated |
| system.request | RequestData | name | Deprecated |
| system.request | RequestData | value | Deprecated |
| system.request | UploadRequestOptions | url | Deprecated |
| system.request | UploadRequestOptions | data | Deprecated |
| system.request | UploadRequestOptions | files | Deprecated |
| system.request | UploadRequestOptions | header | Deprecated |
| system.request | UploadRequestOptions | description | Deprecated |
| system.request | UploadRequestOptions | success | Deprecated |
| system.request | UploadRequestOptions | fail | Deprecated |
| system.request | UploadRequestOptions | complete | Deprecated |
| system.request | OnDownloadCompleteOptions | token | Deprecated |
| system.request | OnDownloadCompleteOptions | success | Deprecated |
| system.request | OnDownloadCompleteOptions | fail | Deprecated |
| system.request | OnDownloadCompleteOptions | complete | Deprecated |
| system.request | Request | static upload(options: UploadRequestOptions): void; | Deprecated |
| system.request | Request | static download(options: DownloadRequestOptions): void; | Deprecated |
| system.request | Request | static onDownloadComplete(options: OnDownloadCompleteOptions): void; | Deprecated |
**Adaptation Guide**
The following uses **downloadFile** as an example to show how it is called in the new version:
```ts
try {
request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap',
filePath: 'xxx/xxxxx.hap'}, (err, data) => {
if (err) {
console.error('Failed to request the download. Cause: ' + JSON.stringify(err));
return;
}
});
} catch (err) {
console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message);
}
```
# Resource Manager ChangeLog
## cl.resourceManager.1 Name Change of Some Multi-Project APIs in API Version 9 of Resource Manager
The resource manager can return error codes and error information for APIs in API version 9 and later. Some multi-project APIs in API version 9 need to be adapted. The following changes are made in API version 9 and later:
Some multi-project APIs of the resource manager need to be replaced with new APIs, and the parameters remain unchanged.
**Change Impacts**
For applications developed based on earlier versions, relevant JavaScript multi-project APIs need to be replaced with new APIs.
**Key API/Component Changes**
| **Original API** | **New API**|
| ---------------- | ------------ |
| getString(resource: Resource, <br>callback: AsyncCallback\<string>): void; | getStringValue(resource: Resource, <br>callback: AsyncCallback\<string>): void; |
| getString(resource: Resource): Promise\<string>; | getStringValue(resource: Resource): Promise\<string>; |
| getStringArray(resource: Resource, <br>callback: AsyncCallback\<Array\<string>>): void; | getStringArrayValue(resource: Resource, <br>callback: AsyncCallback\<Array\<string>>): void; |
| getStringArray(resource: Resource): Promise\<Array\<string>>; | getStringArrayValue(resource: Resource): Promise\<Array\<string>>; |
| getMedia(resource: Resource, <br>callback: AsyncCallback\<Uint8Array>): void; | getMediaContent(resource: Resource, <br>callback: AsyncCallback\<Uint8Array>): void; |
| getMedia(resource: Resource): Promise\<Uint8Array>; | getMediaContent(resource: Resource): Promise\<Uint8Array>; |
| getMediaBase64(resource: Resource, <br>callback: AsyncCallback\<string>): void; | getMediaContentBase64(resource: Resource, <br>callback: AsyncCallback\<string>): void; |
| getMediaBase64(resource: Resource): Promise\<string>; | getMediaContentBase64(resource: Resource): Promise\<string>; |
| getPluralString(resource: Resource, num: number, <br>callback: AsyncCallback<string>): void; | getPluralStringValue(resource: Resource, num: number, <br>callback: AsyncCallback\<string>): void; |
| getPluralString(resource: Resource, num: number): Promise\<string>; | getPluralStringValue(resource: Resource, num: number): Promise\<string>; |
**Adaptation Guide**
The following describes how to change **getMedia** to **getMediaContent** in callback mode. The promise mode is similar. You only need to change the function name, add the error code and error information, and keep other information unchanged. The sample code is as follows:
- Before the change: **getMedia(resource: Resource, callback: AsyncCallback<Uint8Array>): void;**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
this.context.resourceManager.getMedia(resource, (error, value) => {
if (error != null) {
console.log("error is " + error);
} else {
let media = value;
}
});
```
- After the change: **getMediaContent(resource: Resource, callback: AsyncCallback<Uint8Array>): void;**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
try {
this.context.resourceManager.getMediaContent(resource, (error, value) => {
if (error != null) {
console.log("error is " + error);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`)
}
```
# Theme Framework ChangeLog
## cl.theme.1 Support of Exception Handling for APIs in API Version 9
The internal APIs of the following modules used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.
- Wallpaper management service: **@ohos.wallpaper.d.ts**
- Lock screen management service: **@ohos.screenLock.d.ts**
APIs in the preceding modules are changed as follows:
Synchronous API: An error message is returned via an exception.
Asynchronous API: A parameter check error is returned synchronously. A service logic error is returned via **AsyncCallback** or the **error** object of **Promise**.
**Change Impacts**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Deprecated APIs of the wallpaper management service:
- getColors(wallpaperType: WallpaperType, callback: AsyncCallback<Array<RgbaColor>>): void;
- getColors(wallpaperType: WallpaperType): Promise<Array<RgbaColor>>;
- getId(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void;
- getId(wallpaperType: WallpaperType): Promise<number>;
- getMinHeight(callback: AsyncCallback<number>): void;
- getMinHeight(): Promise<number>;
- getMinWidth(callback: AsyncCallback<number>): void;
- getMinWidth(): Promise<number>;
- isChangePermitted(callback: AsyncCallback<boolean>): void;
- isChangePermitted(): Promise<boolean>;
- isOperationAllowed(callback: AsyncCallback<boolean>): void;
- isOperationAllowed(): Promise<boolean>;
- reset(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
- reset(wallpaperType: WallpaperType): Promise<void>;
- setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
- setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
- getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void;
- getFile(wallpaperType: WallpaperType): Promise<number>;
- getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void;
- getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap>;
Substitute APIs of the wallpaper management service:
- getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>;
- getIdSync(wallpaperType: WallpaperType): number;
- getMinHeightSync(): number;
- getMinWidthSync(): number;
- isChangeAllowed(): boolean;
- isUserChangeAllowed(): boolean;
- restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
- restore(wallpaperType: WallpaperType): Promise<void>;
- setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void;
- setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>;
- getFileSync(wallpaperType: WallpaperType): number;
- getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void;
- getImage(wallpaperType: WallpaperType): Promise<image.PixelMap>;
Changed APIs of the wallpaper management service:
- on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void
- off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void
Deprecated APIs of the lock screen management service:
- isScreenLocked(callback: AsyncCallback<boolean>): void;
- isScreenLocked(): Promise<boolean>;
- isSecureMode(callback: AsyncCallback<boolean>): void;
- isSecureMode(): Promise<boolean>;
- unlockScreen(callback: AsyncCallback<void>): void;
- unlockScreen(): Promise<void>;
Substitute APIs of the lock screen management service:
- isLocked(): boolean;
- isSecure(): boolean;
- unlock(callback: AsyncCallback<boolean>): void;
- unlock():Promise<boolean>;
Deleted APIs of the lock screen management service:
- lockScreen(callback: AsyncCallback<void>): void;
- lockScreen(): Promise<void>;
The following APIs are added for the lock screen management service:
- lock(callback: AsyncCallback<boolean>): void;
- lock():Promise<boolean>;
Changed APIs of the lock screen management service:
- onSystemEvent(callback: Callback<SystemEvent>): boolean;
- sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<boolean>): void;
- sendScreenLockEvent(event: String, parameter: number): Promise<boolean>;
**Adaption Guide for the Wallpaper Management Service**
The following uses **getImage** as an example for asynchronous APIs:
```ts
import pointer from '@ohos.wallpaper';
try {
wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to getImage: ${JSON.stringify(data)}`);
}).catch((error) => {
console.error(`failed to getImage because: ${JSON.stringify(error)}`);
});
} catch (err) {
console.error(`failed to getImage because: ${JSON.stringify(err)}`);
}
```
The following uses **getFileSync** as an example for synchronous APIs:
```ts
import pointer from '@ohos.wallpaper';
try {
let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM);
} catch (err) {
console.error(`failed to getFileSync because: ${err.message}`);
}
```
**Adaption Guide for the Lock Screen Management Service**
The following uses **lock** as an example for asynchronous APIs:
```ts
import screenLock from '@ohos.screenlock';
try {
screenLock.lock((err, data) => {
if (err) {
console.error(`Failed to lock the screen, because: ${err.message}`);
return;
}
console.info(`lock the screen successfully. result: ${data}`);
});
} catch (err) {
console.error(`Failed to lock the screen, because: ${err.message}`);
}
```
The following uses **onSystemEvent** as an example for synchronous APIs:
```ts
import screenLock from '@ohos.screenlock';
try {
let isSuccess = screenLock.onSystemEvent((event) => {
console.log(`Register the system event which related to screenlock successfully. eventType: ${event.eventType}`)
});
} catch (err) {
console.error(`Failed to register the system event which related to screenlock, because: ${err.message}`)
}
```
# Distributed Scheduler Subsystem ChangeLog
## cl.DistributedManagerService.1 continuationManager API Changes
- Event names passed to the **continuationManager** API do not comply with the OpenHarmony API specifications.
- The **continuationManager.on** API does not have a unified return value for various events, which does not comply with the OpenHarmony API specifications.
The following changes have been made:
- The device selection event name of **continuationManager.on** and **continuationManager.off** is changed from **deviceConnect** to **deviceSelected**, and the device deselection event name is changed from **deviceDisconnect** to **deviceUnselected**.
- The **continuationManager.on** API returns **Callback&lt;Array&lt;ContinuationResult&gt;&gt;** for all events.
**Change Impacts**
The application developed based on earlier versions needs to adapt the new APIs. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
- Involved APIs:
continuationManager.on;
continuationManager.off;
- Before change:
```js
function on(type: "deviceConnect", token: number, callback: Callback<Array<ContinuationResult>>): void;
function off(type: "deviceConnect", token: number): void;
function on(type: "deviceDisconnect", token: number, callback: Callback<Array<string>>): void;
function off(type: "deviceDisconnect", token: number): void;
```
- After change:
```js
function on(type: "deviceSelected", token: number, callback: Callback<Array<ContinuationResult>>): void;
function off(type: "deviceSelected", token: number): void;
function on(type: "deviceUnselected", token: number, callback: Callback<Array<ContinuationResult>>): void;
function off(type: "deviceUnselected", token: number): void;
```
**Adaptation Guide**
Change the event names. The sample code is as follows:
Device selection event of **continuationManager.on**:
```ts
let token = 1;
try {
continuationManager.on("deviceSelected", token, (data) => {
console.info('onDeviceSelected len: ' + data.length);
for (let i = 0; i < data.length; i++) {
console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id));
console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type));
console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name));
}
});
} catch (err) {
console.error('on failed, cause: ' + JSON.stringify(err));
}
```
Device selection event of **continuationManager.off**:
```ts
let token = 1;
try {
continuationManager.off("deviceSelected", token);
} catch (err) {
console.error('off failed, cause: ' + JSON.stringify(err));
}
```
Device deselection event of **continuationManager.on**:
```ts
let token = 1;
try {
continuationManager.on("deviceUnselected", token, (data) => {
console.info('onDeviceUnselected len: ' + data.length);
for (let i = 0; i < data.length; i++) {
console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id));
console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type));
console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name));
}
console.info('onDeviceUnselected finished.');
});
} catch (err) {
console.error('on failed, cause: ' + JSON.stringify(err));
}
```
Device deselection event of **continuationManager.off**:
```ts
let token = 1;
try {
continuationManager.off("deviceUnselected", token);
} catch (err) {
console.error('off failed, cause: ' + JSON.stringify(err));
}
```
# Wi-Fi Subsystem ChangeLog
## cl.wifi.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManager.d.ts
**@ohos.wifi.d.ts** does not allow for throwing error codes, which is required by API version 9 and the system APIs. Therefore, all system APIs and APIs in API version 9 of **@ohos.wifi.d.ts** are migrated to the newly added **@ohos.wifiManager.d.ts**, and error code description is also added.
Import **@ohos.wifiManager.d.ts**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
import wifiManager from '@ohos.wifiManager';
**Change Impacts**
System APIs and APIs in API version 9 are affected. Import **@ohos.wifiManager** to make sure that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
import wifiManager from '@ohos.wifiManager';
Other APIs are not affected.
**Key API/Component Changes**
| Class| Type | Declaration | Change Type |
| ---- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| wifi | namespace | declare namespace wifi | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function enableWifi(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void. |
| wifi | method | function disableWifi(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void. |
| wifi | method | function scan(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value type to void. |
| wifi | method | function getScanResults(): Promise&lt;Array&lt;WifiScanInfo&gt;&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed **getScanInfos** to **getScanResults**.|
| wifi | method | function getScanResults(callback: AsyncCallback&lt;Array&lt;WifiScanInfo&gt;&gt;): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed **getScanInfos** to **getScanResults**.|
| wifi | method | function getScanResultsSync(): &nbsp;Array&lt;[WifiScanInfo]&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise&lt;number&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;number&gt;): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function removeCandidateConfig(networkId: number): Promise&lt;void&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback&lt;void&gt;): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; | Deleted this API in API version 9. |
| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean&gt;): void | Deleted this API in API version 9. |
| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; | Deleted this API in API version 9. |
| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean&gt;): void | Deleted this API in API version 9. |
| wifi | method | function getCandidateConfigs(): &nbsp;Array&lt;[WifiDeviceConfig]&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function connectToCandidateConfig(networkId: number): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function connectToNetwork(networkId: number): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function disconnect(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function reassociate(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function reconnect(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function disableNetwork(netId: number): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function removeAllNetwork(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function removeDevice(id: number): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function enableHotspot(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function disableHotspot(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function setHotspotConfig(config: HotspotConfig): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function getP2pLocalDevice(): Promise&lt;WifiP2pDevice&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function getP2pLocalDevice(callback: AsyncCallback&lt;WifiP2pDevice&gt;): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function getP2pGroups(): Promise&lt;Array&lt;WifiP2pGroupInfo&gt;&gt; | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function getP2pGroups(callback: AsyncCallback&lt;Array&lt;WifiP2pGroupInfo&gt;&gt;): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | method | function createGroup(config: WifiP2PConfig): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function removeGroup(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function p2pConnect(config: WifiP2PConfig): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function p2pCancelConnect(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function startDiscoverDevices(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function stopDiscoverDevices(): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function deletePersistentGroup(netId: number): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | method | function setDeviceName(devName: string): void | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and changed the return value to **void**.|
| wifi | interface | export interface WifiEapConfig | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | enum | export enum EapMethod | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | enum | export enum Phase2Method | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | interface | export interface WifiDeviceConfig | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **eapConfig** parameter.|
| wifi | interface | export interface IpConfig | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **prefixLength** parameter.|
| wifi | interface | export interface WifiInfoElem | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | enum | export enum WifiChannelWidth | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**. |
| wifi | interface | export interface WifiScanInfo | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the following three parameters: **centerFrequency0**, **centerFrequency1**, and **infoElems**.|
| wifi | enum | export enum WifiSecurityType | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added four encryption types. |
| wifi | interface | export interface WifiLinkedInfo | Migrated this API in API version 9 to **@ohos.wifiManager.d.ts**, and added the **MacType** parameter. |
**(Optional) Adaptation Guide**
The following uses **getLinkedInfo** as an example to show how it is called in the new version:
```
import wifiManager from '@ohos.wifiManager'
wifiManager.getLinkedInfo((err, data) => {
if (err) {
console.error("get linked info error");
return;
}
console.info("get linked info: " + JSON.stringify(data));
});
wifiManager.getLinkedInfo().then(data => {
console.info("get linked info: " + JSON.stringify(data));
}).catch(error => {
console.info("get linked info error");
});
```
## cl.wifiext.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.wifiManagerExt.d.ts
**@ohos.wifiext.d.ts** does not allow for throwing error codes, which is required by API version 9 and the system API. Therefore, all system APIs and APIs in API version 9 of **@ohos.wifiext.d.ts** are migrated to the newly added **@ohos.wifiManagerExt.d.ts**, and error code description is also added.
Import **@ohos.wifiManagerExt.d.ts**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used.
import wifiManagerExt from '@ohos.wifiManagerExt';
**Change Impacts**
System APIs and APIs in API version 9 are affected. Import **@ohos.wifiManagerExt**, so that system APIs and APIs in API version 9 of the Wi-Fi subsystem can be used together with the Wi-Fi manager.
import wifiManagerExt from '@ohos.wifiManagerExt';
Other APIs are not affected.
# Account Subsystem ChangeLog
## cl.account_os_account.1 Change in Error Information Return Method of Account System APIs
Certain system APIs of the account subsystem use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. The following changes are made in API version 9 and later:
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
**Change Impacts**
The 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.
**Key API/Component Changes**
Before change:
- class UserAuth
- setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;number&gt;): void;
- setProperty(request: SetPropertyRequest): Promise&lt;number&gt;;
- cancelAuth(contextID: Uint8Array): number;
- class PINAuth
- registerInputer(inputer: Inputer): boolean;
- UserIdentityManager
- cancel(challenge: Uint8Array): number;
After change:
- class UserAuth
- setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;void&gt;): void;
- setProperty(request: SetPropertyRequest): Promise&lt;void&gt;;
- cancelAuth(contextID: Uint8Array): void;
- class PINAuth
- registerInputer(inputer: Inputer): void;
- UserIdentityManager
- cancel(challenge: Uint8Array): void;
**Adaptation Guide**
The following uses **setProperty** as an example for asynchronous APIs:
```
import account_osAccount from "@ohos.account.osAccount"
userAuth.setProperty({
authType: account_osAccount.AuthType.PIN,
key: account_osAccount.SetPropertyType.INIT_ALGORITHM,
setInfo: new Uint8Array([0])
}, (err) => {
if (err) {
console.log("setProperty failed, error: " + JSON.stringify(err));
} else {
console.log("setProperty successfully");
}
});
userAuth.setProperty({
authType: account_osAccount.AuthType.PIN,
key: account_osAccount.SetPropertyType.INIT_ALGORITHM,
setInfo: new Uint8Array([0])
}).catch((err) => {
if (err) {
console.log("setProperty failed, error: " + JSON.stringify(err));
} else {
console.log("setProperty successfully");
}
});
```
The following uses **registerInputer** as an example for synchronous APIs:
```
import account_osAccount from "@ohos.account.osAccount"
let pinAuth = new account_osAccount.PINAuth()
let inputer = {
onGetData: (authType, passwordRecipient) => {
let password = new Uint8Array([0]);
passwordRecipient.onSetData(authType, password);
}
}
try {
pinAuth.registerInputer(inputer);
} catch (err) {
console.log("registerInputer failed, error: " + JSON.stringify(err));
}
```
## cl.account_os_account.2 ACTION Definition Change for the Application Account Authentication Service
**Change Impacts**
For the application developed based on an earlier version, you need to modify **ACTION** in the application configuration file (**config.json** for the FA model and **module.json5** for the Stage model) to normally provide the application authentication service.
**Key API/Component Changes**
Involved constant:
@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH
Before change:
ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth"
After change:
ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth"
**Adaptation Guide**
For a third-party application providing the account authentication service, adapt the changed application account authentication **ACTION** in the **ServiceAbility** configuration file (**config.json** for the FA module or **module.json5** for the Stage module).
```
"abilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
...
"visible": true,
"skills": {
{
"actions": [
"ohos.appAccount.action.auth"
]
}
}
}]
}
# Customization Subsystem ChangeLog
Compared with OpenHarmony 3.2.8.1, OpenHarmony 3.2.8.3 has the following API changes in the customization subsystem:
## cl.Customization.1 Change of the Enterprise Device Management Module Name
Beginning from OpenHarmony 3.2.8.3, **@ohos.enterpriseDeviceManager.d.ts** is changed to **@ohos.enterprise.adminManager.d.ts**. You need to adapt your applications according to the following information.
**Change Impacts**
The application developed based on OpenHarmony earlier than 3.2.8.3 must be adapted so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
| Original API | New API |
| --------------------------------- | ---------------------------------- |
| @ohos.enterpriseDeviceManager.d.ts | @ohos.enterprise.adminManager.d.ts |
**Adaptation Guide**
The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem.
If the original API uses **@ohos.enterpriseDeviceManager**:
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager';
```
You can directly modify **import** to switch to the new namespace:
```js
import enterpriseDeviceManager from '@ohos.enterprise.adminManager';
```
## cl.Customization.2 enterpriseDeviceManager/DeviceSettingsManager.d.ts Module Change
Beginning from OpenHarmony 3.2.8.3, **enterpriseDeviceManager/DeviceSettingsManager.d.ts** is changed to **ohos.enterprise.dateTimeManager.d.ts**.
**Change Impacts**
The application developed based on OpenHarmony earlier than 3.2.8.3 must be adapted so that it can be properly compiled in the SDK environment of the new version.
**Key API/Component Changes**
| Original API | Original API Type | New API | New API Type |
| --------------------------------- | --------- | ---------------------------------- | ----- |
| enterpriseDeviceManager/DeviceSettingsManager.d.ts | interface | @ohos.enterprise.dateTimeManager.d.ts | namespace |
**Adaptation Guide**
If the **setDateTime** API of **enterpriseDeviceManager/DeviceSettingsManager.d.ts** is used:
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
mgr.setDateTime(wantTemp, 1526003846000, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
});
```
You need to import the new namespace for adaptation:
```js
import dateTimeManager from '@ohos.enterprise.dateTimeManager'
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
})
```
## cl.Customization.3 System API Change
Beginning from OpenHarmony 3.2.8.3, all enterprise device management APIs are changed to system APIs.
**Change Impacts**
All APIs can be called only by system applications.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, callback: AsyncCallback<**boolean**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback<**boolean**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** isAdminEnabled(admin: Want, userId?: number): Promise<**boolean**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want, callback: AsyncCallback<**EnterpriseInfo**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** getEnterpriseInfo(admin: Want): Promise<**EnterpriseInfo**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String, callback: AsyncCallback<**boolean**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** isSuperAdmin(bundleName: String): Promise<**boolean**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **interface** EnterpriseInfo | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **enum** AdminType | Changed to a system API |
| @ohos.enterprise.adminManager | adminManager | **enum** ManagedEvent | Changed to a system API |
| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | Changed to a system API |
| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | Changed to a system API |
## cl.Customization.4 API Permission Change
Beginning from OpenHarmony 3.2.8.3, permission verification is required for some APIs.
**Change Impacts**
The application developed based on OpenHarmony earlier than 3.2.8.3 must have the corresponding permission so that it can properly call these APIs.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | New Permission|
| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId: number, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** disableAdmin(admin: Want, userId?: number): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String, callback: AsyncCallback<**void**>): void; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** disableSuperAdmin(bundleName: String): Promise<**void**>; | ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN |
| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<**void**>): void; | ohos.permission.SET_ENTERPRISE_INFO |
| @ohos.enterprise.adminManager | adminManager | **function** setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<**void**>; | ohos.permission.SET_ENTERPRISE_INFO |
| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT |
| @ohos.enterprise.adminManager | adminManager | **function** subscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT |
| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT |
| @ohos.enterprise.adminManager | adminManager | **function** unsubscribeManagedEvent(admin: Want, managedEvents: Array<**ManagedEvent**>): Promise<**void**>; | ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT |
| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number, callback: AsyncCallback<**void**>): void; | ohos.permission.ENTERPRISE_SET_DATETIME |
| @ohos.enterprise.dataTimeManager | dateTimeManager | **function** setDateTime(admin: Want, time: number): Promise<**void**>; | ohos.permission.ENTERPRISE_SET_DATETIME |
**Adaptation Guide**
Apply for the corresponding permission to call these APIs properly.
# Location Subsystem ChangeLog
## cl.location.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.geoLocationManager.d.ts
APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. However, APIs in API version 9 and system APIs all need to support throwing error codes. To support this function, all system APIs and APIs in API version 9 in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use system APIs and APIs in API version 9 of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impacts**
System APIs and APIs in API version 9 are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
Other APIs are not affected.
**Key API/Component Changes**
| Class| API Type| API Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespacegeolocation| Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface ReverseGeocodingMockInfo | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface LocationMockConfig | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface CountryCode | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | enum | export enum CountryCodeType | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoAddress | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.Location | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | NOT_SUPPORTED = 100 | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | QUERY_COUNTRY_CODE_ERROR | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'countryCodeChange', callback: Callback&lt;CountryCode&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'countryCodeChange', callback?: Callback&lt;CountryCode&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(callback: AsyncCallback&lt;CountryCode&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(): Promise&lt;CountryCode&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback&lt;void&gt;): void; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario): Promise&lt;void&gt;; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback&lt;void&gt;): void; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario): Promise&lt;void&gt;; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;, callback: AsyncCallback&lt;void&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback&lt;boolean&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise&lt;boolean&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback&lt;boolean&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the callback return value to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise&lt;boolean&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the promise return value to **void**. |
**(Optional) Adaptation Guide**
The following uses **enableLocation** as an example to show how it is called in the new version:
```ts
import geoLocationManager from '@ohos.geoLocationManager';
try {
geoLocationManager.enableLocation((err, data) => {
if (err) {
console.log('enableLocation: err=' + JSON.stringify(err));
}
});
} catch (err) {
console.error("errCode:" + err.code + ",errMessage:" + err.message);
}
```
## cl.location.2 Location Service Permission Change
From API version 9, the **ohos.permission.APPROXIMATELY_LOCATION** permission is added for obtaining the approximate location.
If you use API version 9 or later, you need to apply for both the **ohos.permission.LOCATION** and **ohos.permission.APPROXIMATELY_LOCATION** permissions. Applying for only the **ohos.permission.LOCATION** permission will fail.
**Change Impacts**
Applications using API versions earlier than 9 are not affected. For an application using API version 9 or later, the method for applying for the location permission is changed. The details are as follows:
Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user as described below.
The system provides the following location permissions:
- ohos.permission.LOCATION
- ohos.permission.APPROXIMATELY_LOCATION
- ohos.permission.LOCATION_IN_BACKGROUND
If your application needs to access the device location information, it must first apply for required permissions. Specifically speaking:
API versions earlier than 9: Apply for **ohos.permission.LOCATION**.
API version 9 and later: Apply for **ohos.permission.APPROXIMATELY_LOCATION**, or apply for **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately.
| API Version| Location Permission| Permission Application Result| Location Accuracy|
| -------- | -------- | -------- | -------- |
| Earlier than 9| ohos.permission.LOCATION | Success| Location accurate to meters|
| 9 and later| ohos.permission.LOCATION | Failure| No location obtained|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Success| Location accurate to 5 kilometers|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Success| Location accurate to meters|
If your application needs to access the device location information when running in the background, it must be configured to be able to run in the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background.
You can declare the required permission in your application's configuration file. For details, see the [permission application guide](../../../application-dev/security/accesstoken-guidelines.md).
**Key API/Component Changes**
Applications using API versions earlier than 9 are not affected.
If your application uses API version 9 or later and needs to call APIs requiring the **ohos.permission.LOCATION** permission in **@ohos.geolocation** and **@ohos.geoLocationManager**, you need to apply for the corresponding permission as described previously.
# Distributed Scheduler Subsystem ChangeLog
## cl.DistributedManagerService.1 Adding DATASYNC Permission Verification on the continuationManager API
In earlier versions, the **continuationManager** API does not verify the caller, which does not comply with the OpenHarmony API specifications.
Now, before using **continuationManager**, the caller must apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission.
**Change Impacts**
The application developed based on earlier versions needs to apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission in advance. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Involved APIs:
- continuationManager.registerContinuation;
- continuationManager.on;
- continuationManager.off;
- continuationManager.unregisterContinuation;
- continuationManager.updateContinuationState;
- continuationManager.startContinuationDeviceManager;
# Account Subsystem ChangeLog
## cl.account_os_account.1 Expansion of Distributed Account Nickname and Profile Picture Specifications
The existing distributed account nickname and profile picture specifications cannot meet requirements in scenarios where the nickname is long and profile picture is large.
Therefore, the distributed account nickname and profile picture specifications are expanded.
**Change Impacts**
The API change is forward compatible. Applications developed based on earlier versions can use the APIs in accordance with the new specifications, without affecting the original logic.
**Key API/Component Changes**
Before change:
- The nickname cannot exceed 20 characters, and the profile picture size cannot exceed 3 MB.
After change:
- The nickname cannot exceed 1024 characters, and the profile picture size cannot exceed 10 MB.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册