提交 2e856603 编写于 作者: A Annie_wang

Update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 c9f82184
# Readme
- [Account](changelogs-account_os_account.md)
- [Distributed Scheduler](changelogs-dmsfwk.md)
- [DSoftBus](changelogs-dsoftbus.md)
- [File Management](changelogs-filemanagement.md)
- [User IAM](changelogs-useriam.md)
- [Wi-Fi](changelogs-wifi.md)
# Account Subsystem Changelog
## cl.account_os_account.1 Change of Definition and Return Mode of Error Codes
To ensure consistent error codes and normalized return of error codes in the account subsystem APIs, the following changes are made in API version 9:
- Added the following 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)
- Changed the error code return modes as follows:
- Asynchronous APIs: Return error information in the **error** object of **AsyncCallback** or **Promise**. Throw an exception to return an error related to the parameter type or quantity.
- Synchronous APIs: Throw an exception to return an error message.
**Change Impact**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the service logic will be affected.
**Key API/Component Changes**
Involved 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 describe 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 bussiness error
console.log("account_osAccount failed, error: " + JSON.stringify(err));
} else {
console.log("account_osAccount successfully");
}
}
try {
accountMgr.activateOsAccount("100", callbackFunc);
} catch (err) { // handle the parameter type error
console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err));
}
try {
accountMgr.activateOsAccount();
} catch (err) { // handle the parameter number error
console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err));
}
```
The following uses **registerInputer** as an example to describe 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) { // handle the parameter type error
console.log("account_osAccount failed for incorrect parameter type, error: " + JSON.stringify(err));
}
try {
pinAuth.registerInputer()
} catch (err) { // handle the parameter number error
console.log("account_osAccount failed for incorrect parameter number, error: " + JSON.stringify(err));
}
```
# Account Subsystem Changelog
## cl.account_os_account.2 Change in Error Information Return of Account System APIs
Some 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:
Asynchronous APIs: Return error information in the **error** object of **AsyncCallback** or **Promise**.
Synchronous APIs: Throw an exception to return error information.
**Change Impact**
The application developed based on earlier versions needs to be adapted. Otherwise, the 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.3 ACTION Definition Change for the Application Account Authentication Service
**Change Impact**
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). Otherwise, the application authentication service will be affected.
**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, change **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"
]
}
}
}]
}
```
# Distributed Scheduler Subsystem Changelog
## cl.DistributedManagerService.1 continuationManager on()/off() Changes
- The event types passed to the **continuationManager.on** and **continuationManager.off** APIs do not comply with the OpenHarmony API specifications.
- The return value of **continuationManager.on** varies with the event type, which does not comply with the OpenHarmony API specifications.
The following changes have been made:
- Changed the event type **deviceConnect** to **deviceSelected** and **deviceDisconnect** to **deviceUnselected** in the **continuationManager.on** and **continuationManager.off** APIs.
- Changed the return value of **continuationManager.on** to **Callback&lt;Array&lt;ContinuationResult&gt;&gt;** for all events.
**Change Impact**
The application developed based on earlier versions needs to be adapted. Otherwise, the 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:
Event of device selection in **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));
}
```
Event of device selection in **continuationManager.off**:
```ts
let token = 1;
try {
continuationManager.off("deviceSelected", token);
} catch (err) {
console.error('off failed, cause: ' + JSON.stringify(err));
}
```
Event of device deselection in **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));
}
```
Event of device deselection in **continuationManager.off**:
```ts
let token = 1;
try {
continuationManager.off("deviceUnselected", token);
} catch (err) {
console.error('off failed, cause: ' + JSON.stringify(err));
}
```
## cl.DistributedManagerService.2 Adding DATASYNC Permission Verification to continuationManager APIs
In earlier versions, the **continuationManager** APIs do not verify the caller, which does not comply with the OpenHarmony API specifications.
Now, before using a **continuationManager** API, the caller must apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission.
**Change Impact**
The application developed based on earlier versions needs to apply for the **ohos.permission.DISTRIBUTED_DATASYNC** permission in advance. Otherwise, the service logic will be affected.
**Key API/Component Changes**
Involved APIs:
- continuationManager.registerContinuation;
- continuationManager.on;
- continuationManager.off;
- continuationManager.unregisterContinuation;
- continuationManager.updateContinuationState;
- continuationManager.startContinuationDeviceManager;
# DSoftBus Subsystem Changelog
## Support for Exception Handling and Selecting Synchronous or Asynchronous Message Sending by Using a Boolean or Numeric Value in IPC&RPC APIs
1. Some IPC&RPC APIs of DSoftBus use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony.
2. A Boolean value can be passed in to specify the asynchronous or synchronous message transfer mode.
#### Change Impact
No adaptation is required. Use the new APIs provided by this version to:
1. Implement exception handling and return of error codes.
2. Select synchronous or asynchronous message transfer by using a Boolean value or a number of 0 or non-0.
#### **Key API/Component Changes**
For easy use, related IPC&RPC APIs are deprecated, and new APIs are added to implement unified error code handling. The functionalities of these APIs remain unchanged.
| 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 new APIs return error codes and error information by throwing exceptions. The following uses the **create()** API of **MessageParcel** as an example.
```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 the APIs, see [RPC](../../../application-dev/reference/apis/js-apis-rpc.md).
# File Management Subsystem Changelog
## cl.filemanagement.1 fileio API Changes
Deprecated the **fileio** APIs, which do not return error codes; added APIs that return error codes.
**Change Impact**
For applications developed based on earlier versions, pay attention to the changes of APIs. The specifications of the new APIs are slightly adjusted. Pay attention to the usage of the new APIs.
**Key API/Component Changes**
The APIs of **@ohos.fileio** do not support error code handling and are deprecated. New APIs are added in **@ohos.file.fs** to support unified error code handling and have slight changes in parameters. The functionalities of the APIs remain unchanged.
| Module | Method/Attribute/Enum/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**
Before the change, the APIs are imported as follows:
```js
import fileio from '@ohos.fileio';
```
Now, the APIs are imported as follows:
```js
import fs from '@ohos.file.fs';
```
In addition, exception handling needs to be adapted.
Sample code for exception handling in a synchronous API:
```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 exception handling in an asynchronous API (promise):
```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 exception handling in an asynchronous API (callback):
```js
import fs from '@ohos.file.fs'
try {
fs.open(path, fs.OpenMode.READ_ONLY, function(e, file){ // Asynchronous thread errors (such as a syscall error) are obtained via a callback.
if (e) {
console.error("open in async errCode:" + e.code + ", errMessage:" + e.message);
}
});
} catch (err) {// Main thread errors (such as invalid parameters) are obtained by try catch.
console.error("open callback errCode:" + err.code + ", errMessage:" + err.message);
}
```
# User IAM Subsystem Changelog
## cl.useriam.1 API Exception Handling Change in APIs
Certain user IAM APIs 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:
An error message is returned by throwing an exception.
**Change Impact**
Applications developed based on earlier versions are not affected. If your application uses API version 9 or later, you need to adapt the change in the way for APIs to return error information. Otherwise, service logic will be affected.
**Key API/Component Changes**
For easy use, related user IAM APIs are deprecated, and new APIs are added to implement unified error code handling. The functionalities of these APIs remain unchanged.
| Module | Class | Method/Attribute/Enum/Constant | Change Type |
| ---------------------- | ------------------- | ------------------------- | ------------------------ |
| ohos.userIAM.userAuth | UserAuth | constructor() | Deprecated|
| ohos.userIAM.userAuth | UserAuth | getVersion() : number | Deprecated|
| ohos.userIAM.userAuth | UserAuth | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number | Deprecated|
| ohos.userIAM.userAuth | UserAuth | auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array | Deprecated|
| ohos.userIAM.userAuth | UserAuth | cancelAuth(contextID : Uint8Array) : number | Deprecated|
| ohos.userIAM.userAuth | IUserAuthCallback | onResult: (result : number, extraInfo : AuthResult) => void | Deprecated|
| ohos.userIAM.userAuth | IUserAuthCallback | onAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void | Deprecated|
| ohos.userIAM.userAuth | AuthResult | AuthResult {<br>token ?: Uint8Array; <br>remainTimes ?: number; <br>freezingTime ?: number;} | Deprecated|
| ohos.userIAM.userAuth | Enum| ResultCode {<br>SUCCESS = 0, <br>FAIL = 1, <br>GENERAL_ERROR = 2, <br>CANCELED = 3, <br>TIMEOUT = 4, <br>TYPE_NOT_SUPPORT = 5, <br>TRUST_LEVEL_NOT_SUPPORT = 6, <br>BUSY = 7, <br>INVALID_PARAMETERS = 8, <br>LOCKED = 9, <br>NOT_ENROLLED = 10,} | Deprecated|
| ohos.userIAM.userAuth | type | AuthEventKey = "result" | Added|
| ohos.userIAM.userAuth | type | EventInfo = AuthResultInfo | Added|
| ohos.userIAM.userAuth | AuthResultInfo | AuthResultInfo {<br>result : number; <br>token ?: Uint8Array; <br>remainAttempts ?: number; <br>lockoutDuration ?: number;} | Added|
| ohos.userIAM.userAuth | TipInfo | TipInfo {<br>module : number; <br>tip : number;} | Added|
| ohos.userIAM.userAuth | AuthInstance | AuthInstance {<br>on: (name: AuthEventKey, callback: AuthEvent) => void; <br>off: (name: AuthEventKey) => void; <br>start: () => void; <br>cancel: () => void;} | Added|
| ohos.userIAM.userAuth | Enum| ResultCodeV9 {<br>SUCCESS = 12500000, <br>FAIL = 12500001, <br>GENERAL_ERROR = 12500002, <br>CANCELED = 12500003, <br>TIMEOUT = 12500004, <br>TYPE_NOT_SUPPORT = 12500005, <br>TRUST_LEVEL_NOT_SUPPORT = 12500006, <br>BUSY = 12500007, <br>LOCKED = 12500009, <br>NOT_ENROLLED = 12500010,} | Added|
| ohos.userIAM.userAuth | function | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel) : AuthInstance | Added|
| ohos.userIAM.userAuth | function | getVersion() : number | Added|
| ohos.userIAM.userAuth | function | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : void | Added|
| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId : string) : ResultCode | Deleted|
| ohos.userIAM.faceAuth | Enum| ResultCode {<br>SUCCESS = 0, <br>FAIL = 1,} | Deleted|
| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId: string) : void | Added|
**Adaptation Guide**
The following uses **getVersion** as an example:
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
try {
let version = userIAM_userAuth.getVersion();
console.info("auth version = " + version);
} catch (error) {
console.info("get version failed, error = " + error);
}
```
For more information about the APIs, see [User Authentication](../../../application-dev/reference/apis/js-apis-useriam-userauth.md) and [Facial Authentication](../../../application-dev/reference/apis/js-apis-useriam-faceauth.md).
## cl.useriam.2 API Invoking Permission Change
Some user IAM APIs can only be called by system applications, and system application runtime authentication is required. The following changes are made in API version 9:
Added the service logic for checking whether an application is a system application to the **setSurfaceId** API of the facial authentication module. Non-system applications cannot call this API.
**Change Impact**
Applications developed based on earlier versions are not affected.
**Key API/Component Changes**
The service logic for checking whether an application is a system application is added to **setSurfaceId()** . Error code **202** will be returned if the API is called by a non-system application.
**Adaptation Guide**
Change the **app-feature** field to **hos_system_app** in the **UnsgnedReleasedProfileTemplate.json** file in [developtools_hapsigner](https://gitee.com/openharmony/developtools_hapsigner/tree/master/dist). Then, the signed application is a system application.
# Wi-Fi Subsystem Changelog
## cl.wifi.1 Change of System APIs and APIs of Version 9
Moved all system APIs and APIs of version 9 from **@ohos.wifi.d.ts** to the newly added **@ohos.wifiManager.d.ts**, and added error code description. The **@ohos.wifi.d.ts** APIs do not support error code handling.
To use these APIs, import the **@ohos.wifiManager.d.ts** module as follows:
import wifiManager from '@ohos.wifiManager';
**Change Impact**
System APIs and APIs of version 9 are affected. To use these APIs, import **@ohos.wifiManager** as follows:
import wifiManager from '@ohos.wifiManager';
Other APIs are not affected.
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
| wifi | namespace | declare namespace wifi | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function enableWifi(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function disableWifi(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function scan(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function getScanResults(): Promise&lt;Array&lt;WifiScanInfo&gt;&gt; | Changed from **getScanInfos** to **getScanResults** and moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function getScanResults(callback: AsyncCallback&lt;Array&lt;WifiScanInfo&gt;&gt;): void | Changed from **getScanInfos** to **getScanResults** and moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function getScanResultsSync(): &nbsp;Array&lt;[WifiScanInfo]&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function addCandidateConfig(config: WifiDeviceConfig): Promise&lt;number&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;number&gt;): void | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function removeCandidateConfig(networkId: number): Promise&lt;void&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function removeCandidateConfig(networkId: number, callback: AsyncCallback&lt;void&gt;): void | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; | Deleted|
| wifi | method | function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean&gt;): void | Deleted|
| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig): Promise&lt;boolean&gt; | Deleted|
| wifi | method | function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback&lt;boolean&gt;): void | Deleted|
| wifi | method | function getCandidateConfigs(): &nbsp;Array&lt;[WifiDeviceConfig]&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function connectToCandidateConfig(networkId: number): void | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function connectToNetwork(networkId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function connectToDevice(config: WifiDeviceConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function disconnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function reassociate(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function reconnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function disableNetwork(netId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function removeAllNetwork(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function removeDevice(id: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function enableHotspot(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function disableHotspot(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function setHotspotConfig(config: HotspotConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function getP2pLocalDevice(): Promise&lt;WifiP2pDevice&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function getP2pLocalDevice(callback: AsyncCallback&lt;WifiP2pDevice&gt;): void | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function getP2pGroups(): Promise&lt;Array&lt;WifiP2pGroupInfo&gt;&gt; | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function getP2pGroups(callback: AsyncCallback&lt;Array&lt;WifiP2pGroupInfo&gt;&gt;): void | Moved to **@ohos.wifiManager.d.ts**|
| wifi | method | function createGroup(config: WifiP2PConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function removeGroup(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function p2pConnect(config: WifiP2PConfig): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function p2pCancelConnect(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function startDiscoverDevices(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function stopDiscoverDevices(): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function deletePersistentGroup(netId: number): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | method | function setDeviceName(devName: string): void | Moved to **@ohos.wifiManager.d.ts**, with the return value changed to **void**|
| wifi | interface | export interface WifiEapConfig | Moved to **@ohos.wifiManager.d.ts**|
| wifi | enum | export enum EapMethod | Moved to **@ohos.wifiManager.d.ts**|
| wifi | enum | export enum Phase2Method | Moved to **@ohos.wifiManager.d.ts**|
| wifi | interface | export interface WifiDeviceConfig | Added with the **eapConfig** parameter and moved to **@ohos.wifiManager.d.ts**|
| wifi | interface | export interface IpConfig | Added with the **prefixLength** parameter and moved to **@ohos.wifiManager.d.ts**|
| wifi | interface | export interface WifiInfoElem | Moved to **@ohos.wifiManager.d.ts**|
| wifi | enum | export enum WifiChannelWidth | Moved to **@ohos.wifiManager.d.ts**|
| wifi | interface | export interface WifiScanInfo | Added with the **centerFrequency0**, **centerFrequency1**, and **infoElems** parameters and moved to **@ohos.wifiManager.d.ts**|
| wifi | enum | export enum WifiSecurityType | Added with four encryption types and moved to **@ohos.wifiManager.d.ts**|
| wifi | interface | export interface WifiLinkedInfo | Added with the **MacType** parameter and moved to **@ohos.wifiManager.d.ts**|
**Adaptation Guide**
The following uses **getLinkedInfo** as an example:
```
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 Change of System APIs and APIs of Version 9
Moved all system APIs and APIs of version 9 from **@ohos.wifiext.d.ts** to the newly added **@ohos.wifiManagerExt.d.ts**, and added error code description.
To use these APIs, import the **@ohos.wifiManagerExt.d.ts** module as follows:
import wifiManagerExt from '@ohos.wifiManagerExt';
**Change Impact**
System APIs and APIs of version 9 are affected. Import **@ohos.wifiManagerExt** and use it together with **wifiManager**.
import wifiManagerExt from '@ohos.wifiManagerExt';
Other APIs are not affected.
# Readme
- [Account](changelogs-account_os_account.md)
- [Distributed Data Management](changelogs-distributeddatamgr.md)
- [File Management](changelogs-filemanagement.md)
- [User IAM](changelogs-useriam.md)
# Account Subsystem Changelog
## cl.account_os_account.1 createOsAccountForDomain Error Code Change
Changed the error code returned when the domain account created by **createOsAccountForDomain()** already exists from **12300001** to **12300004**.
Changed the error information from "common system error" to "The account already exists".
**Change Impact**
The application developed based on earlier versions needs to adapt the new error code. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
- AccountManager
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;);
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;;
**Adaptation Guide**
The sample code is as follows:
```ts
import account_osAccount from "@ohos.account.osAccount"
let accountMgr = account_osAccount.getAccountManager();
let domainInfo = {
accountName: "zhangsan",
domain: "china.example.com"
};
try {
await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
} catch (err) {
console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004;
}
```
## cl.account_os_account.2 Application Account getAllAccounts() Permission Change
Removed the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission that is originally required for an application to call **getAllAccounts()** to obtain accessible accounts.
**Change Impact**
From this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAllAccounts()**.
**Key API/Component Changes**
- AccountManager
- getAllAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void;
- getAllAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
**Adaptation Guide**
The following is the sample code for an application to obtain the accessible accounts without the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission:
```ts
import account_appAccount from "@ohos.account.appAccount"
let accountMgr = account_appAccount.createAppAccountManager();
try {
await accountMgr.addAccount("accessibleAccount_promise_nopermission");
var data = await accountMgr.getAllAccounts();
if (data[0].name == "accessibleAccount_promise_nopermission") {
console.log("getAllAccounts successfully");
}
} catch (err) {
console.log("getAllAccounts err: " + JSON.stringify(err));
}
```
## cl.account_os_account.3 Application Account getAccountsByOwner() Permission Change
Removed the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission that is originally required for an application to call **getAccountsByOwner()** to obtain the accessible accounts based on the account owner .
**Change Impact**
From this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAccountsByOwner()**.
**Key API/Component Changes**
- AccountManager
- getAccountsByOwner(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void;
- getAccountsByOwner(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
**Adaptation Guide**
The following is the sample code for an application to obtain the accessible accounts based on the account owner without the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission:
```ts
import account_appAccount from "@ohos.account.appAccount"
let accountMgr = account_appAccount.createAppAccountManager();
try {
var ownerName = "com.example.owner";
var data = await accountMgr.getAllAccounts(ownerName);
} catch (err) {
console.log("getAllAccounts err: " + JSON.stringify(err));
}
```
# Distributed Data Management Subsystem JS API Changelog
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
Changed the APIs in **kv_store** of the distributed data management subsystem:
Changed the **createKVManager()** implementation from asynchronous mode to synchronous mode because the execution duration is fixed and short.
Before change:<br>**createKVManager(config: KVManagerConfig): Promise\<KVManager\>;**<br>**createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void;**<br>After change:<br>**createKVManager(config: KVManagerConfig): KVManager;**
You need to adapt your application.
**Change Impact**
JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enum/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 Move of getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
Moved **getRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **getRdbStore()**.
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**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>;
```
Moved the above APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void;
function getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>;
```
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the names of the **getRdbStore()** APIs.
## cl.distributeddatamgr.3 Move of deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
Moved **deleteRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **deleteRdbStore()**.
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
APIs:
```ts
function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
```
Moved the above APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
```
function deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void;
function deleteRdbStore(context: Context, name: string): Promise<void>;
```
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the names of the **deleteRdbStoreV9()** APIs.
## cl.distributeddatamgr.4 Move of StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **StoreConfigV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **StoreConfig**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change the **StoreConfigV9** in APIs.
## cl.distributeddatamgr.5 Move of enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **enum SecurityLevel** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
**Adaptation Guide**
Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
## cl.distributeddatamgr.6 Mover of RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **RdbStoreV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbStore**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change **RdbStoreV9** in relevant APIs.
## cl.distributeddatamgr.7 Move of class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved the class **RdbPredicatesV9** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbPredicates**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Change **RdbPredicatesV9** in the relevant APIs.
## cl.distributeddatamgr.8 Move of ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts
**Change Impact**
The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful.
**Key API/Component Changes**
Moved **ResultSetV9** from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **ResultSet**.
**Adaptation Guide**
* Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
* Obtain the **ResultSetV9** instance only by using **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**.
# File Management Subsystem Changelog
## cl.filemanagement.1 environment Module Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **environment** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **environment** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **environment** was imported from **@ohos.environment**:
```js
import environment from '@ohos.environment';
```
Now, **environment** is imported from **@ohos.file.environment**:
```js
import environment from '@ohos.file.environment';
```
## cl.filemanagement.2 securityLabel Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **securityLabel** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **securityLabel** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **securityLabel** was imported from **@ohos.securityLabel**:
```js
import securityLabel from '@ohos.securityLabel';
```
Now, **securityLabel** is imported from **@ohos.file.securityLabel**:
```js
import securityLabel from '@ohos.file.securityLabel';
```
## cl.filemanagement.3 fs Change
Changed the **ino** attribute type of **Stat** under **fs**.
**Change Impact**
The **ino** attribute type is changed from number to BigInt, to adapt to the **inode** range of all types of files in the file system.
**Key API/Component Changes**
The type of the **ino** attribute of **Stat** is changed from number to BigInt.
## cl.filemanagement.4 fileAccess Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileAccess** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileAccess** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **fileAccess** was imported from **@ohos.data.fileAccess**:
```js
import fileAccess from '@ohos.data.fileAccess';
```
Now, **fileAccess** is imported from **@ohos.file.fileAccess**:
```js
import fileAccess from '@ohos.file.fileAccess';
```
## cl.filemanagement.5 fileExtensionInfo Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **fileExtensionInfo** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **fileExtensionInfo** was imported from **@ohos.fileExtensionInfo**:
```js
import fileExtensionInfo from '@ohos.fileExtensionInfo';
```
Now, **fileExtensionInfo** is imported from **@ohos.file.fileExtensionInfo**:
```js
import fileExtensionInfo from '@ohos.file.fileExtensionInfo';
```
## cl.filemanagement.6 storageStatistics Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **storageStatistics** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **storageStatistics** was imported from **@ohos.storageStatistics**:
```js
import storageStatistics from '@ohos.storageStatistics';
```
Now, **storageStatistics** is imported from **@ohos.file.storageStatistics**:
```js
import storageStatistics from '@ohos.file.storageStatistics';
```
## cl.filemanagement.7 volumeManager Change
Moved the file management subsystem **d.ts** file to the **file** directory. The **fileExtensionInfo** module supports error code processing.
**Change Impact**
If your application is developed based on earlier versions, note that the **d.ts** file location and the name of the module to be imported are changed. The **volumeManager** module supports error code processing. See [Adaptation Guide](../v3.2-beta4/changelogs-filemanagement.md) for more details.
**Key API/Component Changes**
Before the change, **volumeManager** was imported from **@ohos.volumeManager**:
```js
import volumeManager from '@ohos.volumeManager';
```
Now, **volumeManager** is imported from **@ohos.file.volumeManager**:
```js
import volumeManager from '@ohos.file.volumeManager';
```
# User IAM Subsystem Changelog
## cl.useriam.1 API9 Result Value Change
Changed the return value **ResultCodeV9** to **UserAuthResultCode** for API9.
**Change Impact**
Applications developed based on earlier versions are not affected. For the applications developed from this version, the class name of the error code needs to be adapted. Otherwise, the service logic is affected.
**Key API/Component Changes**
N/A
**Adaptation Guide**
Change the class name for invoking the authentication result code from **ResultCode** to **UserAuthResultCode**.
......@@ -6,7 +6,7 @@
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现environment模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现environment模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......@@ -28,7 +28,7 @@ import environment from '@ohos.file.environment';
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现securityLabel模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现securityLabel模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......@@ -62,7 +62,7 @@ fs模块下Stat接口ino属性类型变更,由number变更为bigint,以适
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileAccess模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileAccess模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......@@ -84,7 +84,7 @@ import fileAccess from '@ohos.file.fileAccess';
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileExtensionInfo模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现fileExtensionInfo模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......@@ -106,7 +106,7 @@ import fileExtensionInfo from '@ohos.file.fileExtensionInfo';
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现storageStatistics模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现storageStatistics模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......@@ -128,7 +128,7 @@ import storageStatistics from '@ohos.file.storageStatistics';
**变更影响**
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现volumeManager模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../OpenHarmony_3.2.8.1/changelogs-filemanagement.md)
基于此前版本开发的应用,需注意d.ts位置的变更及import模块名的变更。现volumeManager模块支持错误码处理,需注意错误码处理的使用。[相关适配指导参考](../v3.2-beta4/changelogs-filemanagement.md)
**关键接口/组件变更**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册