提交 3c4d1aeb 编写于 作者: L lichenchen

add account changelogs

Signed-off-by: Nlichenchen <lichenchen15@huawei.com>
上级 4da793b5
# 帐号子系统changeLog
## cl.account_os_account.1 createOsAccountForDomain错误码变更
使用createOsAccountForDomain重复创建域帐号时,变更前返回的错误码为12300001,变更后返回的错误码为12300004。
错误信息由通用系统报错细化为帐号已存在报错。
**变更影响**
基于此前版本开发的应用,需适配变更后的错误码,否则会影响原有业务逻辑。
**关键接口/组件变更**
- AccountManager
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;);
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;;
**适配指导**
重复创建域帐号的示例代码如下:
```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&lt;Array&lt;OsAccountInfo&gt;&gt;): void;
- queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;;
- createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInfo&gt;;
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;;
- queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;;
- getCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;;
- queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;): void;
- queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;;
- getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void;
- getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;;
- getOsAccountType(callback: AsyncCallback&lt;OsAccountType&gt;): void;
- getOsAccountType(): Promise&lt;OsAccountType&gt;;
**适配指导**
```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.
先完成此消息的编辑!
想要评论请 注册