1# 帐号子系统changeLog
2
3## cl.account_os_account.1 系统帐号OsAccountInfo.type取值类型变更
4
5变更前,OsAccountInfo.type取值的实际类型为Object,与d.ts中声明的OsAccountType枚举类型不一致;变更后,OsAccountInfo.type取值的实际类型为OsAccountType枚举。
6
7**变更影响**
8
9基于此前版本开发的应用,需变更OsAccountInfo.type值的读取方式,否则影响原因业务逻辑。
10
11**关键接口/组件变更**
12
13涉及的接口:
14- AccountManager
15  - queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void;
16  - queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>;
17  - createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void;
18  - createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInfo>;
19  - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>): void;
20  - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>;
21  - queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
22  - queryCurrentOsAccount(): Promise<OsAccountInfo>;
23  - getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
24  - getCurrentOsAccount(): Promise<OsAccountInfo>;
25  - queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void;
26  - queryOsAccountById(localId: number): Promise<OsAccountInfo>;
27
28  - getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void;
29  - getOsAccountTypeFromProcess(): Promise<OsAccountType>;
30  - getOsAccountType(callback: AsyncCallback<OsAccountType>): void;
31  - getOsAccountType(): Promise<OsAccountType>;
32
33**适配指导**
34```ts
35import account_osAccount from "@ohos.account.osAccount"
36
37let accountMgr = account_osAccount.getAccountManager();
38accountMgr.createOsAccount("account_test", account_osAccount.OsAccountType.GUEST).then((accountInfo) => {
39  if (accountInfo.type == account_osAccount.OsAccountType.GUEST) {
40    console.log("createOsAccount successfully");
41  }
42  accountMgr.activateOsAccount(accountInfo.localId).then(() => {
43    console.log("activateOsAccount successfully");
44    accountMgr.getOsAccountTypeFromProcess().then((accountType) => {
45      if (accountType == account_osAccount.OsAccountType.GUEST) {
46        console.log("getOsAccountTypeFromProcess successfully");
47      }
48    }).catch((err) => {
49      console.log("activateOsAccount err: " + JSON.stringify(err));
50    });
51  }).catch((err) => {
52    console.log("activateOsAccount err: " + JSON.stringify(err));
53  });
54}).catch((err) => {
55  console.log("createOsAccount err: " + JSON.stringify(err));
56});
57```
58