1e41f4b71Sopenharmony_ci# Account Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## cl.account_os_account.1 createOsAccountForDomain Error Code Change
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciChanged the error code returned when the domain account created by **createOsAccountForDomain()** already exists from **12300001** to **12300004**.
6e41f4b71Sopenharmony_ciChanged the error information from "common system error" to "The account already exists".
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Change Impact**
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ciThe application developed based on earlier versions needs to adapt the new error code. Otherwise, the original service logic will be affected.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**Key API/Component Changes**
13e41f4b71Sopenharmony_ci- AccountManager
14e41f4b71Sopenharmony_ci  - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>);
15e41f4b71Sopenharmony_ci  - createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>;
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Adaptation Guide**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciThe sample code is as follows:
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci```ts
22e41f4b71Sopenharmony_ciimport account_osAccount from "@ohos.account.osAccount"
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_cilet accountMgr = account_osAccount.getAccountManager();
25e41f4b71Sopenharmony_cilet domainInfo = {
26e41f4b71Sopenharmony_ci  accountName: "zhangsan",
27e41f4b71Sopenharmony_ci  domain: "china.example.com"
28e41f4b71Sopenharmony_ci};
29e41f4b71Sopenharmony_citry {
30e41f4b71Sopenharmony_ci  await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
31e41f4b71Sopenharmony_ci  await accountMgr.createOsAccountForDomain(account_osAccount.OsAccountType.NORMAL, domainInfo);
32e41f4b71Sopenharmony_ci} catch (err) {
33e41f4b71Sopenharmony_ci  console.log("activateOsAccount err: " + JSON.stringify(err)); // error.code = 12300004;
34e41f4b71Sopenharmony_ci}
35e41f4b71Sopenharmony_ci```
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci## cl.account_os_account.2 Application Account getAllAccounts() Permission Change 
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciRemoved the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission that is originally required for an application to call **getAllAccounts()** to obtain accessible accounts.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Change Impact**
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciFrom this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAllAccounts()**.
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**Key API/Component Changes**
46e41f4b71Sopenharmony_ci- AccountManager
47e41f4b71Sopenharmony_ci  - getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
48e41f4b71Sopenharmony_ci  - getAllAccounts(): Promise<Array<AppAccountInfo>>;
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci**Adaptation Guide**
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ciThe following is the sample code for an application to obtain the accessible accounts without the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission:
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci```ts
55e41f4b71Sopenharmony_ciimport account_appAccount from "@ohos.account.appAccount"
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_cilet accountMgr = account_appAccount.createAppAccountManager();
58e41f4b71Sopenharmony_citry {
59e41f4b71Sopenharmony_ci  await accountMgr.addAccount("accessibleAccount_promise_nopermission");
60e41f4b71Sopenharmony_ci  var data = await accountMgr.getAllAccounts();
61e41f4b71Sopenharmony_ci  if (data[0].name == "accessibleAccount_promise_nopermission") {
62e41f4b71Sopenharmony_ci    console.log("getAllAccounts successfully");
63e41f4b71Sopenharmony_ci  }
64e41f4b71Sopenharmony_ci} catch (err) {
65e41f4b71Sopenharmony_ci  console.log("getAllAccounts err: " + JSON.stringify(err));
66e41f4b71Sopenharmony_ci}
67e41f4b71Sopenharmony_ci``` 
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci## cl.account_os_account.3 Application Account getAccountsByOwner() Permission Change
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ciRemoved 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 .
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci**Change Impact**
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciFrom this version, applications do not need the **ohos.permission.GET_ALL_APP_ACCOUNTS** permission when calling **getAccountsByOwner()**.
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci**Key API/Component Changes**
78e41f4b71Sopenharmony_ci- AccountManager
79e41f4b71Sopenharmony_ci  - getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
80e41f4b71Sopenharmony_ci  - getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>;
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci**Adaptation Guide**
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ciThe 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:
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci```ts
87e41f4b71Sopenharmony_ciimport account_appAccount from "@ohos.account.appAccount"
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_cilet accountMgr = account_appAccount.createAppAccountManager();
90e41f4b71Sopenharmony_citry {
91e41f4b71Sopenharmony_ci  var ownerName = "com.example.owner";
92e41f4b71Sopenharmony_ci  var data = await accountMgr.getAllAccounts(ownerName);
93e41f4b71Sopenharmony_ci} catch (err) {
94e41f4b71Sopenharmony_ci  console.log("getAllAccounts err: " + JSON.stringify(err));
95e41f4b71Sopenharmony_ci}
96e41f4b71Sopenharmony_ci``` 
97