未验证 提交 59a648aa 编写于 作者: O openharmony_ci 提交者: Gitee

!13319 add account changelogs

Merge pull request !13319 from lichenchen/master
# 帐号子系统changeLog
## cl.account_os_account.1 createOsAccountForDomain错误码变更
使用createOsAccountForDomain重复创建域帐号时,变更前返回的错误码为12300001,变更后返回的错误码为12300004。
错误信息由通用系统报错细化为帐号已存在报错。
**变更影响**
基于此前版本开发的应用,需适配变更后的错误码,否则会影响原有业务逻辑。
**关键接口/组件变更**
- AccountManager
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>);
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>;
**适配指导**
重复创建域帐号的示例代码如下:
```ts
import account_osAccount from "@ohos.account.osAccount"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
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) {
expect(err.code).assertEqual(12300004);
}
```
# 帐号子系统changeLog
## cl.account_os_account.1 系统帐号OsAccountInfo.type取值类型变更
变更前,OsAccountInfo.type取值的实际类型为Object,与d.ts中声明的OsAccountType枚举类型不一致;变更后,OsAccountInfo.type取值的实际类型为OsAccountType枚举。
**变更影响**
基于此前版本开发的应用,需变更OsAccountInfo.type值的读取方式,否则影响原因业务逻辑。
**关键接口/组件变更**
涉及的接口:
- AccountManager
- queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void;
- queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>;
- createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void;
- createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInfo>;
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>): void;
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>;
- queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
- queryCurrentOsAccount(): Promise<OsAccountInfo>;
- getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
- getCurrentOsAccount(): Promise<OsAccountInfo>;
- queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void;
- queryOsAccountById(localId: number): Promise<OsAccountInfo>;
- getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void;
- getOsAccountTypeFromProcess(): Promise<OsAccountType>;
- getOsAccountType(callback: AsyncCallback<OsAccountType>): void;
- getOsAccountType(): Promise<OsAccountType>;
**适配指导**
```ts
import account_osAccount from "@ohos.account.osAccount"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
let accountMgr = account_osAccount.getAccountManager();
accountMgr.createOsAccount('account_test', account_osAccount.OsAccountType.GUEST).then((accountInfo) => {
expect(accountInfo.type).assertEqual(account_osAccount.OsAccountType.GUEST);
accountMgr.activateOsAccount(accountInfo.localId).then(() => {
console.log('activateOsAccount successfully');
accountMgr.getOsAccountTypeFromProcess().then((accountType) => {
expect(accountType).assertEqual(account_osAccount.OsAccountType.GUEST);
}).catch((err) => {
console.log('activateOsAccount err: ' + JSON.stringify(err));
expect().assertFail();
});
}).catch((err) => {
console.log('activateOsAccount err: ' + JSON.stringify(err));
expect().assertFail();
});
}).catch((err) => {
console.log('createOsAccount err: ' + JSON.stringify(err));
expect().assertFail();
});
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册