1# Account Subsystem Changelog
2
3## cl.account_os_account.1 OsAccountInfo.type Value Type Change
4
5Changed the value type of **OsAccountInfo.type** from object to **OsAccountType** enum.
6
7**Change Impact**
8
9The mode for reading the **OsAccountInfo.type** value needs to be changed for the application developed based on earlier versions. Otherwise, the original service logic will be affected.
10
11**Key API/Component Changes**
12
13The following APIs are involved:
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**Adaptation Guide**
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