• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.account.osAccount (System Account Management)
2
3<!--Kit: Basic Services Kit-->
4<!--Subsystem: Account-->
5<!--Owner: @steven-q-->
6<!--Designer: @JiDong-CS1-->
7<!--Tester: @zhaimengchao-->
8<!--Adviser: @zengyawen-->
9
10The **osAccount** module provides basic capabilities for managing system (OS) accounts, including adding, deleting, querying, setting, subscribing to, and enabling a system account.
11
12> **NOTE**
13>
14> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
15
16## Modules to Import
17
18```ts
19import { osAccount } from '@kit.BasicServicesKit';
20```
21
22## osAccount.getAccountManager
23
24getAccountManager(): AccountManager
25
26Obtains an **AccountManager** instance.
27
28**System capability**: SystemCapability.Account.OsAccount
29
30**Return value**
31
32| Type                             | Description             |
33| --------------------------------- | ---------------- |
34| [AccountManager](#accountmanager) | **AccountManager** instance obtained.|
35
36**Example**
37
38  ```ts
39  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
40  ```
41
42## OsAccountType
43
44Enumerates the system account types.
45
46**System capability**: SystemCapability.Account.OsAccount
47
48| Name  | Value| Description        |
49| ------ | ------ | ----------- |
50| ADMIN  | 0      | Administrator account.|
51| NORMAL | 1      | Normal account.  |
52| GUEST  | 2      | Guest account.  |
53
54## AccountManager
55
56Provides APIs for managing system accounts.
57
58### checkMultiOsAccountEnabled<sup>9+</sup>
59
60checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
61
62Checks whether multiple system accounts are supported. This API uses an asynchronous callback to return the result.
63
64**System capability**: SystemCapability.Account.OsAccount
65
66**Parameters**
67
68| Name  | Type                        | Mandatory| Description                                                    |
69| -------- | ---------------------------- | ---- | ------------------------------------------------------ |
70| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means multiple system accounts are supported; the value **false** means the opposite.|
71
72**Error codes**
73
74For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
75
76| ID| Error Message            |
77| -------- | ------------------- |
78| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
79| 12300001 | The system service works abnormally. |
80
81**Example**
82
83  ```ts
84  import { BusinessError } from '@kit.BasicServicesKit';
85  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
86  try {
87    accountManager.checkMultiOsAccountEnabled((err: BusinessError, isEnabled: boolean) => {
88      if (err) {
89        console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
90      } else {
91      console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
92      }
93    });
94  } catch (err) {
95    console.error('checkMultiOsAccountEnabled failed, error:' + JSON.stringify(err));
96  }
97  ```
98
99### checkMultiOsAccountEnabled<sup>9+</sup>
100
101checkMultiOsAccountEnabled(): Promise&lt;boolean&gt;
102
103Checks whether multiple system accounts are supported. This API uses a promise to return the result.
104
105**System capability**: SystemCapability.Account.OsAccount
106
107**Return value**
108
109| Type                  | Description                                                       |
110| :--------------------- | :--------------------------------------------------------- |
111| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means multiple system accounts are supported; the value **false** means the opposite.|
112
113**Error codes**
114
115For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
116
117| ID| Error Message            |
118| -------- | ------------------- |
119| 12300001 | The system service works abnormally. |
120
121**Example**
122
123  ```ts
124  import { BusinessError } from '@kit.BasicServicesKit';
125  try {
126    let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
127    accountManager.checkMultiOsAccountEnabled().then((isEnabled: boolean) => {
128      console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
129    }).catch((err: BusinessError) => {
130      console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
131    });
132  } catch (err) {
133    console.error('checkMultiOsAccountEnabled failed, error:' + JSON.stringify(err));
134  }
135  ```
136
137### checkOsAccountActivated<sup>(deprecated)</sup>
138
139checkOsAccountActivated(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
140
141Checks whether a system account is activated. This API uses an asynchronous callback to return the result.
142
143> **NOTE**
144>
145> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
146
147**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
148
149**System capability**: SystemCapability.Account.OsAccount
150
151**Parameters**
152
153| Name  | Type                        | Mandatory| Description                                                    |
154| -------- | ---------------------------- | ---- | ------------------------------------------------------ |
155| localId  | number                       | Yes  | ID of the target system account.                                            |
156| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the account is activated; the value **false** means the opposite.|
157
158**Error codes**
159
160For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
161
162| ID| Error Message            |
163| -------- | ------------------- |
164| 201 | Permission denied.|
165| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
166| 12300001 | The system service works abnormally. |
167| 12300002 | Invalid localId.    |
168| 12300003 | Account not found. |
169
170**Example**: Check whether system account 100 is activated.
171
172  ```ts
173  import { BusinessError } from '@kit.BasicServicesKit';
174  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
175  let localId: number = 100;
176  try {
177    accountManager.checkOsAccountActivated(localId, (err: BusinessError, isActivated: boolean) => {
178      if (err) {
179        console.error('checkOsAccountActivated failed, error:' + JSON.stringify(err));
180      } else {
181        console.log('checkOsAccountActivated successfully, isActivated:' + isActivated);
182      }
183    });
184  } catch (err) {
185    console.error('checkOsAccountActivated exception: ' + JSON.stringify(err));
186  }
187  ```
188
189### checkOsAccountActivated<sup>(deprecated)</sup>
190
191checkOsAccountActivated(localId: number): Promise&lt;boolean&gt;
192
193Checks whether a system account is activated. This API uses a promise to return the result.
194
195> **NOTE**
196>
197> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
198
199**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
200
201**System capability**: SystemCapability.Account.OsAccount
202
203**Parameters**
204
205| Name | Type  | Mandatory| Description                              |
206| ------- | ------ | ---- | --------------------------------- |
207| localId | number | Yes  | ID of the target system account.|
208
209**Return value**
210
211| Type                  | Description                                                      |
212| ---------------------- | ---------------------------------------------------------- |
213| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the account is activated; the value **false** means the opposite.|
214
215**Error codes**
216
217For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
218
219| ID| Error Message            |
220| -------- | ------------------- |
221| 201 | Permission denied.|
222| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
223| 12300001 | The system service works abnormally. |
224| 12300002 | Invalid localId.    |
225| 12300003 | Account not found. |
226
227**Example**: Check whether system account 100 is activated.
228
229  ```ts
230  import { BusinessError } from '@kit.BasicServicesKit';
231  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
232  let localId: number = 100;
233  try {
234    accountManager.checkOsAccountActivated(localId).then((isActivated: boolean) => {
235      console.log('checkOsAccountActivated successfully, isActivated: ' + isActivated);
236    }).catch((err: BusinessError) => {
237      console.error('checkOsAccountActivated failed, error: ' + JSON.stringify(err));
238    });
239  } catch (err) {
240    console.error('checkOsAccountActivated exception: ' + JSON.stringify(err));
241  }
242  ```
243
244### isOsAccountConstraintEnabled<sup>11+</sup>
245
246isOsAccountConstraintEnabled(constraint: string): Promise&lt;boolean&gt;
247
248Checks whether a constraint is enabled for this system account. This API uses a promise to return the result.
249
250**System capability**: SystemCapability.Account.OsAccount
251
252**Parameters**
253
254| Name    | Type  | Mandatory| Description                               |
255| ---------- | ------ | ---- | ---------------------------------- |
256| constraint | string | Yes  | [Constraint](#constraints) to check.|
257
258**Return value**
259
260| Type                  | Description                                                                 |
261| --------------------- | --------------------------------------------------------------------- |
262| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
263
264**Error codes**
265
266For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
267
268| ID| Error Message            |
269| -------- | ------------------- |
270| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
271| 12300001 | The system service works abnormally. |
272
273**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
274
275  ```ts
276  import { BusinessError } from '@kit.BasicServicesKit';
277  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
278  let constraint: string = 'constraint.wifi';
279  try {
280    accountManager.isOsAccountConstraintEnabled(constraint).then((isEnabled: boolean) => {
281      console.log('isOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
282    }).catch((err: BusinessError) => {
283      console.error('isOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
284    });
285  } catch (err) {
286    console.error('isOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
287  }
288  ```
289
290### checkOsAccountConstraintEnabled<sup>(deprecated)</sup>
291
292checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback&lt;boolean&gt;): void
293
294Checks whether the specified constraint is enabled for a system account. This API uses an asynchronous callback to return the result.
295
296> **NOTE**
297>
298> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
299
300**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
301
302**System capability**: SystemCapability.Account.OsAccount
303
304**Parameters**
305
306| Name    | Type                        | Mandatory| Description                                                              |
307| ---------- | ---------------------------- | ---- | ----------------------------------------------------------------- |
308| localId    | number                       | Yes  | ID of the target system account.                                |
309| constraint | string                       | Yes  | [Constraint](#constraints) to check.                               |
310| callback   | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
311
312**Error codes**
313
314For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
315
316| ID| Error Message            |
317| -------- | ------------------- |
318| 201 | Permission denied.|
319| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
320| 12300001 | The system service works abnormally. |
321| 12300002 | Invalid localId or constraint.    |
322| 12300003 | Account not found. |
323
324**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
325
326  ```ts
327  import { BusinessError } from '@kit.BasicServicesKit';
328  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
329  let localId: number = 100;
330  let constraint: string = 'constraint.wifi';
331  try {
332    accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err: BusinessError, isEnabled: boolean)=>{
333      if (err) {
334        console.error('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
335      } else {
336        console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
337      }
338    });
339  } catch (err) {
340    console.error('checkOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
341  }
342  ```
343
344### checkOsAccountConstraintEnabled<sup>(deprecated)</sup>
345
346checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise&lt;boolean&gt;
347
348Checks whether the specified constraint is enabled for a system account. This API uses a promise to return the result.
349
350> **NOTE**
351>
352> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
353
354**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
355
356**System capability**: SystemCapability.Account.OsAccount
357
358**Parameters**
359
360| Name    | Type  | Mandatory| Description                               |
361| ---------- | ------ | ---- | ---------------------------------- |
362| localId    | number | Yes  | ID of the target system account. |
363| constraint | string | Yes  | [Constraint](#constraints) to check.|
364
365**Return value**
366
367| Type                  | Description                                                                 |
368| --------------------- | --------------------------------------------------------------------- |
369| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
370
371**Error codes**
372
373For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
374
375| ID| Error Message            |
376| -------- | ------------------- |
377| 201 | Permission denied.|
378| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
379| 12300001 | The system service works abnormally. |
380| 12300002 | Invalid localId or constraint.    |
381| 12300003 | Account not found. |
382
383**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
384
385  ```ts
386  import { BusinessError } from '@kit.BasicServicesKit';
387  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
388  let localId: number = 100;
389  let constraint: string = 'constraint.wifi';
390  try {
391    accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled: boolean) => {
392      console.log('checkOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
393    }).catch((err: BusinessError) => {
394      console.error('checkOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
395    });
396  } catch (err) {
397    console.error('checkOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
398  }
399  ```
400
401### checkOsAccountTestable<sup>9+</sup>
402
403checkOsAccountTestable(callback: AsyncCallback&lt;boolean&gt;): void
404
405Checks whether this system account is a test account. This API uses an asynchronous callback to return the result.
406
407**System capability**: SystemCapability.Account.OsAccount
408
409**Parameters**
410
411| Name  | Type                        | Mandatory| Description                                                                  |
412| -------- | ---------------------------- | ---- | --------------------------------------------------------------------- |
413| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the account is a test account; the value **false** means the opposite.|
414
415**Error codes**
416
417For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
418
419| ID| Error Message            |
420| -------- | ------------------- |
421| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
422| 12300001 | The system service works abnormally. |
423
424**Example**
425
426  ```ts
427  import { BusinessError } from '@kit.BasicServicesKit';
428  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
429  try {
430    accountManager.checkOsAccountTestable((err: BusinessError, isTestable: boolean) => {
431      if (err) {
432        console.error('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
433      } else {
434        console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
435      }
436    });
437  } catch (err) {
438    console.error('checkOsAccountTestable error: ' + JSON.stringify(err));
439  }
440  ```
441
442### checkOsAccountTestable<sup>9+</sup>
443
444checkOsAccountTestable(): Promise&lt;boolean&gt;
445
446Checks whether this system account is a test account. This API uses a promise to return the result.
447
448**System capability**: SystemCapability.Account.OsAccount
449
450**Return value**
451
452| Type                  | Description                                                                     |
453| ---------------------- | ------------------------------------------------------------------------ |
454| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the account is a test account; the value **false** means the opposite.|
455
456**Error codes**
457
458For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
459
460| ID| Error Message            |
461| -------- | ------------------- |
462| 12300001 | The system service works abnormally. |
463
464**Example**
465
466  ```ts
467  import { BusinessError } from '@kit.BasicServicesKit';
468  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
469  try {
470    accountManager.checkOsAccountTestable().then((isTestable: boolean) => {
471      console.log('checkOsAccountTestable successfully, isTestable: ' + isTestable);
472    }).catch((err: BusinessError) => {
473      console.error('checkOsAccountTestable failed, error: ' + JSON.stringify(err));
474    });
475  } catch (err) {
476    console.error('checkOsAccountTestable exception: ' + JSON.stringify(err));
477  }
478  ```
479
480### isOsAccountUnlocked<sup>11+</sup>
481
482isOsAccountUnlocked(): Promise&lt;boolean&gt;
483
484Checks whether this system account is unlocked. This API uses a promise to return the result.
485
486**System capability**: SystemCapability.Account.OsAccount
487
488**Return value**
489
490| Type                  | Description                                                                     |
491| ---------------------- | ------------------------------------------------------------------------ |
492| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the system account is unlocked; the value **false** means the opposite.|
493
494**Error codes**
495
496For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
497
498| ID| Error Message            |
499| -------- | ------------------- |
500| 12300001 | The system service works abnormally. |
501
502**Example**
503
504  ```ts
505  import { BusinessError } from '@kit.BasicServicesKit';
506  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
507  try {
508    accountManager.isOsAccountUnlocked().then((isVerified: boolean) => {
509      console.log('isOsAccountUnlocked successfully, isVerified: ' + isVerified);
510    }).catch((err: BusinessError) => {
511      console.error('isOsAccountUnlocked failed, error: ' + JSON.stringify(err));
512    });
513  } catch (err) {
514    console.error('isOsAccountUnlocked exception: ' + JSON.stringify(err));
515  }
516  ```
517
518### checkOsAccountVerified<sup>(deprecated)</sup>
519
520checkOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
521
522Checks whether a system account has been verified. This API uses an asynchronous callback to return the result.
523
524> **NOTE**
525>
526> This API is supported since API version 9 and deprecated since API version 11. Use [isOsAccountUnlocked](#isosaccountunlocked11) instead.
527
528**System capability**: SystemCapability.Account.OsAccount
529
530**Parameters**
531
532| Name  | Type                        | Mandatory| Description                                                           |
533| -------- | ---------------------------- | ---- | ------------------------------------------------------------- |
534| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
535
536**Error codes**
537
538For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
539
540| ID| Error Message            |
541| -------- | ------------------- |
542| 12300001 | The system service works abnormally. |
543
544**Example**
545
546  ```ts
547  import { BusinessError } from '@kit.BasicServicesKit';
548  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
549  try {
550    accountManager.checkOsAccountVerified((err: BusinessError, isVerified: boolean) => {
551      if (err) {
552        console.error('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
553      } else {
554        console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
555      }
556    });
557  } catch (err) {
558    console.error('checkOsAccountVerified exception: ' + JSON.stringify(err));
559  }
560  ```
561
562### checkOsAccountVerified<sup>(deprecated)</sup>
563
564checkOsAccountVerified(): Promise&lt;boolean&gt;
565
566Checks whether this system account has been verified. This API uses a promise to return the result.
567
568> **NOTE**
569>
570> This API is supported since API version 9 and deprecated since API version 11. Use [isOsAccountUnlocked](#isosaccountunlocked11) instead.
571
572**System capability**: SystemCapability.Account.OsAccount
573
574**Return value**
575
576| Type                  | Description                                                                     |
577| ---------------------- | ------------------------------------------------------------------------ |
578| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
579
580**Error codes**
581
582For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
583
584| ID| Error Message            |
585| -------- | ------------------- |
586| 12300001 | The system service works abnormally. |
587
588**Example**
589
590  ```ts
591  import { BusinessError } from '@kit.BasicServicesKit';
592  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
593  try {
594    accountManager.checkOsAccountVerified().then((isVerified: boolean) => {
595      console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
596    }).catch((err: BusinessError) => {
597      console.error('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
598    });
599  } catch (err) {
600    console.error('checkOsAccountVerified exception: ' + JSON.stringify(err));
601  }
602  ```
603
604### checkOsAccountVerified<sup>(deprecated)</sup>
605
606checkOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
607
608Checks whether a system account has been verified. This API uses an asynchronous callback to return the result.
609
610> **NOTE**
611>
612> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
613
614**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
615
616**System capability**: SystemCapability.Account.OsAccount
617
618**Parameters**
619
620| Name  | Type                        | Mandatory| Description                                                           |
621| -------- | ---------------------------- | ---- | ------------------------------------------------------------- |
622| localId  | number                       | Yes  | ID of the target system account.                             |
623| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
624
625**Error codes**
626
627For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
628
629| ID| Error Message            |
630| -------- | ------------------- |
631| 201 | Permission denied.|
632| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
633| 12300001 | The system service works abnormally. |
634| 12300002 | Invalid localId.    |
635| 12300003 | Account not found. |
636
637**Example**
638
639  ```ts
640  import { BusinessError } from '@kit.BasicServicesKit';
641  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
642  let localId: number = 100;
643  try {
644    accountManager.checkOsAccountVerified(localId, (err: BusinessError, isVerified: boolean) => {
645      if (err) {
646        console.error('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
647      } else {
648        console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
649      }
650    });
651  } catch (err) {
652    console.error('checkOsAccountVerified exception: ' + err);
653  }
654  ```
655
656### checkOsAccountVerified<sup>(deprecated)</sup>
657
658checkOsAccountVerified(localId: number): Promise&lt;boolean&gt;
659
660Checks whether a system account has been verified. This API uses a promise to return the result.
661
662> **NOTE**
663>
664> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
665
666**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
667
668**System capability**: SystemCapability.Account.OsAccount
669
670**Parameters**
671
672| Name | Type  | Mandatory| Description                                                             |
673| ------- | ------ | ---- | --------------------------------------------------------------- |
674| localId | number | Yes  | ID of the target system account. If this parameter is not specified, this API checks whether the current system account has been verified.|
675
676**Return value**
677
678| Type                  | Description                                                              |
679| ---------------------- | ----------------------------------------------------------------- |
680| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
681
682**Error codes**
683
684For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
685
686| ID| Error Message            |
687| -------- | ------------------- |
688| 201 | Permission denied.|
689| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
690| 12300001 | The system service works abnormally. |
691| 12300002 | Invalid localId.    |
692| 12300003 | Account not found. |
693
694**Example**
695
696  ```ts
697  import { BusinessError } from '@kit.BasicServicesKit';
698  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
699  let localId: number = 100;
700  try {
701    accountManager.checkOsAccountVerified(localId).then((isVerified: boolean) => {
702      console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified);
703    }).catch((err: BusinessError) => {
704      console.error('checkOsAccountVerified failed, error: ' + JSON.stringify(err));
705    });
706  } catch (err) {
707    console.error('checkOsAccountVerified exception: ' + JSON.stringify(err));
708  }
709  ```
710
711### getOsAccountCount<sup>9+</sup>
712
713getOsAccountCount(callback: AsyncCallback&lt;number&gt;): void
714
715Obtains the number of system accounts created. This API uses an asynchronous callback to return the result.
716
717**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
718
719**System capability**: SystemCapability.Account.OsAccount
720
721**Parameters**
722
723| Name  | Type                       | Mandatory| Description                                                                        |
724| -------- | --------------------------- | ---- | -------------------------------------------------------------------------- |
725| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the number of created system accounts. If the operation fails, **err** is an error object.|
726
727**Error codes**
728
729For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
730
731| ID| Error Message            |
732| -------- | ------------------- |
733| 201 | Permission denied.|
734| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
735| 12300001 | The system service works abnormally. |
736
737**Example**
738
739  ```ts
740  import { BusinessError } from '@kit.BasicServicesKit';
741  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
742  try {
743    accountManager.getOsAccountCount((err: BusinessError, count: number) => {
744      if (err) {
745        console.error('getOsAccountCount failed, error: ' + JSON.stringify(err));
746      } else {
747        console.log('getOsAccountCount successfully, count: ' + count);
748      }
749    });
750  } catch (err) {
751    console.error('getOsAccountCount exception: ' + JSON.stringify(err));
752  }
753  ```
754
755### getOsAccountCount<sup>9+</sup>
756
757getOsAccountCount(): Promise&lt;number&gt;
758
759Obtains the number of system accounts created. This API uses a promise to return the result.
760
761**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
762
763**System capability**: SystemCapability.Account.OsAccount
764
765**Return value**
766
767| Type                 | Description                                   |
768| --------------------- | -------------------------------------- |
769| Promise&lt;number&gt; | Promise used to return the number of created system accounts.|
770
771**Error codes**
772
773For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
774
775| ID| Error Message            |
776| -------- | ------------------- |
777| 201 | Permission denied.|
778| 12300001 | The system service works abnormally. |
779
780**Example**
781
782  ```ts
783  import { BusinessError } from '@kit.BasicServicesKit';
784  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
785  try {
786    accountManager.getOsAccountCount().then((count: number) => {
787      console.log('getOsAccountCount successfully, count: ' + count);
788    }).catch((err: BusinessError) => {
789      console.error('getOsAccountCount failed, error: ' + JSON.stringify(err));
790    });
791  } catch(err) {
792    console.error('getOsAccountCount exception: ' + JSON.stringify(err));
793  }
794  ```
795
796### getOsAccountLocalId<sup>9+</sup>
797
798getOsAccountLocalId(callback: AsyncCallback&lt;number&gt;): void
799
800Obtains the ID of the system account to which the current process belongs. This API uses an asynchronous callback to return the result.
801
802**System capability**: SystemCapability.Account.OsAccount
803
804**Parameters**
805
806| Name  | Type                       | Mandatory| Description                                                                          |
807| -------- | --------------------------- | ---- | ---------------------------------------------------------------------------- |
808| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **err** is an error object.|
809
810**Error codes**
811
812For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
813
814| ID| Error Message            |
815| -------- | ------------------- |
816| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
817| 12300001 | The system service works abnormally. |
818
819**Example**
820
821  ```ts
822  import { BusinessError } from '@kit.BasicServicesKit';
823  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
824  try {
825    accountManager.getOsAccountLocalId((err: BusinessError, localId: number) => {
826      if (err) {
827        console.error('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
828      } else {
829        console.log('getOsAccountLocalId successfully, localId: ' + localId);
830      }
831    });
832  } catch (err) {
833    console.error('getOsAccountLocalId exception: ' + JSON.stringify(err));
834  }
835  ```
836
837### getOsAccountLocalId<sup>9+</sup>
838
839getOsAccountLocalId(): Promise&lt;number&gt;
840
841Obtains the ID of the system account to which the current process belongs. This API uses a promise to return the result.
842
843**System capability**: SystemCapability.Account.OsAccount
844
845**Return value**
846
847| Type                 | Description                                     |
848| --------------------- | ---------------------------------------- |
849| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
850
851**Error codes**
852
853For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
854
855| ID| Error Message            |
856| -------- | ------------------- |
857| 12300001 | The system service works abnormally. |
858
859**Example**
860
861  ```ts
862  import { BusinessError } from '@kit.BasicServicesKit';
863  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
864  try {
865    accountManager.getOsAccountLocalId().then((localId: number) => {
866      console.log('getOsAccountLocalId successfully, localId: ' + localId);
867    }).catch((err: BusinessError) => {
868      console.error('getOsAccountLocalId failed, error: ' + JSON.stringify(err));
869    });
870  } catch (err) {
871    console.error('getOsAccountLocalId exception: ' + JSON.stringify(err));
872  }
873  ```
874
875### getOsAccountLocalIdForUid<sup>9+</sup>
876
877getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): void
878
879Obtains the system account ID based on the process UID. This API uses an asynchronous callback to return the result.
880
881**System capability**: SystemCapability.Account.OsAccount
882
883**Parameters**
884
885| Name  | Type                       | Mandatory| Description                                                                   |
886| -------- | --------------------------- | ---- | --------------------------------------------------------------------- |
887| uid      | number                      | Yes  | Process UID.                                                             |
888| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **data** is an error object.|
889
890**Error codes**
891
892For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
893
894| ID| Error Message        |
895| -------- | --------------- |
896| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
897| 12300001 | The system service works abnormally. |
898| 12300002 | Invalid uid.    |
899
900**Example**: Obtain the ID of the system account whose process UID is **12345678**.
901
902  ```ts
903  import { BusinessError } from '@kit.BasicServicesKit';
904  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
905  let uid: number = 12345678;
906  try {
907    accountManager.getOsAccountLocalIdForUid(uid, (err: BusinessError, localId: number) => {
908      if (err) {
909        console.error('getOsAccountLocalIdForUid failed, error: ' + JSON.stringify(err));
910      }
911      console.log('getOsAccountLocalIdForUid successfully, localId: ' + localId);
912    });
913  } catch (err) {
914    console.error('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err));
915  }
916  ```
917
918### getOsAccountLocalIdForUid<sup>9+</sup>
919
920getOsAccountLocalIdForUid(uid: number): Promise&lt;number&gt;
921
922Obtains the system account ID based on the process UID. This API uses a promise to return the result.
923
924**System capability**: SystemCapability.Account.OsAccount
925
926**Parameters**
927
928| Name| Type  | Mandatory| Description     |
929| ------ | ------ | ---- | --------- |
930| uid    | number | Yes  | Process UID.|
931
932**Return value**
933
934| Type                 | Description                                    |
935| --------------------- | --------------------------------------- |
936| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
937
938**Error codes**
939
940For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
941
942| ID| Error Message      |
943| -------- | ------------- |
944| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
945| 12300001 | The system service works abnormally. |
946| 12300002 | Invalid uid. |
947
948**Example**: Obtain the ID of the system account whose process UID is **12345678**.
949
950  ```ts
951  import { BusinessError } from '@kit.BasicServicesKit';
952  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
953  let uid: number = 12345678;
954  try {
955    accountManager.getOsAccountLocalIdForUid(uid).then((localId: number) => {
956      console.log('getOsAccountLocalIdForUid successfully, localId: ' + localId);
957    }).catch((err: BusinessError) => {
958      console.error('getOsAccountLocalIdForUid failed, error: ' + JSON.stringify(err));
959    });
960  } catch (err) {
961    console.error('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err));
962  }
963  ```
964
965### getOsAccountLocalIdForUidSync<sup>10+</sup>
966
967getOsAccountLocalIdForUidSync(uid: number): number
968
969Obtains the system account ID based on the process UID. The API returns the result synchronously.
970
971**System capability**: SystemCapability.Account.OsAccount
972
973**Parameters**
974
975| Name| Type  | Mandatory| Description     |
976| ------ | ------ | ---- | --------- |
977| uid    | number | Yes  | Process UID.|
978
979**Return value**
980
981| Type                 | Description                                    |
982| --------------------- | --------------------------------------- |
983| number | System account ID obtained.|
984
985**Error codes**
986
987For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
988
989| ID| Error Message      |
990| -------- | ------------- |
991| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
992| 12300002 | Invalid uid. |
993
994**Example**: Obtain the ID of the system account whose process UID is **12345678**.
995
996  ```ts
997  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
998  let uid: number = 12345678;
999  try {
1000    let localId : number = accountManager.getOsAccountLocalIdForUidSync(uid);
1001    console.log('getOsAccountLocalIdForUidSync successfully, localId: ' + localId);
1002  } catch (err) {
1003    console.error('getOsAccountLocalIdForUidSync exception: ' + JSON.stringify(err));
1004  }
1005  ```
1006
1007### getOsAccountLocalIdForDomain<sup>9+</sup>
1008
1009getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;number&gt;): void
1010
1011Obtains the system account ID based on the domain account information. This API uses an asynchronous callback to return the result.
1012
1013**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1014
1015**System capability**: SystemCapability.Account.OsAccount
1016
1017**Parameters**
1018
1019| Name    | Type                                   | Mandatory| Description                                                                        |
1020| ---------- | --------------------------------------- | ---- | -------------------------------------------------------------------------- |
1021| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.                                                               |
1022| callback   | AsyncCallback&lt;number&gt;             | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the ID of the system account associated with the domain account. Otherwise, **err** is an error object.|
1023
1024**Error codes**
1025
1026For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1027
1028| ID| Error Message      |
1029| -------- | ------------- |
1030| 201 | Permission denied.|
1031| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
1032| 12300001 | The system service works abnormally. |
1033| 12300002 | Invalid domainInfo. |
1034
1035**Example**
1036
1037  ```ts
1038  import { BusinessError } from '@kit.BasicServicesKit';
1039  let domainInfo: osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
1040  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1041  try {
1042    accountManager.getOsAccountLocalIdForDomain(domainInfo, (err: BusinessError, localId: number) => {
1043      if (err) {
1044        console.error('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(err));
1045      } else {
1046        console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
1047      }
1048    });
1049  } catch (err) {
1050    console.error('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err));
1051  }
1052  ```
1053
1054### getOsAccountLocalIdForDomain<sup>9+</sup>
1055
1056getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise&lt;number&gt;
1057
1058Obtains the system account ID based on the domain account information. This API uses a promise to return the result.
1059
1060**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1061
1062**System capability**: SystemCapability.Account.OsAccount
1063
1064**Parameters**
1065
1066| Name    | Type                                   | Mandatory| Description        |
1067| ---------- | --------------------------------------- | ---- | ------------ |
1068| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.|
1069
1070**Return value**
1071
1072| Type                 | Description                                   |
1073| :-------------------- | :------------------------------------- |
1074| Promise&lt;number&gt; | Promise used to return the ID of the system account associated with the domain account.|
1075
1076**Error codes**
1077
1078For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1079
1080| ID| Error Message      |
1081| -------- | ------------- |
1082| 201 | Permission denied.|
1083| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
1084| 12300001 | The system service works abnormally. |
1085| 12300002 | Invalid domainInfo. |
1086
1087**Example**
1088
1089  ```ts
1090  import { BusinessError } from '@kit.BasicServicesKit';
1091  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1092  let domainInfo: osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
1093  try {
1094    accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId: number) => {
1095      console.log('getOsAccountLocalIdForDomain successfully, localId: ' + localId);
1096    }).catch((err: BusinessError) => {
1097      console.error('getOsAccountLocalIdForDomain failed, error: ' + JSON.stringify(err));
1098    });
1099  } catch (err) {
1100    console.error('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err));
1101  }
1102  ```
1103
1104### getOsAccountConstraints<sup>(deprecated)</sup>
1105
1106getOsAccountConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
1107
1108Obtains all constraints enabled for a system account. This API uses an asynchronous callback to return the result.
1109
1110> **NOTE**
1111>
1112> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
1113
1114**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1115
1116**System capability**: SystemCapability.Account.OsAccount
1117
1118**Parameters**
1119
1120| Name  | Type                                    | Mandatory| Description                                                                                          |
1121| -------- | ---------------------------------------- | ---- | -------------------------------------------------------------------------------------------- |
1122| localId  | number                                   | Yes  | ID of the target system account.                                                                                 |
1123| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is all [constraints](#constraints) obtained. Otherwise, **err** is an error object.|
1124
1125**Error codes**
1126
1127For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1128
1129| ID| Error Message            |
1130| -------- | ------------------- |
1131| 201 | Permission denied.|
1132| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
1133| 12300001 | The system service works abnormally. |
1134| 12300002 | Invalid localId.    |
1135| 12300003 | Account not found. |
1136
1137**Example**: Obtain all constraints of system account 100.
1138
1139  ```ts
1140  import { BusinessError } from '@kit.BasicServicesKit';
1141  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1142  let localId: number = 100;
1143  try {
1144    accountManager.getOsAccountConstraints(localId, (err: BusinessError, constraints: string[]) => {
1145      if (err) {
1146        console.error('getOsAccountConstraints failed, err: ' + JSON.stringify(err));
1147      } else {
1148        console.log('getOsAccountConstraints successfully, constraints: ' + JSON.stringify(constraints));
1149      }
1150    });
1151  } catch (err) {
1152    console.error('getOsAccountConstraints exception: ' + JSON.stringify(err));
1153  }
1154  ```
1155
1156### getOsAccountConstraints<sup>(deprecated)</sup>
1157
1158getOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
1159
1160Obtains all constraints enabled for a system account. This API uses a promise to return the result.
1161
1162> **NOTE**
1163>
1164> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
1165
1166**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1167
1168**System capability**: SystemCapability.Account.OsAccount
1169
1170**Parameters**
1171
1172| Name | Type  | Mandatory| Description        |
1173| ------- | ------ | ---- | ------------ |
1174| localId | number | Yes  | ID of the target system account.|
1175
1176**Return value**
1177
1178| Type                              | Description                                                      |
1179| ---------------------------------- | ---------------------------------------------------------- |
1180| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return all the [constraints](#constraints) enabled for the system account.|
1181
1182**Error codes**
1183
1184For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1185
1186| ID| Error Message            |
1187| -------- | ------------------- |
1188| 201 | Permission denied.|
1189| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
1190| 12300001 | The system service works abnormally. |
1191| 12300002 | Invalid localId.    |
1192| 12300003 | Account not found. |
1193
1194**Example**: Obtain all constraints of system account 100.
1195
1196  ```ts
1197  import { BusinessError } from '@kit.BasicServicesKit';
1198  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1199  let localId: number = 100;
1200  try {
1201    accountManager.getOsAccountConstraints(localId).then((constraints: string[]) => {
1202      console.log('getOsAccountConstraints, constraints: ' + constraints);
1203    }).catch((err: BusinessError) => {
1204      console.error('getOsAccountConstraints err: ' + JSON.stringify(err));
1205    });
1206  } catch (e) {
1207    console.error('getOsAccountConstraints exception: ' + JSON.stringify(e));
1208  }
1209  ```
1210
1211### getActivatedOsAccountLocalIds<sup>9+</sup>
1212
1213getActivatedOsAccountLocalIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
1214
1215Obtains information about all activated system accounts. This API uses an asynchronous callback to return the result.
1216
1217**System capability**: SystemCapability.Account.OsAccount
1218
1219**Parameters**
1220
1221| Name  | Type                                    | Mandatory| Description                                                  |
1222| -------- | ---------------------------------------- | ---- | ------------------------------------------------------ |
1223| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a list of activated system accounts. Otherwise, **data** is an error object.|
1224
1225**Error codes**
1226
1227For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1228
1229| ID| Error Message      |
1230| -------- | ------------- |
1231| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
1232| 12300001 | The system service works abnormally. |
1233
1234**Example**
1235
1236  ```ts
1237  import { BusinessError } from '@kit.BasicServicesKit';
1238  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1239  try {
1240    accountManager.getActivatedOsAccountLocalIds((err: BusinessError, idArray: number[])=>{
1241      if (err) {
1242        console.error('getActivatedOsAccountLocalIds err:' + JSON.stringify(err));
1243      } else {
1244        console.log('getActivatedOsAccountLocalIds idArray length:' + idArray.length);
1245        for(let i=0;i<idArray.length;i++) {
1246          console.info('activated os account id: ' + idArray[i]);
1247        }
1248      }
1249    });
1250  } catch (e) {
1251    console.error('getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
1252  }
1253  ```
1254
1255### getActivatedOsAccountLocalIds<sup>9+</sup>
1256
1257getActivatedOsAccountLocalIds(): Promise&lt;Array&lt;number&gt;&gt;
1258
1259Obtains information about all activated system accounts. This API uses a promise to return the result.
1260
1261**System capability**: SystemCapability.Account.OsAccount
1262
1263**Return value**
1264
1265| Type                              | Description                                              |
1266| :--------------------------------- | :------------------------------------------------ |
1267| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the information about all activated system accounts.|
1268
1269**Error codes**
1270
1271For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
1272
1273| ID| Error Message      |
1274| -------- | ------------- |
1275| 12300001 | The system service works abnormally. |
1276
1277**Example**
1278
1279  ```ts
1280  import { BusinessError } from '@kit.BasicServicesKit';
1281  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1282  try {
1283    accountManager.getActivatedOsAccountLocalIds().then((idArray: number[]) => {
1284      console.log('getActivatedOsAccountLocalIds, idArray: ' + idArray);
1285    }).catch((err: BusinessError) => {
1286      console.error('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err));
1287    });
1288  } catch (e) {
1289    console.error('getActivatedOsAccountLocalIds exception: ' + JSON.stringify(e));
1290  }
1291  ```
1292
1293### getCurrentOsAccount<sup>(deprecated)</sup>
1294
1295getCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1296
1297Obtains information about the system account to which the current process belongs. This API uses an asynchronous callback to return the result.
1298
1299> **NOTE**
1300>
1301> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
1302
1303**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS<sup>10+</sup> (available only for system applications)
1304
1305**System capability**: SystemCapability.Account.OsAccount
1306
1307**Parameters**
1308
1309| Name  | Type                                                | Mandatory| Description                                          |
1310| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
1311| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account information obtained. Otherwise, **data** is an error object.|
1312
1313**Error codes**
1314
1315For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1316
1317| ID| Error Message            |
1318| -------- | ------------------- |
1319| 201 | Permission denied. |
1320| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1321| 12300001 | The system service works abnormally. |
1322
1323**Example**
1324
1325  ```ts
1326  import { BusinessError } from '@kit.BasicServicesKit';
1327  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1328  try {
1329    accountManager.getCurrentOsAccount((err: BusinessError, curAccountInfo: osAccount.OsAccountInfo)=>{
1330      if (err) {
1331        console.error('getCurrentOsAccount err:' + JSON.stringify(err));
1332      } else {
1333        console.log('getCurrentOsAccount curAccountInfo:' + JSON.stringify(curAccountInfo));
1334      }
1335    });
1336  } catch (e) {
1337    console.error('getCurrentOsAccount exception: ' + JSON.stringify(e));
1338  }
1339  ```
1340
1341### getCurrentOsAccount<sup>(deprecated)</sup>
1342
1343getCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
1344
1345Obtains information about the system account to which the current process belongs. This API uses a promise to return the result.
1346
1347> **NOTE**
1348>
1349> This API is supported since API version 9 and deprecated since API version 11. The substitute API is available only to system applications.
1350
1351**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS<sup>10+</sup> (available only for system applications)
1352
1353**System capability**: SystemCapability.Account.OsAccount
1354
1355**Return value**
1356
1357| Type                                          | Description                                      |
1358| ---------------------------------------------- | ----------------------------------------- |
1359| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return the system account information obtained.|
1360
1361**Error codes**
1362
1363For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1364
1365| ID| Error Message            |
1366| -------- | ------------------- |
1367| 201 | Permission denied. |
1368| 12300001 | The system service works abnormally. |
1369
1370**Example**
1371
1372  ```ts
1373  import { BusinessError } from '@kit.BasicServicesKit';
1374  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1375  try {
1376    accountManager.getCurrentOsAccount().then((accountInfo: osAccount.OsAccountInfo) => {
1377      console.log('getCurrentOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
1378    }).catch((err: BusinessError) => {
1379      console.error('getCurrentOsAccount err: ' + JSON.stringify(err));
1380    });
1381  } catch (e) {
1382    console.error('getCurrentOsAccount exception: ' + JSON.stringify(e));
1383  }
1384  ```
1385
1386### getOsAccountType<sup>9+</sup>
1387
1388getOsAccountType(callback: AsyncCallback&lt;OsAccountType&gt;): void
1389
1390Obtains the type of the account to which the current process belongs. This API uses an asynchronous callback to return the result.
1391
1392**System capability**: SystemCapability.Account.OsAccount
1393
1394**Parameters**
1395
1396| Name  | Type                                                | Mandatory| Description                                                |
1397| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------------- |
1398| callback | AsyncCallback&lt;[OsAccountType](#osaccounttype)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account type obtained. Otherwise, **err** is an error object.|
1399
1400**Error codes**
1401
1402For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1403
1404| ID| Error Message            |
1405| -------- | ------------------- |
1406| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1407| 12300001 | The system service works abnormally. |
1408
1409**Example**
1410
1411  ```ts
1412  import { BusinessError } from '@kit.BasicServicesKit';
1413  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1414  try {
1415    accountManager.getOsAccountType((err: BusinessError, accountType: osAccount.OsAccountType) => {
1416      if (err) {
1417        console.error('getOsAccountType err: ' + JSON.stringify(err));
1418      } else {
1419        console.log('getOsAccountType accountType: ' + accountType);
1420      }
1421    });
1422  } catch (e) {
1423    console.error('getOsAccountType exception: ' + JSON.stringify(e));
1424  }
1425  ```
1426
1427### getOsAccountType<sup>9+</sup>
1428
1429getOsAccountType(): Promise&lt;OsAccountType&gt;
1430
1431Obtains the type of the account to which the current process belongs. This API uses a promise to return the result.
1432
1433**System capability**: SystemCapability.Account.OsAccount
1434
1435**Return value**
1436
1437| Type                                          | Description                                            |
1438| ---------------------------------------------- | ----------------------------------------------- |
1439| Promise&lt;[OsAccountType](#osaccounttype)&gt; | Promise used to return the system account type obtained.|
1440
1441**Error codes**
1442
1443For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
1444
1445| ID| Error Message            |
1446| -------- | ------------------- |
1447| 12300001 | The system service works abnormally. |
1448
1449**Example**
1450
1451  ```ts
1452  import { BusinessError } from '@kit.BasicServicesKit';
1453  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1454  try {
1455    accountManager.getOsAccountType().then((accountType: osAccount.OsAccountType) => {
1456      console.log('getOsAccountType, accountType: ' + accountType);
1457    }).catch((err: BusinessError) => {
1458      console.error('getOsAccountType err: ' + JSON.stringify(err));
1459    });
1460  } catch (e) {
1461    console.error('getOsAccountType exception: ' + JSON.stringify(e));
1462  }
1463  ```
1464
1465### queryDistributedVirtualDeviceId<sup>9+</sup>
1466
1467queryDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
1468
1469Queries the ID of a distributed virtual device. This API uses an asynchronous callback to return the result.
1470
1471**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications) or ohos.permission.DISTRIBUTED_DATASYNC
1472
1473**System capability**: SystemCapability.Account.OsAccount
1474
1475**Parameters**
1476
1477| Name  | Type                       | Mandatory| Description                                                                  |
1478| -------- | --------------------------- | ---- | --------------------------------------------------------------------- |
1479| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the distributed virtual device ID obtained. Otherwise, **data** is an error object.|
1480
1481**Error codes**
1482
1483For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1484
1485| ID| Error Message            |
1486| -------- | ------------------- |
1487| 201 | Permission denied.|
1488| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1489| 12300001 | The system service works abnormally. |
1490
1491**Example**
1492
1493  ```ts
1494  import { BusinessError } from '@kit.BasicServicesKit';
1495  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1496  try {
1497    accountManager.queryDistributedVirtualDeviceId((err: BusinessError, virtualID: string) => {
1498      if (err) {
1499        console.error('queryDistributedVirtualDeviceId err: ' + JSON.stringify(err));
1500      } else {
1501        console.log('queryDistributedVirtualDeviceId virtualID: ' + virtualID);
1502      }
1503    });
1504  } catch (e) {
1505    console.error('queryDistributedVirtualDeviceId exception: ' + JSON.stringify(e));
1506  }
1507  ```
1508
1509### queryDistributedVirtualDeviceId<sup>9+</sup>
1510
1511queryDistributedVirtualDeviceId(): Promise&lt;string&gt;
1512
1513Queries the ID of this distributed virtual device. This API uses a promise to return the result.
1514
1515**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications) or ohos.permission.DISTRIBUTED_DATASYNC
1516
1517**System capability**: SystemCapability.Account.OsAccount
1518
1519**Return value**
1520
1521| Type                 | Description                             |
1522| --------------------- | --------------------------------- |
1523| Promise&lt;string&gt; | Promise used to return the distributed virtual device ID obtained.|
1524
1525**Error codes**
1526
1527For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1528
1529| ID| Error Message            |
1530| -------- | ------------------- |
1531| 201 | Permission denied.|
1532| 12300001 | The system service works abnormally. |
1533
1534**Example**
1535
1536  ```ts
1537  import { BusinessError } from '@kit.BasicServicesKit';
1538  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1539  try {
1540    accountManager.queryDistributedVirtualDeviceId().then((virtualID: string) => {
1541      console.log('queryDistributedVirtualDeviceId, virtualID: ' + virtualID);
1542    }).catch((err: BusinessError) => {
1543      console.error('queryDistributedVirtualDeviceId err: ' + JSON.stringify(err));
1544    });
1545  } catch (e) {
1546    console.error('queryDistributedVirtualDeviceId exception: ' + JSON.stringify(e));
1547  }
1548  ```
1549
1550### getOsAccountLocalIdForSerialNumber<sup>9+</sup>
1551
1552getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback&lt;number&gt;): void
1553
1554Obtains the system account ID based on the SN. This API uses an asynchronous callback to return the result.
1555
1556**System capability**: SystemCapability.Account.OsAccount
1557
1558**Parameters**
1559
1560| Name      | Type                       | Mandatory| Description                                                                          |
1561| ------------ | --------------------------- | ---- | ---------------------------------------------------------------------------- |
1562| serialNumber | number                      | Yes  | Account SN.                                                                   |
1563| callback     | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **err** is an error object.|
1564
1565**Error codes**
1566
1567For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1568
1569| ID| Error Message              |
1570| -------- | ------------------- |
1571| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1572| 12300001 | The system service works abnormally. |
1573| 12300002 | Invalid serialNumber. |
1574| 12300003 | The account indicated by serialNumber does not exist. |
1575
1576**Example**: Obtain the ID of the system account whose SN is 12345.
1577
1578  ```ts
1579  import { BusinessError } from '@kit.BasicServicesKit';
1580  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1581  let serialNumber: number = 12345;
1582  try {
1583    accountManager.getOsAccountLocalIdForSerialNumber(serialNumber, (err: BusinessError, localId: number)=>{
1584      if (err) {
1585        console.error(`get localId code is ${err.code}, message is ${err.message}`);
1586      } else {
1587        console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber);
1588      }
1589    });
1590  } catch (e) {
1591    const err = e as BusinessError;
1592    console.error(`get localId exception: code is ${err.code}, message is ${err.message}`);
1593  }
1594  ```
1595
1596### getOsAccountLocalIdForSerialNumber<sup>9+</sup>
1597
1598getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise&lt;number&gt;
1599
1600Obtains the system account ID based on the SN. This API uses a promise to return the result.
1601
1602**System capability**: SystemCapability.Account.OsAccount
1603
1604**Parameters**
1605
1606| Name      | Type  | Mandatory| Description      |
1607| ------------ | ------ | ---- | ---------- |
1608| serialNumber | number | Yes  | Account SN.|
1609
1610**Return value**
1611
1612| Type                 | Description                                        |
1613| --------------------- | -------------------------------------------- |
1614| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
1615
1616**Error codes**
1617
1618For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1619
1620| ID| Error Message              |
1621| -------- | ------------------- |
1622| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1623| 12300001 | The system service works abnormally. |
1624| 12300002 | Invalid serialNumber. |
1625| 12300003 | The account indicated by serialNumber does not exist. |
1626
1627**Example**: Obtain the ID of the system account whose SN is 12345.
1628
1629  ```ts
1630  import { BusinessError } from '@kit.BasicServicesKit';
1631  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1632  let serialNumber: number = 12345;
1633  try {
1634    accountManager.getOsAccountLocalIdForSerialNumber(serialNumber).then((localId: number) => {
1635      console.log('getOsAccountLocalIdForSerialNumber localId: ' + localId);
1636    }).catch((err: BusinessError) => {
1637      console.error('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err));
1638    });
1639  } catch (e) {
1640    console.error('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e));
1641  }
1642  ```
1643
1644### getSerialNumberForOsAccountLocalId<sup>9+</sup>
1645
1646getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback&lt;number&gt;): void
1647
1648Obtains the SN of a system account based on the account ID. This API uses an asynchronous callback to return the result.
1649
1650**System capability**: SystemCapability.Account.OsAccount
1651
1652**Parameters**
1653
1654| Name  | Type                       | Mandatory| Description                                                                        |
1655| -------- | --------------------------- | ---- | -------------------------------------------------------------------------- |
1656| localId  | number                      | Yes  | ID of the target system account.                                                                |
1657| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the SN obtained. Otherwise, **err** is an error object.|
1658
1659**Error codes**
1660
1661For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1662
1663| ID| Error Message            |
1664| -------- | ------------------- |
1665| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1666| 12300001 | The system service works abnormally. |
1667| 12300002 | Invalid localId.    |
1668| 12300003 | Account not found. |
1669
1670**Example**: Obtain the SN of the system account 100.
1671
1672  ```ts
1673  import { BusinessError } from '@kit.BasicServicesKit';
1674  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1675  let localId: number = 100;
1676  try {
1677    accountManager.getSerialNumberForOsAccountLocalId(localId, (err: BusinessError, serialNumber: number)=>{
1678      if (err) {
1679        console.error(`get serialNumber code is ${err.code}, message is ${err.message}`);
1680      } else {
1681        console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId);
1682      }
1683    });
1684  } catch (e) {
1685    const err = e as BusinessError;
1686    console.error(`get serialNumber exception: code is ${err.code}, message is ${err.message}`);
1687  }
1688  ```
1689
1690### getSerialNumberForOsAccountLocalId<sup>9+</sup>
1691
1692getSerialNumberForOsAccountLocalId(localId: number): Promise&lt;number&gt;
1693
1694Obtains the SN of a system account based on the account ID. This API uses a promise to return the result.
1695
1696**System capability**: SystemCapability.Account.OsAccount
1697
1698**Parameters**
1699
1700| Name | Type  | Mandatory| Description         |
1701| ------- | ------ | ---- | ----------- |
1702| localId | number | Yes  | ID of the target system account.|
1703
1704**Return value**
1705
1706| Type                 | Description                                   |
1707| :-------------------- | :------------------------------------- |
1708| Promise&lt;number&gt; | Promise used to return the SN obtained.|
1709
1710**Error codes**
1711
1712For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
1713
1714| ID| Error Message            |
1715| -------- | ------------------- |
1716| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1717| 12300001 | The system service works abnormally. |
1718| 12300002 | Invalid localId.    |
1719| 12300003 | Account not found. |
1720
1721**Example**: Obtain the SN of the system account 100.
1722
1723  ```ts
1724  import { BusinessError } from '@kit.BasicServicesKit';
1725  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1726  let localId: number = 100;
1727  try {
1728    accountManager.getSerialNumberForOsAccountLocalId(localId).then((serialNumber: number) => {
1729      console.log('getSerialNumberForOsAccountLocalId serialNumber: ' + serialNumber);
1730    }).catch((err: BusinessError) => {
1731      console.error('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err));
1732    });
1733  } catch (e) {
1734    console.error('getSerialNumberForOsAccountLocalId exception: ' + JSON.stringify(e));
1735  }
1736  ```
1737
1738### isMultiOsAccountEnable<sup>(deprecated)</sup>
1739
1740isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
1741
1742Checks whether multiple system accounts are supported. This API uses an asynchronous callback to return the result.
1743
1744> **NOTE**
1745>
1746> This API is supported since API version 7 and deprecated since API version 9. Use [checkMultiOsAccountEnabled](#checkmultiosaccountenabled9) instead.
1747
1748**System capability**: SystemCapability.Account.OsAccount
1749
1750**Parameters**
1751
1752| Name  | Type                        | Mandatory| Description                                                    |
1753| -------- | ---------------------------- | ---- | ------------------------------------------------------ |
1754| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means multiple system accounts are supported; the value **false** means the opposite.|
1755
1756**Example**
1757
1758  ```ts
1759  import { BusinessError } from '@kit.BasicServicesKit';
1760  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1761  accountManager.isMultiOsAccountEnable((err: BusinessError, isEnabled: boolean) => {
1762    if (err) {
1763      console.error('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
1764    } else {
1765    console.log('isMultiOsAccountEnable successfully, isEnabled: ' + isEnabled);
1766    }
1767  });
1768  ```
1769
1770### isMultiOsAccountEnable<sup>(deprecated)</sup>
1771
1772isMultiOsAccountEnable(): Promise&lt;boolean&gt;
1773
1774Checks whether multiple system accounts are supported. This API uses a promise to return the result.
1775
1776> **NOTE**
1777>
1778> This API is supported since API version 7 and deprecated since API version 9. Use [checkMultiOsAccountEnabled](#checkmultiosaccountenabled9-1) instead.
1779
1780**System capability**: SystemCapability.Account.OsAccount
1781
1782**Return value**
1783
1784| Type                  | Description                                                      |
1785| :--------------------- | :--------------------------------------------------------- |
1786| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means multiple system accounts are supported; the value **false** means the opposite.|
1787
1788**Example**
1789
1790  ```ts
1791  import { BusinessError } from '@kit.BasicServicesKit';
1792  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1793  accountManager.isMultiOsAccountEnable().then((isEnabled: boolean) => {
1794    console.log('isMultiOsAccountEnable successfully, isEnabled: ' + isEnabled);
1795  }).catch((err: BusinessError) => {
1796    console.error('isMultiOsAccountEnable failed, error: ' + JSON.stringify(err));
1797  });
1798  ```
1799
1800### isOsAccountActived<sup>(deprecated)</sup>
1801
1802isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
1803
1804Checks whether a system account is activated. This API uses an asynchronous callback to return the result.
1805
1806> **NOTE**
1807>
1808> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
1809
1810**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
1811
1812**System capability**: SystemCapability.Account.OsAccount
1813
1814**Parameters**
1815
1816| Name  | Type                        | Mandatory| Description                                                    |
1817| -------- | ---------------------------- | ---- | ------------------------------------------------------ |
1818| localId  | number                       | Yes  | ID of the target system account.                                           |
1819| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the account is activated; the value **false** means the opposite.|
1820
1821**Example**: Check whether system account 100 is activated.
1822
1823  ```ts
1824  import { BusinessError } from '@kit.BasicServicesKit';
1825  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1826  let localId: number = 100;
1827  accountManager.isOsAccountActived(localId, (err: BusinessError, isActived: boolean) => {
1828    if (err) {
1829      console.error('isOsAccountActived failed, err:' + JSON.stringify(err));
1830    } else {
1831      console.log('isOsAccountActived successfully, isActived:' + isActived);
1832    }
1833  });
1834  ```
1835
1836### isOsAccountActived<sup>(deprecated)</sup>
1837
1838isOsAccountActived(localId: number): Promise&lt;boolean&gt;
1839
1840Checks whether a system account is activated. This API uses a promise to return the result.
1841
1842> **NOTE**
1843>
1844> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
1845
1846**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
1847
1848**System capability**: SystemCapability.Account.OsAccount
1849
1850**Parameters**
1851
1852| Name | Type  | Mandatory| Description                              |
1853| ------- | ------ | ---- | --------------------------------- |
1854| localId | number | Yes  | ID of the target system account.|
1855
1856**Return value**
1857
1858| Type                  | Description                                                       |
1859| --------------------- | ----------------------------------------------------------- |
1860| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the account is activated; the value **false** means the opposite.|
1861
1862**Example**: Check whether system account 100 is activated.
1863
1864  ```ts
1865  import { BusinessError } from '@kit.BasicServicesKit';
1866  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1867  let localId: number = 100;
1868  accountManager.isOsAccountActived(localId).then((isActived: boolean) => {
1869    console.log('isOsAccountActived successfully, isActived: ' + isActived);
1870  }).catch((err: BusinessError) => {
1871    console.error('isOsAccountActived failed, error: ' + JSON.stringify(err));
1872  });
1873  ```
1874
1875### isOsAccountConstraintEnable<sup>(deprecated)</sup>
1876
1877isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback&lt;boolean&gt;): void
1878
1879Checks whether the specified constraint is enabled for a system account. This API uses an asynchronous callback to return the result.
1880
1881> **NOTE**
1882>
1883> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
1884
1885**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1886
1887**System capability**: SystemCapability.Account.OsAccount
1888
1889**Parameters**
1890
1891| Name    | Type                        | Mandatory| Description                                                               |
1892| ---------- | ---------------------------- | ---- | ----------------------------------------------------------------- |
1893| localId    | number                       | Yes  | ID of the target system account.                                |
1894| constraint | string                       | Yes  | [Constraint](#constraints) to check.                               |
1895| callback   | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
1896
1897**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
1898
1899  ```ts
1900  import { BusinessError } from '@kit.BasicServicesKit';
1901  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1902  let localId: number = 100;
1903  let constraint: string = 'constraint.wifi';
1904  accountManager.isOsAccountConstraintEnable(localId, constraint, (err: BusinessError, isEnabled: boolean) => {
1905    if (err) {
1906      console.error('isOsAccountConstraintEnable failed, error: ' + JSON.stringify(err));
1907    } else {
1908      console.log('isOsAccountConstraintEnable successfully, isEnabled: ' + isEnabled);
1909    }
1910  });
1911  ```
1912
1913### isOsAccountConstraintEnable<sup>(deprecated)</sup>
1914
1915isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boolean&gt;
1916
1917Checks whether the specified constraint is enabled for a system account. This API uses a promise to return the result.
1918
1919> **NOTE**
1920>
1921> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
1922
1923**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
1924
1925**System capability**: SystemCapability.Account.OsAccount
1926
1927**Parameters**
1928
1929| Name    | Type  | Mandatory| Description                                |
1930| ---------- | ------ | ---- | ---------------------------------- |
1931| localId    | number | Yes  | ID of the target system account. |
1932| constraint | string | Yes  | [Constraint](#constraints) to check.|
1933
1934**Return value**
1935
1936| Type                  | Description                                                                  |
1937| ---------------------- | --------------------------------------------------------------------- |
1938| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
1939
1940**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
1941
1942  ```ts
1943  import { BusinessError } from '@kit.BasicServicesKit';
1944  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1945  let localId: number = 100;
1946  let constraint: string = 'constraint.wifi';
1947  accountManager.isOsAccountConstraintEnable(localId, constraint).then((isEnabled: boolean) => {
1948    console.log('isOsAccountConstraintEnable successfully, isEnabled: ' + isEnabled);
1949  }).catch((err: BusinessError) => {
1950    console.error('isOsAccountConstraintEnable err: ' + JSON.stringify(err));
1951  });
1952  ```
1953
1954### isTestOsAccount<sup>(deprecated)</sup>
1955
1956isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
1957
1958Checks whether this system account is a test account. This API uses an asynchronous callback to return the result.
1959
1960> **NOTE**
1961>
1962> This API is supported since API version 7 and deprecated since API version 9. Use [checkOsAccountTestable](#checkosaccounttestable9) instead.
1963
1964**System capability**: SystemCapability.Account.OsAccount
1965
1966**Parameters**
1967
1968| Name  | Type                        | Mandatory| Description                                                                  |
1969| -------- | ---------------------------- | ---- | --------------------------------------------------------------------- |
1970| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the account is a test account; the value **false** means the opposite.|
1971
1972**Example**
1973
1974  ```ts
1975  import { BusinessError } from '@kit.BasicServicesKit';
1976  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1977  accountManager.isTestOsAccount((err: BusinessError, isTestable: boolean) => {
1978    if (err) {
1979      console.error('isTestOsAccount failed, error: ' + JSON.stringify(err));
1980    } else {
1981      console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
1982    }
1983  });
1984  ```
1985
1986### isTestOsAccount<sup>(deprecated)</sup>
1987
1988isTestOsAccount(): Promise&lt;boolean&gt;
1989
1990Checks whether this system account is a test account. This API uses a promise to return the result.
1991
1992> **NOTE**
1993>
1994> This API is supported since API version 7 and deprecated since API version 9. Use [checkOsAccountTestable](#checkosaccounttestable9-1) instead.
1995
1996**System capability**: SystemCapability.Account.OsAccount
1997
1998**Return value**
1999
2000| Type                  | Description                                                                     |
2001| ---------------------- | ------------------------------------------------------------------------ |
2002| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the account is a test account; the value **false** means the opposite.|
2003
2004**Example**
2005
2006  ```ts
2007  import { BusinessError } from '@kit.BasicServicesKit';
2008  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2009    accountManager.isTestOsAccount().then((isTestable: boolean) => {
2010      console.log('isTestOsAccount successfully, isTestable: ' + isTestable);
2011    }).catch((err: BusinessError) => {
2012      console.error('isTestOsAccount failed, error: ' + JSON.stringify(err));
2013  });
2014  ```
2015
2016### isOsAccountVerified<sup>(deprecated)</sup>
2017
2018isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
2019
2020Checks whether a system account has been verified. This API uses an asynchronous callback to return the result.
2021
2022> **NOTE**
2023>
2024> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkOsAccountVerified](#checkosaccountverifieddeprecated).
2025
2026**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
2027
2028**System capability**: SystemCapability.Account.OsAccount
2029
2030**Parameters**
2031
2032| Name  | Type                        | Mandatory| Description                                                           |
2033| -------- | ---------------------------- | ---- | ------------------------------------------------------------- |
2034| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
2035
2036**Example**
2037
2038  ```ts
2039  import { BusinessError } from '@kit.BasicServicesKit';
2040  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2041  accountManager.isOsAccountVerified((err: BusinessError, isVerified: boolean) => {
2042    if (err) {
2043      console.error('isOsAccountVerified failed, error: ' + JSON.stringify(err));
2044    } else {
2045      console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
2046    }
2047  });
2048  ```
2049
2050### isOsAccountVerified<sup>(deprecated)</sup>
2051
2052isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
2053
2054Checks whether a system account has been verified. This API uses an asynchronous callback to return the result.
2055
2056> **NOTE**
2057>
2058> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2059
2060**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
2061
2062**System capability**: SystemCapability.Account.OsAccount
2063
2064**Parameters**
2065
2066| Name  | Type                        | Mandatory| Description                                                           |
2067| -------- | ---------------------------- | ---- | ------------------------------------------------------------- |
2068| localId  | number                       | Yes  | ID of the target system account.                            |
2069| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
2070
2071**Example**
2072
2073  ```ts
2074  import { BusinessError } from '@kit.BasicServicesKit';
2075  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2076  let localId: number = 100;
2077  accountManager.isOsAccountVerified(localId, (err: BusinessError, isVerified: boolean) => {
2078    if (err) {
2079      console.error('isOsAccountVerified failed, error: ' + JSON.stringify(err));
2080    } else {
2081      console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
2082    }
2083  });
2084  ```
2085
2086### isOsAccountVerified<sup>(deprecated)</sup>
2087
2088isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
2089
2090Checks whether a system account has been verified. This API uses a promise to return the result.
2091
2092> **NOTE**
2093>
2094> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2095
2096**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available only for system applications)
2097
2098**System capability**: SystemCapability.Account.OsAccount
2099
2100**Parameters**
2101
2102| Name | Type  | Mandatory| Description                                                             |
2103| ------- | ------ | ---- | ---------------------------------------------------------------- |
2104| localId | number | No  | ID of the target system account. If this parameter is not specified, this API checks whether the current system account has been verified. The default value is **-1**.|
2105
2106**Return value**
2107
2108| Type                  | Description                                                              |
2109| ---------------------- | ----------------------------------------------------------------- |
2110| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
2111
2112**Example**
2113
2114  ```ts
2115  import { BusinessError } from '@kit.BasicServicesKit';
2116  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2117  accountManager.isOsAccountVerified().then((isVerified: boolean) => {
2118    console.log('isOsAccountVerified successfully, isVerified: ' + isVerified);
2119  }).catch((err: BusinessError) => {
2120    console.error('isOsAccountVerified failed, error: ' + JSON.stringify(err));
2121  });
2122  ```
2123
2124### getCreatedOsAccountsCount<sup>(deprecated)</sup>
2125
2126getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
2127
2128Obtains the number of system accounts created. This API uses an asynchronous callback to return the result.
2129
2130> **NOTE**
2131>
2132> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountCount](#getosaccountcount9) instead.
2133
2134**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2135
2136**System capability**: SystemCapability.Account.OsAccount
2137
2138**Parameters**
2139
2140| Name  | Type                       | Mandatory| Description                                                                        |
2141| -------- | --------------------------- | ---- | -------------------------------------------------------------------------- |
2142| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the number of created system accounts. If the operation fails, **err** is an error object.|
2143
2144**Example**
2145
2146  ```ts
2147  import { BusinessError } from '@kit.BasicServicesKit';
2148  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2149  accountManager.getCreatedOsAccountsCount((err: BusinessError, count: number)=>{
2150    if (err) {
2151      console.error('getCreatedOsAccountsCount failed, error: ' + JSON.stringify(err));
2152    } else {
2153      console.log('getCreatedOsAccountsCount successfully, count: ' + count);
2154    }
2155  });
2156  ```
2157
2158### getCreatedOsAccountsCount<sup>(deprecated)</sup>
2159
2160getCreatedOsAccountsCount(): Promise&lt;number&gt;
2161
2162Obtains the number of system accounts created. This API uses a promise to return the result.
2163
2164> **NOTE**
2165>
2166> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountCount](#getosaccountcount9-1) instead.
2167
2168**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2169
2170**System capability**: SystemCapability.Account.OsAccount
2171
2172**Return value**
2173
2174| Type                 | Description                                   |
2175| --------------------- | -------------------------------------- |
2176| Promise&lt;number&gt; | Promise used to return the number of created system accounts.|
2177
2178**Example**
2179
2180  ```ts
2181  import { BusinessError } from '@kit.BasicServicesKit';
2182  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2183  accountManager.getCreatedOsAccountsCount().then((count: number) => {
2184    console.log('getCreatedOsAccountsCount successfully, count: ' + count);
2185  }).catch((err: BusinessError) => {
2186    console.error('getCreatedOsAccountsCount failed, error: ' + JSON.stringify(err));
2187  });
2188  ```
2189
2190### getOsAccountLocalIdFromProcess<sup>(deprecated)</sup>
2191
2192getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
2193
2194Obtains the ID of the system account to which the current process belongs. This API uses an asynchronous callback to return the result.
2195
2196> **NOTE**
2197>
2198> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountLocalId](#getosaccountlocalid9) instead.
2199
2200**System capability**: SystemCapability.Account.OsAccount
2201
2202**Parameters**
2203
2204| Name  | Type                       | Mandatory| Description                                                                          |
2205| -------- | --------------------------- | ---- | ---------------------------------------------------------------------------- |
2206| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **err** is an error object.|
2207
2208**Example**
2209
2210  ```ts
2211  import { BusinessError } from '@kit.BasicServicesKit';
2212  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2213  accountManager.getOsAccountLocalIdFromProcess((err: BusinessError, localId: number) => {
2214    if (err) {
2215      console.error('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
2216    } else {
2217      console.log('getOsAccountLocalIdFromProcess id:: ' + localId);
2218    }
2219  });
2220  ```
2221
2222### getOsAccountLocalIdFromProcess<sup>(deprecated)</sup>
2223
2224getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
2225
2226Obtains the ID of the system account to which the current process belongs. This API uses a promise to return the result.
2227
2228> **NOTE**
2229>
2230> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountLocalId](#getosaccountlocalid9-1) instead.
2231
2232**System capability**: SystemCapability.Account.OsAccount
2233
2234**Return value**
2235
2236| Type                 | Description                                     |
2237| :-------------------- | :--------------------------------------- |
2238| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
2239
2240**Example**
2241
2242  ```ts
2243  import { BusinessError } from '@kit.BasicServicesKit';
2244  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2245  accountManager.getOsAccountLocalIdFromProcess().then((localId: number) => {
2246    console.log('getOsAccountLocalIdFromProcess successfully, localId: ' + localId);
2247  }).catch((err: BusinessError) => {
2248    console.error('getOsAccountLocalIdFromProcess failed, error: ' + JSON.stringify(err));
2249  });
2250  ```
2251
2252### getOsAccountLocalIdFromUid<sup>(deprecated)</sup>
2253
2254getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;): void
2255
2256Obtains the system account ID based on the process UID. This API uses an asynchronous callback to return the result.
2257
2258> **NOTE**
2259>
2260> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9) instead.
2261
2262**System capability**: SystemCapability.Account.OsAccount
2263
2264**Parameters**
2265
2266| Name  | Type                       | Mandatory| Description                                                                   |
2267| -------- | --------------------------- | ---- | --------------------------------------------------------------------- |
2268| uid      | number                      | Yes  | Process UID.                                                             |
2269| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **data** is an error object.|
2270
2271**Example**: Obtain the ID of the system account whose process UID is **12345678**.
2272
2273  ```ts
2274  import { BusinessError } from '@kit.BasicServicesKit';
2275  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2276  let uid: number = 12345678;
2277  accountManager.getOsAccountLocalIdFromUid(uid, (err: BusinessError, localId: number) => {
2278    if (err) {
2279      console.error('getOsAccountLocalIdFromUid failed, error: ' + JSON.stringify(err));
2280    } else {
2281      console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
2282    }
2283  });
2284  ```
2285
2286### getOsAccountLocalIdFromUid<sup>(deprecated)</sup>
2287
2288getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
2289
2290Obtains the system account ID based on the process UID. This API uses a promise to return the result.
2291
2292> **NOTE**
2293>
2294> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9-1) instead.
2295
2296**System capability**: SystemCapability.Account.OsAccount
2297
2298**Parameters**
2299
2300| Name| Type  | Mandatory| Description     |
2301| ------ | ------ | ---- | --------- |
2302| uid    | number | Yes  | Process UID.|
2303
2304**Return value**
2305
2306| Type                 | Description                                 |
2307| :-------------------- | :----------------------------------- |
2308| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
2309
2310**Example**: Obtain the ID of the system account whose process UID is **12345678**.
2311
2312  ```ts
2313  import { BusinessError } from '@kit.BasicServicesKit';
2314  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2315  let uid: number = 12345678;
2316  accountManager.getOsAccountLocalIdFromUid(uid).then((localId: number) => {
2317    console.log('getOsAccountLocalIdFromUid successfully, localId: ' + localId);
2318  }).catch((err: BusinessError) => {
2319    console.error('getOsAccountLocalIdFromUid failed, error: ' + JSON.stringify(err));
2320  });
2321  ```
2322
2323### getOsAccountLocalIdFromDomain<sup>(deprecated)</sup>
2324
2325getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;number&gt;): void
2326
2327Obtains the system account ID based on the domain account information. This API uses an asynchronous callback to return the result.
2328
2329> **NOTE**
2330>
2331> This API is supported since API version 8 and deprecated since API version 9. Use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9) instead.
2332
2333**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2334
2335**System capability**: SystemCapability.Account.OsAccount
2336
2337**Parameters**
2338
2339| Name    | Type                                   | Mandatory| Description                                                                        |
2340| ---------- | --------------------------------------- | ---- | --------------------------------------------------------------------------- |
2341| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.                                                               |
2342| callback   | AsyncCallback&lt;number&gt;             | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **err** is an error object.|
2343
2344**Example**
2345
2346  ```ts
2347  import { BusinessError } from '@kit.BasicServicesKit';
2348  let domainInfo: osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
2349  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2350  accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err: BusinessError, localId: number) => {
2351    if (err) {
2352      console.error('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
2353    } else {
2354      console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
2355    }
2356  });
2357  ```
2358
2359### getOsAccountLocalIdFromDomain<sup>(deprecated)</sup>
2360
2361getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&gt;
2362
2363Obtains the system account ID based on the domain account information. This API uses a promise to return the result.
2364
2365> **NOTE**
2366>
2367> This API is supported since API version 8 and deprecated since API version 9. Use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9-1) instead.
2368
2369**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2370
2371**System capability**: SystemCapability.Account.OsAccount
2372
2373**Parameters**
2374
2375| Name    | Type                                   | Mandatory| Description        |
2376| ---------- | --------------------------------------- | ---- | ------------ |
2377| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.|
2378
2379**Return value**
2380
2381| Type                 | Description                                   |
2382| :-------------------- | :------------------------------------- |
2383| Promise&lt;number&gt; | Promise used to return the ID of the system account associated with the domain account.|
2384
2385**Example**
2386
2387  ```ts
2388  import { BusinessError } from '@kit.BasicServicesKit';
2389  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2390  let domainInfo: osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
2391  accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((localId: number) => {
2392    console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
2393  }).catch((err: BusinessError) => {
2394    console.error('getOsAccountLocalIdFromDomain failed, error: ' + JSON.stringify(err));
2395  });
2396  ```
2397
2398### getOsAccountAllConstraints<sup>(deprecated)</sup>
2399
2400getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
2401
2402Obtains all constraints enabled for a system account. This API uses an asynchronous callback to return the result.
2403
2404> **NOTE**
2405>
2406> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2407
2408**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2409
2410**System capability**: SystemCapability.Account.OsAccount
2411
2412**Parameters**
2413
2414| Name  | Type                                    | Mandatory| Description                                                                                            |
2415| -------- | ---------------------------------------- | ---- | ---------------------------------------------------------------------------------------------- |
2416| localId  | number                                   | Yes  | ID of the target system account.                                                                                   |
2417| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a list of all [constraints](#constraints) enabled for the system account. Otherwise, **err** is an error object.|
2418
2419**Example**: Obtain all constraints of system account 100.
2420
2421  ```ts
2422  import { BusinessError } from '@kit.BasicServicesKit';
2423  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2424  let localId: number = 100;
2425  accountManager.getOsAccountAllConstraints(localId, (err: BusinessError, constraints: string[])=>{
2426    if (err) {
2427      console.error('getOsAccountAllConstraints err:' + JSON.stringify(err));
2428    } else {
2429      console.log('getOsAccountAllConstraints:' + JSON.stringify(constraints));
2430    }
2431  });
2432  ```
2433
2434### getOsAccountAllConstraints<sup>(deprecated)</sup>
2435
2436getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
2437
2438Obtains all constraints enabled for a system account. This API uses a promise to return the result.
2439
2440> **NOTE**
2441>
2442> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2443
2444**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2445
2446**System capability**: SystemCapability.Account.OsAccount
2447
2448**Parameters**
2449
2450| Name | Type  | Mandatory| Description        |
2451| ------- | ------ | ---- | ------------ |
2452| localId | number | Yes  | ID of the target system account.|
2453
2454**Return value**
2455
2456| Type                              | Description                                                        |
2457| :--------------------------------- | :----------------------------------------------------------- |
2458| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return all the [constraints](#constraints) enabled for the system account.|
2459
2460**Example**: Obtain all constraints of system account 100.
2461
2462  ```ts
2463  import { BusinessError } from '@kit.BasicServicesKit';
2464  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2465  let localId: number = 100;
2466  accountManager.getOsAccountAllConstraints(localId).then((constraints: string[]) => {
2467    console.log('getOsAccountAllConstraints, constraints: ' + constraints);
2468  }).catch((err: BusinessError) => {
2469    console.error('getOsAccountAllConstraints err: ' + JSON.stringify(err));
2470  });
2471  ```
2472
2473### queryActivatedOsAccountIds<sup>(deprecated)</sup>
2474
2475queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
2476
2477Obtains information about all activated system accounts. This API uses an asynchronous callback to return the result.
2478
2479> **NOTE**
2480>
2481> This API is supported since API version 8 and deprecated since API version 9. Use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9) instead.
2482
2483**System capability**: SystemCapability.Account.OsAccount
2484
2485**Parameters**
2486
2487| Name  | Type                                    | Mandatory| Description                                                  |
2488| -------- | ---------------------------------------- | ---- | ------------------------------------------------------ |
2489| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a list of activated system accounts. Otherwise, **data** is an error object.|
2490
2491**Example**
2492
2493  ```ts
2494  import { BusinessError } from '@kit.BasicServicesKit';
2495  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2496  accountManager.queryActivatedOsAccountIds((err: BusinessError, idArray: number[])=>{
2497      if (err) {
2498        console.error('queryActivatedOsAccountIds err:' + JSON.stringify(err));
2499      } else {
2500        console.log('queryActivatedOsAccountIds idArray length:' + idArray.length);
2501        for(let i=0;i<idArray.length;i++) {
2502          console.info('activated os account id: ' + idArray[i]);
2503        }
2504      }
2505  });
2506  ```
2507
2508### queryActivatedOsAccountIds<sup>(deprecated)</sup>
2509
2510queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
2511
2512> **NOTE**
2513>
2514> This API is supported since API version 8 and deprecated since API version 9. Use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9-1) instead.
2515
2516Obtains information about all activated system accounts. This API uses a promise to return the result.
2517
2518**System capability**: SystemCapability.Account.OsAccount
2519
2520**Return value**
2521
2522| Type                              | Description                                              |
2523| ---------------------------------- | ------------------------------------------------- |
2524| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return the information about all activated system accounts.|
2525
2526**Example**
2527
2528  ```ts
2529  import { BusinessError } from '@kit.BasicServicesKit';
2530  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2531  accountManager.queryActivatedOsAccountIds().then((idArray: number[]) => {
2532    console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
2533  }).catch((err: BusinessError) => {
2534    console.error('queryActivatedOsAccountIds err: ' + JSON.stringify(err));
2535  });
2536  ```
2537
2538### queryCurrentOsAccount<sup>(deprecated)</sup>
2539
2540queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
2541
2542Obtains information about the system account to which the current process belongs. This API uses an asynchronous callback to return the result.
2543
2544> **NOTE**
2545>
2546> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2547
2548**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2549
2550**System capability**: SystemCapability.Account.OsAccount
2551
2552**Parameters**
2553
2554| Name  | Type                                                | Mandatory| Description                                          |
2555| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
2556| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account information obtained. Otherwise, **data** is an error object.|
2557
2558**Example**
2559
2560  ```ts
2561  import { BusinessError } from '@kit.BasicServicesKit';
2562  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2563  accountManager.queryCurrentOsAccount((err: BusinessError, curAccountInfo: osAccount.OsAccountInfo)=>{
2564    if (err) {
2565      console.error('queryCurrentOsAccount err:' + JSON.stringify(err));
2566    } else {
2567      console.log('queryCurrentOsAccount curAccountInfo:' + JSON.stringify(curAccountInfo));
2568    }
2569  });
2570  ```
2571
2572### queryCurrentOsAccount<sup>(deprecated)</sup>
2573
2574queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
2575
2576Obtains information about the system account to which the current process belongs. This API uses a promise to return the result.
2577
2578> **NOTE**
2579>
2580> This API is supported since API version 7 and deprecated since API version 9. The substitute API is available only to system applications.
2581
2582**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications)
2583
2584**System capability**: SystemCapability.Account.OsAccount
2585
2586**Return value**
2587
2588| Type                                          | Description                                      |
2589| ---------------------------------------------- | ------------------------------------------ |
2590| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return the system account information obtained.|
2591
2592**Example**
2593
2594  ```ts
2595  import { BusinessError } from '@kit.BasicServicesKit';
2596  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2597  accountManager.queryCurrentOsAccount().then((accountInfo: osAccount.OsAccountInfo) => {
2598    console.log('queryCurrentOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
2599  }).catch((err: BusinessError) => {
2600    console.error('queryCurrentOsAccount err: ' + JSON.stringify(err));
2601  });
2602  ```
2603
2604### getOsAccountTypeFromProcess<sup>(deprecated)</sup>
2605
2606getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
2607
2608Obtains the type of the account to which the current process belongs. This API uses an asynchronous callback to return the result.
2609
2610> **NOTE**
2611>
2612> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountType](#getosaccounttype9) instead.
2613
2614**System capability**: SystemCapability.Account.OsAccount
2615
2616**Parameters**
2617
2618| Name  | Type                                                | Mandatory| Description                                                |
2619| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------------- |
2620| callback | AsyncCallback&lt;[OsAccountType](#osaccounttype)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account type obtained. Otherwise, **err** is an error object.|
2621
2622**Example**
2623
2624  ```ts
2625  import { BusinessError } from '@kit.BasicServicesKit';
2626  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2627  accountManager.getOsAccountTypeFromProcess((err: BusinessError, accountType: osAccount.OsAccountType) => {
2628    if (err) {
2629      console.error('getOsAccountTypeFromProcess err: ' + JSON.stringify(err));
2630    } else {
2631      console.log('getOsAccountTypeFromProcess accountType: ' + accountType);
2632    }
2633  });
2634  ```
2635
2636### getOsAccountTypeFromProcess<sup>(deprecated)</sup>
2637
2638getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
2639
2640Obtains the type of the account to which the current process belongs. This API uses a promise to return the result.
2641
2642> **NOTE**
2643>
2644> This API is supported since API version 7 and deprecated since API version 9. Use [getOsAccountType](#getosaccounttype9-1) instead.
2645
2646**System capability**: SystemCapability.Account.OsAccount
2647
2648**Return value**
2649
2650| Type                                          | Description                                           |
2651| ---------------------------------------------- | ----------------------------------------------- |
2652| Promise&lt;[OsAccountType](#osaccounttype)&gt; | Promise used to return the system account type obtained.|
2653
2654**Example**
2655
2656  ```ts
2657  import { BusinessError } from '@kit.BasicServicesKit';
2658  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2659  accountManager.getOsAccountTypeFromProcess().then((accountType: osAccount.OsAccountType) => {
2660    console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
2661  }).catch((err: BusinessError) => {
2662    console.error('getOsAccountTypeFromProcess err: ' + JSON.stringify(err));
2663  });
2664  ```
2665
2666### getDistributedVirtualDeviceId<sup>(deprecated)</sup>
2667
2668getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
2669
2670Obtains the ID of a distributed virtual device. This API uses an asynchronous callback to return the result.
2671
2672> **NOTE**
2673>
2674> This API is supported since API version 7 and deprecated since API version 9. Use [queryDistributedVirtualDeviceId](#querydistributedvirtualdeviceid9) instead.
2675
2676**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications) or ohos.permission.DISTRIBUTED_DATASYNC
2677
2678**System capability**: SystemCapability.Account.OsAccount
2679
2680**Parameters**
2681
2682| Name  | Type                       | Mandatory| Description                                                                   |
2683| -------- | --------------------------- | ---- | --------------------------------------------------------------------- |
2684| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the distributed virtual device ID obtained. Otherwise, **data** is an error object.|
2685
2686**Example**
2687
2688  ```ts
2689  import { BusinessError } from '@kit.BasicServicesKit';
2690  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2691  accountManager.getDistributedVirtualDeviceId((err: BusinessError, virtualID: string) => {
2692    if (err) {
2693      console.error('getDistributedVirtualDeviceId err: ' + JSON.stringify(err));
2694    } else {
2695      console.log('getDistributedVirtualDeviceId virtualID: ' + virtualID);
2696    }
2697  });
2698  ```
2699
2700### getDistributedVirtualDeviceId<sup>(deprecated)</sup>
2701
2702getDistributedVirtualDeviceId(): Promise&lt;string&gt;
2703
2704Obtains the ID of this distributed virtual device. This API uses a promise to return the result.
2705
2706> **NOTE**
2707>
2708> This API is supported since API version 7 and deprecated since API version 9. Use [queryDistributedVirtualDeviceId](#querydistributedvirtualdeviceid9-1) instead.
2709
2710**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS (available only for system applications) or ohos.permission.DISTRIBUTED_DATASYNC
2711
2712**System capability**: SystemCapability.Account.OsAccount
2713
2714**Return value**
2715
2716| Type                 | Description                             |
2717| --------------------- | --------------------------------- |
2718| Promise&lt;string&gt; | Promise used to return the distributed virtual device ID obtained.|
2719
2720**Example**
2721
2722  ```ts
2723  import { BusinessError } from '@kit.BasicServicesKit';
2724  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2725  accountManager.getDistributedVirtualDeviceId().then((virtualID: string) => {
2726    console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
2727  }).catch((err: BusinessError) => {
2728    console.error('getDistributedVirtualDeviceId err: ' + JSON.stringify(err));
2729  });
2730  ```
2731
2732### getOsAccountLocalIdBySerialNumber<sup>(deprecated)</sup>
2733
2734getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&lt;number&gt;): void
2735
2736Obtains the system account ID based on the SN. This API uses an asynchronous callback to return the result.
2737
2738> **NOTE**
2739>
2740> This API is supported since API version 8 and deprecated since API version 9. Use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9) instead.
2741
2742**System capability**: SystemCapability.Account.OsAccount
2743
2744**Parameters**
2745
2746| Name      | Type                       | Mandatory| Description                                                                              |
2747| ------------ | --------------------------- | ---- | -------------------------------------------------------------------------------- |
2748| serialNumber | number                      | Yes  | Account SN.                                                                       |
2749| callback     | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account ID obtained. Otherwise, **err** is an error object.|
2750
2751**Example**: Obtain the ID of the system account whose SN is 12345.
2752
2753  ```ts
2754  import { BusinessError } from '@kit.BasicServicesKit';
2755  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2756  let serialNumber: number = 12345;
2757  accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err: BusinessError, localId: number)=>{
2758    if (err) {
2759      console.error(`get localId code is ${err.code}, message is ${err.message}`);
2760    } else {
2761      console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber);
2762    }
2763  });
2764  ```
2765
2766### getOsAccountLocalIdBySerialNumber<sup>(deprecated)</sup>
2767
2768getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
2769
2770Obtains the system account ID based on the SN. This API uses a promise to return the result.
2771
2772> **NOTE**
2773>
2774> This API is supported since API version 8 and deprecated since API version 9. Use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9-1) instead.
2775
2776**System capability**: SystemCapability.Account.OsAccount
2777
2778**Parameters**
2779
2780| Name      | Type  | Mandatory| Description      |
2781| ------------ | ------ | ---- | ---------- |
2782| serialNumber | number | Yes  | Account SN.|
2783
2784**Return value**
2785
2786| Type                 | Description                                                        |
2787| --------------------- | -------------------------------------------- |
2788| Promise&lt;number&gt; | Promise used to return the system account ID obtained.|
2789
2790**Example**: Obtain the ID of the system account whose SN is 12345.
2791
2792  ```ts
2793  import { BusinessError } from '@kit.BasicServicesKit';
2794  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2795  let serialNumber: number = 12345;
2796  accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId: number) => {
2797    console.log('getOsAccountLocalIdBySerialNumber localId: ' + localId);
2798  }).catch((err: BusinessError) => {
2799    console.error('getOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err));
2800  });
2801  ```
2802
2803### getSerialNumberByOsAccountLocalId<sup>(deprecated)</sup>
2804
2805getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;number&gt;): void
2806
2807Obtains the SN of a system account based on the account ID. This API uses an asynchronous callback to return the result.
2808
2809> **NOTE**
2810>
2811> This API is supported since API version 8 and deprecated since API version 9. Use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9) instead.
2812
2813**System capability**: SystemCapability.Account.OsAccount
2814
2815**Parameters**
2816
2817| Name  | Type                       | Mandatory| Description                                                                        |
2818| -------- | --------------------------- | ---- | --------------------------------------------------------------------------- |
2819| localId  | number                      | Yes  | ID of the target system account.                                                                |
2820| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the SN obtained. Otherwise, **err** is an error object.|
2821
2822**Example**: Obtain the SN of the system account 100.
2823
2824  ```ts
2825  import { BusinessError } from '@kit.BasicServicesKit';
2826  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2827  let localId: number = 100;
2828  accountManager.getSerialNumberByOsAccountLocalId(localId, (err: BusinessError, serialNumber: number)=>{
2829    if (err) {
2830      console.error(`get serialNumber code is ${err.code}, message is ${err.message}`);
2831    } else {
2832      console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId);
2833    }
2834  });
2835  ```
2836
2837### getSerialNumberByOsAccountLocalId<sup>(deprecated)</sup>
2838
2839getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
2840
2841Obtains the SN of a system account based on the account ID. This API uses a promise to return the result.
2842
2843> **NOTE**
2844>
2845> This API is supported since API version 8 and deprecated since API version 9. Use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9-1) instead.
2846
2847**System capability**: SystemCapability.Account.OsAccount
2848
2849**Parameters**
2850
2851| Name | Type  | Mandatory| Description         |
2852| ------- | ------ | ---- | ----------- |
2853| localId | number | Yes  | ID of the target system account.|
2854
2855**Return value**
2856
2857| Type                 | Description                                   |
2858| --------------------- | -------------------------------------- |
2859| Promise&lt;number&gt; | Promise used to return the SN obtained.|
2860
2861**Example**: Obtain the SN of the system account 100.
2862
2863  ```ts
2864  import { BusinessError } from '@kit.BasicServicesKit';
2865  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2866  let localId: number = 100;
2867  accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber: number) => {
2868    console.log('getSerialNumberByOsAccountLocalId serialNumber: ' + serialNumber);
2869  }).catch((err: BusinessError) => {
2870    console.error('getSerialNumberByOsAccountLocalId err: ' + JSON.stringify(err));
2871  });
2872  ```
2873
2874### getOsAccountName<sup>12+</sup>
2875
2876getOsAccountName(): Promise&lt;string&gt;
2877
2878Obtains the name of the system account of the caller. This API uses a promise to return the result.
2879
2880**System capability**: SystemCapability.Account.OsAccount
2881
2882**Return value**
2883
2884| Type                     | Description                    |
2885| :------------------------ | ----------------------- |
2886| Promise&lt;string&gt; | Promise used to return the system account name obtained.|
2887
2888**Error codes**
2889
2890For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
2891
2892| ID| Error Message                    |
2893| -------- | --------------------------- |
2894| 12300001 | The system service works abnormally. |
2895
2896**Example**
2897  ```ts
2898  import { BusinessError } from '@kit.BasicServicesKit';
2899  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2900  try {
2901    accountManager.getOsAccountName().then((name: string) => {
2902      console.log('getOsAccountName, name: ' + name);
2903    }).catch((err: BusinessError) => {
2904      console.error('getOsAccountName err: ' + err);
2905    });
2906  } catch (e) {
2907    console.error('getOsAccountName exception: ' + e);
2908  }
2909  ```
2910
2911### getForegroundOsAccountLocalId<sup>15+</sup>
2912
2913getForegroundOsAccountLocalId(): Promise&lt;number&gt;;
2914
2915Obtains the ID of the foreground system account.
2916
2917**System capability**: SystemCapability.Account.OsAccount
2918
2919**Return value**
2920
2921| Type                  | Description                                                              |
2922| ---------------------- | ----------------------------------------------------------------- |
2923| Promise&lt;number&gt; | Promise used to return the result.|
2924
2925**Error codes**
2926
2927For details about the error codes, see [Account Management Error Codes](errorcode-account.md).
2928
2929| ID| Error Message      |
2930| -------- | ------------- |
2931| 12300001 | The system service works abnormally. |
2932
2933**Example**
2934
2935  ```ts
2936  import { BusinessError } from '@kit.BasicServicesKit';
2937  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2938  try {
2939    accountManager.getForegroundOsAccountLocalId().then((localId: number) => {
2940      console.log('getForegroundOsAccountLocalId, localId: ' + localId);
2941    }).catch((err: BusinessError) => {
2942      console.error('getForegroundOsAccountLocalId err: ' + JSON.stringify(err));
2943    });
2944  } catch (e) {
2945    console.error('getForegroundOsAccountLocalId exception: ' + JSON.stringify(e));
2946  }
2947  ```
2948
2949### getOsAccountDomainInfo<sup>15+</sup>
2950
2951getOsAccountDomainInfo(localId: number): Promise&lt;DomainAccountInfo&gt;;
2952
2953Obtains the domain account information associated with a specified system account.
2954
2955**Required permissions**: ohos.permission.GET_DOMAIN_ACCOUNTS and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (available to system applications and enterprise applications)
2956
2957**System capability**: SystemCapability.Account.OsAccount
2958
2959**Parameters**
2960
2961| Name | Type  | Mandatory| Description         |
2962| ------- | ------ | ---- | ----------- |
2963| localId | number | Yes  | ID of the target system account.|
2964
2965**Return value**
2966
2967| Type                  | Description                                                              |
2968| ---------------------- | ----------------------------------------------------------------- |
2969| Promise&lt;[DomainAccountInfo](#domainaccountinfo8)&gt; | Promise used to return the result.|
2970
2971**Error codes**
2972
2973For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
2974
2975| ID| Error Message      |
2976| -------- | ------------- |
2977| 201 | Permission denied. |
2978| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2979| 12300001 | The system service works abnormally. |
2980| 12300003 | OS account not found. |
2981
2982**Example**
2983
2984  ```ts
2985  import { BusinessError } from '@kit.BasicServicesKit';
2986  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2987  let localId: number = 100;
2988  accountManager.getOsAccountDomainInfo(localId).then((domainAccountInfo: osAccount.DomainAccountInfo) => {
2989    if (domainAccountInfo === null) {
2990      console.log('The target OS account is not a domain account.')
2991    } else {
2992      console.log('getOsAccountDomainInfo domain: ' + domainAccountInfo.domain);
2993      console.log('getOsAccountDomainInfo accountName: ' + domainAccountInfo.accountName);
2994    }
2995  }).catch((err: BusinessError) => {
2996    console.error('getOsAccountDomainInfo err: ' + JSON.stringify(err));
2997  })
2998  ```
2999
3000## DomainAccountManager<sup>18+</sup>
3001
3002Provides APIs for domain account management.
3003
3004### updateAccountInfo<sup>18+</sup>
3005
3006updateAccountInfo(oldAccountInfo: DomainAccountInfo, newAccountInfo: DomainAccountInfo): Promise&lt;void&gt;
3007
3008Updates information of a domain account. This API uses a promise to return the result.
3009
3010**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.MANAGE_DOMAIN_ACCOUNTS
3011
3012**System capability**: SystemCapability.Account.OsAccount
3013
3014**Parameters**
3015
3016| Name     | Type                                   | Mandatory| Description            |
3017| ---------- | --------------------------------------- | ---- | --------------- |
3018| oldAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3019| newAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | New domain account information.|
3020
3021**Return value**
3022
3023| Type                     | Description                    |
3024| :------------------------ | ----------------------- |
3025| Promise&lt;void&gt; | Promise that returns no value.|
3026
3027**Error codes**
3028
3029For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3030
3031| ID| Error Message                    |
3032| -------- | --------------------------- |
3033| 201 | Permission denied.|
3034| 801 | Capability not supported.|
3035| 12300001 | The system service works abnormally. |
3036| 12300002 | The new account info is invalid. |
3037| 12300003 | The old account not found. |
3038| 12300004 | The new account already exists. |
3039
3040**Example**
3041  ```ts
3042  import { BusinessError } from '@kit.BasicServicesKit';
3043  let oldDomainInfo: osAccount.DomainAccountInfo =
3044    {domain: 'testDomain', accountName: 'oldtestAccountName'};
3045  let newDomainInfo: osAccount.DomainAccountInfo =
3046    {domain: 'testDomain', accountName: 'newtestAccountName'};
3047  try {
3048    osAccount.DomainAccountManager.updateAccountInfo(oldDomainInfo, newDomainInfo).then(() => {
3049      console.log('updateAccountInfo, success');
3050    }).catch((err: BusinessError) => {
3051      console.error('updateAccountInfo err: ' + err);
3052    });
3053  } catch (e) {
3054    console.error('updateAccountInfo exception: ' + e);
3055  }
3056  ```
3057
3058## OsAccountInfo
3059
3060Represents information about a system account.
3061
3062**System capability**: SystemCapability.Account.OsAccount
3063
3064| Name                        | Type                                                        | Mandatory| Description                             |
3065| ------------------------------ | ------------------------------------------------------------ | ---- | --------------------------------- |
3066| localId                        | number                                                       | Yes  | ID of the system account.                     |
3067| localName                      | string                                                       | Yes  | Name of the system account.                   |
3068| type                           | [OsAccountType](#osaccounttype)                              | Yes  | Type of the system account.                     |
3069| constraints                    | Array&lt;string&gt;                                          | Yes  | [Constraints](#constraints) of the system account. By default, no value is passed in.|
3070| isVerified<sup>(deprecated)</sup> | boolean                                                   | Yes  | Whether the account has been verified. The value **true** means the specified account has been verified; the value **false** means the opposite.<br>**Note**: This parameter is supported since API version 7 and deprecated since API version 11. You are advised to use **isUnlocked** instead.          |
3071| isUnlocked<sup>11+</sup>      | boolean                                                       | Yes  | Whether the account is unlocked (whether the **el2/** directory is decrypted). The value **true** means the specified account is unlocked; the value **false** means the opposite.                     |
3072| photo<sup>8+</sup>             | string                                                       | Yes  | Avatar of the system account. By default, no value is passed in.                     |
3073| createTime<sup>8+</sup>        | number                                                       | Yes  | Time when the system account was created.                 |
3074| lastLoginTime<sup>8+</sup>     | number                                                       | Yes  | Last login time of the system account. By default, no value is passed in.         |
3075| serialNumber<sup>8+</sup>      | number                                                       | Yes  | SN of the system account.                     |
3076| isActived<sup>(deprecated)</sup>         | boolean                                            | Yes  | Whether the system account is activated. The value **true** means the specified account is activated; the value **false** means the opposite.<br>**Note**: This parameter is supported since API version 7 and deprecated since API version 11. You are advised to use **isActivated** instead.                 |
3077| isActivated<sup>11+</sup>         | boolean                                                   | Yes  | Whether the system account is activated. The value **true** means the specified account is activated; the value **false** means the opposite.                 |
3078| isCreateCompleted<sup>8+</sup> | boolean                                                      | Yes  | Whether the system account information is complete. The value **true** means the specified account is complete; the value **false** means the opposite.             |
3079| distributedInfo                | [distributedAccount.DistributedInfo](js-apis-distributed-account.md#distributedinfo) | Yes  | Distributed account information. By default, no value is passed in.                   |
3080| domainInfo<sup>8+</sup>        | [DomainAccountInfo](#domainaccountinfo8)                      | Yes  | Domain account information. By default, no value is passed in.                       |
3081
3082## DomainAccountInfo<sup>8+</sup>
3083
3084Represents the domain account information.
3085
3086**System capability**: SystemCapability.Account.OsAccount
3087
3088| Name     | Type  | Mandatory| Description      |
3089| ----------- | ------ | ---- | ---------- |
3090| domain      | string | Yes  | Domain name.    |
3091| accountName | string | Yes  | Domain account name.|
3092| serverConfigId<sup>18+</sup> | string | No  | Domain account configuration ID, which is an empty string by default.|
3093
3094## DomainServerConfig<sup>18+</sup>
3095
3096Represents the configuration of a domain server.
3097
3098**System capability**: SystemCapability.Account.OsAccount
3099
3100| Name     | Type  | Mandatory| Description      |
3101| ----------- | ------ | ---- | ---------- |
3102| parameters | Record<string, Object> | Yes  | Server configuration parameters.|
3103| id | string | Yes  | Server configuration ID.|
3104| domain | string | Yes| Domain to which the server belongs.|
3105
3106## DomainServerConfigManager<sup>18+</sup>
3107
3108Provides APIs for domain server configuration and management.
3109
3110### addServerConfig<sup>18+</sup>
3111
3112static addServerConfig(parameters: Record&lt;string, Object&gt;): Promise&lt;DomainServerConfig&gt;
3113
3114Adds domain server configuration. This API uses a promise to return the result.
3115
3116**System capability**: SystemCapability.Account.OsAccount
3117
3118**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3119
3120**Parameters**
3121
3122| Name   | Type                    | Mandatory| Description                     |
3123| ----------| ----------------------- | --- | -------------------------- |
3124| parameters   | Record<string, Object>  | Yes | Configuration parameters of the domain server.|
3125
3126**Return value**
3127
3128| Type                     | Description                    |
3129| :------------------------ | ----------------------- |
3130| Promise&lt;[DomainServerConfig](#domainserverconfig18)&gt; | Promise used to return the configuration of the newly added domain server.|
3131
3132**Error codes**
3133
3134For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3135
3136| ID| Error Message                    |
3137| -------- | --------------------------- |
3138| 201 | Permission denied.|
3139| 801 | Capability not supported.|
3140| 12300001 | The system service works abnormally. |
3141| 12300002 | Invalid server config parameters. |
3142| 12300211 | Server unreachable. |
3143| 12300213 | Server config already exists. |
3144| 12300215 | The number of server config reaches the upper limit. |
3145
3146**Example**
3147  ```ts
3148  import { BusinessError } from '@kit.BasicServicesKit';
3149  let configParams: Record<string, Object> = {
3150    'uri': 'test.example.com',
3151    'port': 100
3152  };
3153  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
3154    serverConfig: osAccount.DomainServerConfig) => {
3155    console.log('add server configuration successfully, the return config: ' + JSON.stringify(serverConfig));
3156  }).catch((err: BusinessError) => {
3157    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3158  });
3159  ```
3160
3161### removeServerConfig<sup>18+</sup>
3162
3163static removeServerConfig(configId: string): Promise&lt;void&gt;
3164
3165Removes domain server configuration. This API uses a promise to return the result.
3166
3167**System capability**: SystemCapability.Account.OsAccount
3168
3169**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3170
3171**Parameters**
3172
3173| Name   | Type                    | Mandatory| Description                     |
3174| ----------| ----------------------- | --- | -------------------------- |
3175| configId   | string  | Yes | Server configuration ID.|
3176
3177**Return value**
3178
3179| Type                     | Description                    |
3180| :------------------------ | ----------------------- |
3181| Promise&lt;void&gt; | Promise that returns no value.|
3182
3183**Error codes**
3184
3185For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3186
3187| ID| Error Message                    |
3188| -------- | --------------------------- |
3189| 201 | Permission denied.|
3190| 801 | Capability not supported.|
3191| 12300001 | The system service works abnormally. |
3192| 12300212 | Server config not found. |
3193| 12300214 | Server config has been associated with an account. |
3194
3195**Example**
3196  ```ts
3197  import { BusinessError } from '@kit.BasicServicesKit';
3198  let configParams: Record<string, Object> = {
3199    'uri': 'test.example.com',
3200    'port': 100
3201  };
3202  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
3203    serverConfig: osAccount.DomainServerConfig) => {
3204    console.log('add domain server configuration successfully, the added config: ' + JSON.stringify(serverConfig));
3205    osAccount.DomainServerConfigManager.removeServerConfig(serverConfig.id);
3206    console.log('remove domain server configuration successfully');
3207  }).catch((err: BusinessError) => {
3208    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3209  });
3210  ```
3211
3212### updateServerConfig<sup>18+</sup>
3213
3214static updateServerConfig(configId: string, parameters: Record&lt;string, Object&gt;): Promise&lt;DomainServerConfig&gt;
3215
3216Updates the domain server configuration. This API uses a promise to return the result.
3217
3218**System capability**: SystemCapability.Account.OsAccount
3219
3220**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3221
3222**Parameters**
3223
3224| Name   | Type                    | Mandatory| Description                     |
3225| ----------| ----------------------- | --- | -------------------------- |
3226| configId   | string  | Yes | Server configuration ID.|
3227| parameters   | Record&lt;string, Object&gt;  | Yes | Configuration parameters of the domain server.|
3228
3229**Return value**
3230
3231| Type                     | Description                    |
3232| :------------------------ | ----------------------- |
3233| Promise&lt;[DomainServerConfig](#domainserverconfig18)&gt; | Promise used to return the updated domain server configuration.|
3234
3235**Error codes**
3236
3237For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3238
3239| ID| Error Message                    |
3240| -------- | --------------------------- |
3241| 201 | Permission denied.|
3242| 801 | Capability not supported.|
3243| 12300001 | The system service works abnormally. |
3244| 12300002 | Invalid server config parameters. |
3245| 12300211 | Server unreachable. |
3246| 12300212 | Server config not found. |
3247| 12300213 | Server config already exists. |
3248| 12300214 | Server config has been associated with an account. |
3249
3250**Example**
3251  ```ts
3252  import { BusinessError } from '@kit.BasicServicesKit';
3253  let configParams: Record<string, Object> = {
3254    'uri': 'test.example.com',
3255    'port': 100
3256  };
3257  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
3258    serverConfig: osAccount.DomainServerConfig) => {
3259    console.log('add domain server configuration successfully, the added config: ' + JSON.stringify(serverConfig));
3260    osAccount.DomainServerConfigManager.updateServerConfig(serverConfig.id, configParams).then((data) => {
3261      console.log('update domain server configuration successfully, return config: ' + JSON.stringify(data));
3262    }).catch((err: BusinessError) => {
3263      console.error('update domain server configuration failed, error: ' + JSON.stringify(err));
3264    });
3265  }).catch((err: BusinessError) => {
3266    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3267  });
3268  ```
3269
3270### getServerConfig<sup>18+</sup>
3271
3272static getServerConfig(configId: string): Promise&lt;DomainServerConfig&gt;
3273
3274Obtains the domain server configuration. This API uses a promise to return the result.
3275
3276**System capability**: SystemCapability.Account.OsAccount
3277
3278**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3279
3280**Parameters**
3281
3282| Name   | Type                    | Mandatory| Description                     |
3283| ----------| ----------------------- | --- | -------------------------- |
3284| configId   | string  | Yes | Server configuration ID.|
3285
3286**Return value**
3287
3288| Type                     | Description                    |
3289| :------------------------ | ----------------------- |
3290| Promise&lt;[DomainServerConfig](#domainserverconfig18)&gt; | Promise used to return the domain server configuration obtained.|
3291
3292**Error codes**
3293
3294For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3295
3296| ID| Error Message                    |
3297| -------- | --------------------------- |
3298| 201 | Permission denied.|
3299| 801 | Capability not supported.|
3300| 12300001 | The system service works abnormally. |
3301| 12300212 | Server config not found. |
3302
3303**Example**
3304  ```ts
3305  import { BusinessError } from '@kit.BasicServicesKit';
3306  let configParams: Record<string, Object> = {
3307    'uri': 'test.example.com',
3308    'port': 100
3309  };
3310  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
3311    serverConfig: osAccount.DomainServerConfig) => {
3312    console.log('add domain server configuration successfully, the added config: ' + JSON.stringify(serverConfig));
3313    osAccount.DomainServerConfigManager.getServerConfig(serverConfig.id).then((data: osAccount.DomainServerConfig) => {
3314      console.log('get domain server configuration successfully, return config: ' + JSON.stringify(data));
3315    }).catch((err: BusinessError) => {
3316      console.error('get domain server configuration failed, error: ' + JSON.stringify(err));
3317    });
3318  }).catch((err: BusinessError) => {
3319    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3320  });
3321  ```
3322
3323### getAllServerConfigs<sup>18+</sup>
3324
3325static getAllServerConfigs(): Promise&lt;Array&lt;DomainServerConfig&gt;&gt;
3326
3327Obtains the configurations of all domain servers. This API uses a promise to return the result.
3328
3329**System capability**: SystemCapability.Account.OsAccount
3330
3331**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3332
3333**Return value**
3334
3335| Type                     | Description                    |
3336| :------------------------ | ----------------------- |
3337| Promise&lt;Array&lt;[DomainServerConfig](#domainserverconfig18)&gt;&gt; | Promise used to return the domain server configuration obtained.|
3338
3339**Error codes**
3340
3341For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3342
3343| ID| Error Message                    |
3344| -------- | --------------------------- |
3345| 201 | Permission denied.|
3346| 801 | Capability not supported.|
3347| 12300001 | The system service works abnormally. |
3348
3349**Example**
3350  ```ts
3351  import { BusinessError } from '@kit.BasicServicesKit';
3352  let configParams: Record<string, Object> = {
3353    'uri': 'test.example.com',
3354    'port': 100
3355  };
3356  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
3357    serverConfig: osAccount.DomainServerConfig) => {
3358    console.log('add domain server configuration successfully, the added config: ' + JSON.stringify(serverConfig));
3359    osAccount.DomainServerConfigManager.getAllServerConfigs().then((data: Array<osAccount.DomainServerConfig>) => {
3360      console.log('get all domain server configuration successfully, return config: ' + JSON.stringify(data));
3361    }).catch((err: BusinessError) => {
3362      console.error('get all domain server configuration failed, error: ' + JSON.stringify(err));
3363    });
3364  }).catch((err: BusinessError) => {
3365    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3366  });
3367  ```
3368
3369### getAccountServerConfig<sup>18+</sup>
3370
3371static getAccountServerConfig(domainAccountInfo: DomainAccountInfo): Promise&lt;DomainServerConfig&gt;
3372
3373Obtains the server configuration of a domain account. This API uses a promise to return the result.
3374
3375**System capability**: SystemCapability.Account.OsAccount
3376
3377**Required permissions**: ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS
3378
3379**Parameters**
3380
3381| Name   | Type                    | Mandatory| Description                     |
3382| ----------| ----------------------- | --- | -------------------------- |
3383| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes | Information of the domain account.|
3384
3385**Return value**
3386
3387| Type                     | Description                    |
3388| :------------------------ | ----------------------- |
3389| Promise&lt;[DomainServerConfig](#domainserverconfig18)&gt; | Promise used to return the domain server configuration of the account.|
3390
3391**Error codes**
3392
3393For details about the error codes, see [Account Management Error Codes](errorcode-account.md) and [Universal Error Codes](../errorcode-universal.md).
3394
3395| ID| Error Message                    |
3396| -------- | --------------------------- |
3397| 201 | Permission denied.|
3398| 801 | Capability not supported.|
3399| 12300001 | The system service works abnormally. |
3400| 12300003 | Domain account not found. |
3401
3402**Example**
3403  ```ts
3404  import { BusinessError } from '@kit.BasicServicesKit';
3405  let accountInfo: osAccount.DomainAccountInfo = {
3406    'accountName': 'demoName',
3407    'domain': 'demoDomain'
3408  };
3409  osAccount.DomainServerConfigManager.getAccountServerConfig(accountInfo).then((
3410    serverConfig: osAccount.DomainServerConfig) => {
3411    console.log('get account server configuration successfully, the return config: ' + JSON.stringify(serverConfig));
3412  }).catch((err: BusinessError) => {
3413    console.error('add server configuration failed, error: ' + JSON.stringify(err));
3414  });
3415  ```
3416
3417## Constraints
3418
3419| Constraint                                 | Description                          |
3420| ------------------------------------- | ------------------------------ |
3421| constraint.wifi                       | Disallow the use of Wi-Fi.                 |
3422| constraint.wifi.set                   | Disallow setting of Wi-Fi.                 |
3423| constraint.locale.set                 | Disallow setting of the language to use.              |
3424| constraint.app.accounts               | Disallow addition or deletion of application accounts.        |
3425| constraint.apps.install               | Disallow application installation.                  |
3426| constraint.apps.uninstall             | Disallow application uninstallation.                  |
3427| constraint.location.shared            | Disallow location sharing.              |
3428| constraint.unknown.sources.install    | Disallow installation of apps from unknown sources.        |
3429| constraint.global.unknown.app.install | Disallow installation of apps from unknown sources for all users.|
3430| constraint.bluetooth.set              | Disallow setting of Bluetooth.                  |
3431| constraint.bluetooth | Disallow the use of Bluetooth.|
3432| constraint.bluetooth.share | Disallow Bluetooth sharing.|
3433| constraint.usb.file.transfer | Disallow file transfer over USB.|
3434| constraint.credentials.set | Disallow setting of user credentials.|
3435| constraint.os.account.remove | Disallow removal of users.|
3436| constraint.managed.profile.remove | Disallow removal of the managed profiles of this user.|
3437| constraint.debug.features.use | Disallow the use of debugging features.|
3438| constraint.vpn.set | Disallow setting of VPN.|
3439| constraint.date.time.set | Disallow setting of date, time, or time zone.|
3440| constraint.tethering.config | Disallow setting of Tethering.|
3441| constraint.network.reset | Disallow reset of network settings.|
3442| constraint.factory.reset | Disallow reset to factory settings.|
3443| constraint.os.account.create | Disallow creation of new users.|
3444| constraint.add.managed.profile | Disallow addition of managed profiles.|
3445| constraint.apps.verify.disable | Disallow application verification from being disabled.|
3446| constraint.cell.broadcasts.set | Disallow setting of cell broadcasts.|
3447| constraint.mobile.networks.set | Disallow setting of mobile networks.|
3448| constraint.control.apps | Disallow modification of apps in **Settings** or the boot module.|
3449| constraint.physical.media | Disallow mounting of external physical media.|
3450| constraint.microphone | Disallow the use of microphones.|
3451| constraint.microphone.unmute | Disallow unmuting of the microphone.|
3452| constraint.volume.adjust | Disallow adjustment of the volume.|
3453| constraint.calls.outgoing | Disallow outgoing calls.|
3454| constraint.sms.use | Disallow the use of the short message service (SMS).|
3455| constraint.fun | Disallow the use of entertainment features.|
3456| constraint.windows.create | Disallow creation of the windows other than application windows.|
3457| constraint.system.error.dialogs | Disallow display of error dialogs for crashed or unresponsive apps.|
3458| constraint.cross.profile.copy.paste | Disallow pasting of clipboard content to other users or profiles.|
3459| constraint.beam.outgoing | Disallow the use of Near Field Communications (NFC) to transfer data from apps.|
3460| constraint.wallpaper | Disallow wallpaper management.|
3461| constraint.safe.boot | Disallow reboot of the device in safe boot mode.|
3462| constraint.parent.profile.app.linking | Disallow the application in the parent profile from handling web links from the managed profiles.|
3463| constraint.audio.record | Disallow audio recording.|
3464| constraint.camera.use | Disallow the use of cameras.|
3465| constraint.os.account.background.run | Disallow background system accounts.|
3466| constraint.data.roam | Disallow the use of cellular data when roaming.|
3467| constraint.os.account.set.icon | Disallow setting of user icons.|
3468| constraint.wallpaper.set | Disallow setting of wallpapers.|
3469| constraint.oem.unlock | Disallow the use of OEM unlock.|
3470| constraint.device.unmute | Disallow unmuting of the device.|
3471| constraint.password.unified | Disallow the use of the unified lock screen challenge for the managed profile with the primary user.|
3472| constraint.autofill | Disallow the use of the autofill service.|
3473| constraint.content.capture | Disallow capturing of the screen content.|
3474| constraint.content.suggestions | Disallow receiving of content suggestions.|
3475| constraint.os.account.activate | Disallow activating of system accounts in the foreground.|
3476| constraint.location.set | Disallow setting of the location service.|
3477| constraint.airplane.mode.set | Disallow setting of the airplane mode.|
3478| constraint.brightness.set | Disallow setting of the brightness.|
3479| constraint.share.into.profile | Disallow sharing of files, images, and data of the primary user to the managed profiles.|
3480| constraint.ambient.display | Disallow display of the ambient environment.|
3481| constraint.screen.timeout.set | Disallow setting of the screen-off timeout.|
3482| constraint.print | Disallow printing.|
3483| constraint.private.dns.set | Disallow setting of the private domain name server (DNS).|
3484