• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#    OS Account Management
2
3The **osAccount** module provides basic capabilities for managing operating system (OS) accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account, and storing OS account data to disks.
4
5> **NOTE**<br>
6> 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.
7
8
9## Modules to Import
10
11```js
12import account_osAccount from '@ohos.account.osAccount';
13```
14
15## account_osAccount.getAccountManager
16
17getAccountManager(): AccountManager
18
19Obtains an **AccountManager** instance.
20
21**System capability**: SystemCapability.Account.OsAccount
22
23**Return value**
24| Type                             | Description                    |
25| --------------------------------- | ------------------------ |
26| [AccountManager](#accountmanager) | Obtains an **AccountManager** instance.|
27
28**Example**
29  ```js
30  const accountManager = account_osAccount.getAccountManager();
31  ```
32
33## OsAccountType
34
35Enumerates OS account types.
36
37**System capability**: SystemCapability.Account.OsAccount
38
39| Name  | Default Value| Description        |
40| ------ | ------ | ------------ |
41| ADMIN  | 0      | Administrator account|
42| NORMAL | 1      | Normal account  |
43| GUEST  | 2      | Guest account  |
44
45## AccountManager
46
47Provides methods to manage OS accounts.
48
49### activateOsAccount
50
51activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
52
53Activates an OS account. This API uses an asynchronous callback to return the result.
54
55This is a system API and cannot be called by third-party applications.
56
57**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
58
59**System capability**: SystemCapability.Account.OsAccount
60
61**Parameters**
62
63| Name  | Type                     | Mandatory| Description                |
64| -------- | ------------------------- | ---- | -------------------- |
65| localId  | number                    | Yes  | ID of the OS account to activate.|
66| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
67
68**Example**: Activate OS account 100.
69  ```js
70  const accountManager = account_osAccount.getAccountManager();
71  var localId = 100;
72  accountManager.activateOsAccount(localId, (err)=>{
73    console.log("activateOsAccount err:" + JSON.stringify(err));
74  });
75  ```
76
77### activateOsAccount
78
79activateOsAccount(localId: number): Promise&lt;void&gt;
80
81Activates an OS account. This API uses a promise to return the result.
82
83This is a system API and cannot be called by third-party applications.
84
85**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
86
87**System capability**: SystemCapability.Account.OsAccount
88
89**Parameters**
90
91| Name | Type  | Mandatory| Description                |
92| ------- | ------ | ---- | -------------------- |
93| localId | number | Yes  | ID of the OS account to activate.|
94
95**Return value**
96
97| Type               | Description                               |
98| :------------------ | :---------------------------------- |
99| Promise&lt;void&gt; | Promise used to return the result.|
100
101**Example**: Activate OS account 100.
102  ```js
103  const accountManager = account_osAccount.getAccountManager();
104  var localId = 100;
105  accountManager.activateOsAccount(localId).then(() => {
106    console.log("activateOsAccount success");
107  }).catch((err) => {
108    console.log("activateOsAccount err:" + JSON.stringify(err));
109  });
110  ```
111
112### isMultiOsAccountEnable
113
114isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
115
116Checks whether multiple OS accounts are supported. This API uses an asynchronous callback to return the result.
117
118**System capability**: SystemCapability.Account.OsAccount
119
120**Parameters**
121
122| Name  | Type                        | Mandatory| Description                                               |
123| -------- | ---------------------------- | ---- | --------------------------------------------------- |
124| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If multiple OS accounts are supported, **true** will be returned. Otherwise, **false** will be returned.|
125
126**Example**
127
128  ```js
129  const accountManager = account_osAccount.getAccountManager();
130  accountManager.isMultiOsAccountEnable((err, isEnabled) => {
131    console.log("isMultiOsAccountEnable err: " + JSON.stringify(err));
132    console.log('isMultiOsAccountEnable isEnabled: ' + isEnabled);
133  });
134  ```
135
136### isMultiOsAccountEnable
137
138isMultiOsAccountEnable(): Promise&lt;boolean&gt;
139
140Checks whether multiple OS accounts are supported. This API uses a promise to return the result.
141
142**System capability**: SystemCapability.Account.OsAccount
143
144**Return value**
145
146| Type                  | Description                                                        |
147| :--------------------- | :----------------------------------------------------------- |
148| Promise&lt;boolean&gt; | Promise used to return the result. If multiple OS accounts are supported, **true** will be returned. Otherwise, **false** will be returned.|
149
150**Example**
151
152  ```js
153  const accountManager = account_osAccount.getAccountManager();
154  accountManager.isMultiOsAccountEnable().then((isEnabled) => {
155    console.log('isMultiOsAccountEnable, isEnabled: ' + isEnabled);
156  }).catch((err) => {
157    console.log("isMultiOsAccountEnable err: "  + JSON.stringify(err));
158  });
159  ```
160
161### isOsAccountActived
162
163isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
164
165Checks whether an OS account is activated. This API uses an asynchronous callback to return the result.
166
167**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
168
169**System capability**: SystemCapability.Account.OsAccount
170
171**Parameters**
172
173| Name  | Type                        | Mandatory| Description                                             |
174| -------- | ---------------------------- | ---- | ------------------------------------------------- |
175| localId  | number                       | Yes  | ID of the target OS account.                                     |
176| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If the OS account is activated, **true** will be returned. Otherwise, **false** will be returned.|
177
178**Example**: Check whether OS account 100 is activated.
179
180  ```js
181  const accountManager = account_osAccount.getAccountManager();
182  var osLocalId = 100;
183  accountManager.isOsAccountActived(osLocalId, (err, isActive)=>{
184    console.log("isOsAccountActived err:" + JSON.stringify(err));
185    console.log("isOsAccountActived isActive:" + isActive);
186  });
187  ```
188
189### isOsAccountActived
190
191isOsAccountActived(localId: number): Promise&lt;boolean&gt;
192
193Checks whether an OS account is activated. This API uses a promise to return the result.
194
195**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
196
197**System capability**: SystemCapability.Account.OsAccount
198
199**Parameters**
200
201| Name | Type  | Mandatory| Description        |
202| ------- | ------ | ---- | ------------ |
203| localId | number | Yes  | ID of the target OS account.|
204
205**Return value**
206
207| Type                  | Description                                                        |
208| :--------------------- | :----------------------------------------------------------- |
209| Promise&lt;boolean&gt; | Promise used to return the result. If the OS account is activated, **true** will be returned. Otherwise, **false** will be returned.|
210
211**Example**: Check whether OS account 100 is activated.
212
213  ```js
214  const accountManager = account_osAccount.getAccountManager();
215  var osLocalId = 100;
216  accountManager.isOsAccountActived(osLocalId).then((isActive) => {
217    console.log('isOsAccountActived, isActive: ' + isActive);
218  }).catch((err) => {
219    console.log("isOsAccountActived err: "  + JSON.stringify(err));
220  });
221  ```
222
223### isOsAccountConstraintEnable
224
225isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback&lt;boolean&gt;): void
226
227Checks whether the specified constraint is enabled for an OS account. This API uses an asynchronous callback to return the result.
228
229**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
230
231**System capability**: SystemCapability.Account.OsAccount
232
233**Parameters**
234
235| Name    | Type                        | Mandatory| Description                                             |
236| ---------- | ---------------------------- | ---- | ------------------------------------------------- |
237| localId    | number                       | Yes  | ID of the target OS account.                               |
238| constraint | string                       | Yes  | [Constraint](#constraints) specified.            |
239| callback   | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.|
240
241**Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
242
243  ```js
244  const accountManager = account_osAccount.getAccountManager();
245  var localId = 100;
246  accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi", (err, isConstraintEnabled)=>{
247    console.log("isOsAccountConstraintEnable err:" + JSON.stringify(err));
248    console.log("isOsAccountConstraintEnable isConstraintEnabled:" + isConstraintEnabled);
249  });
250  ```
251
252### isOsAccountConstraintEnable
253
254isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boolean&gt;
255
256Checks whether the specified constraint is enabled for an OS account. This API uses a promise to return the result.
257
258**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
259
260**System capability**: SystemCapability.Account.OsAccount
261
262**Parameters**
263
264| Name    | Type  | Mandatory| Description                                 |
265| ---------- | ------ | ---- | ------------------------------------- |
266| localId    | number | Yes  | ID of the target OS account.                   |
267| constraint | string | Yes  | [Constraint](#constraints) specified.|
268
269**Return value**
270
271| Type                  | Description                                                        |
272| :--------------------- | :----------------------------------------------------------- |
273| Promise&lt;boolean&gt; | Promise used to return the result. If the constraint is enabled for the OS account, **true** will be returned. Otherwise, **false** will be returned.|
274
275**Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
276
277  ```js
278  const accountManager = account_osAccount.getAccountManager();
279  var localId = 100;
280  accountManager.isOsAccountConstraintEnable(localId, "constraint.wifi").then((isConstraintEnabled) => {
281    console.log('isOsAccountConstraintEnable, isConstraintEnabled: ' + isConstraintEnabled);
282  }).catch((err) => {
283    console.log("isOsAccountConstraintEnable err: "  + JSON.stringify(err));
284  });
285  ```
286
287### isTestOsAccount
288
289isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
290
291Checks whether this OS account is a test account. This API uses an asynchronous callback to return the result.
292
293**System capability**: SystemCapability.Account.OsAccount
294
295**Parameters**
296
297| Name  | Type                        | Mandatory| Description                                           |
298| -------- | ---------------------------- | ---- | ----------------------------------------------- |
299| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If the account is a test account, **true** will be returned. Otherwise, **false** will be returned.|
300
301**Example**
302
303  ```js
304  const accountManager = account_osAccount.getAccountManager();
305  accountManager.isTestOsAccount((err, isTest) => {
306    console.log("isTestOsAccount err: " + JSON.stringify(err));
307    console.log('isTestOsAccount isTest: ' + isTest);
308  });
309  ```
310
311### isTestOsAccount
312
313isTestOsAccount(): Promise&lt;boolean&gt;
314
315Checks whether this OS account is a test account. This API uses a promise to return the result.
316
317**System capability**: SystemCapability.Account.OsAccount
318
319**Return value**
320
321| Type                  | Description                                                        |
322| :--------------------- | :----------------------------------------------------------- |
323| Promise&lt;boolean&gt; | Promise used to return the result. If the account is a test account, **true** will be returned. Otherwise, **false** will be returned.|
324
325**Example**
326
327  ```js
328  const accountManager = account_osAccount.getAccountManager();
329  accountManager.isTestOsAccount().then((isTest) => {
330    console.log('isTestOsAccount, isTest: ' + isTest);
331  }).catch((err) => {
332    console.log("isTestOsAccount err: "  + JSON.stringify(err));
333  });
334  ```
335
336### isOsAccountVerified
337
338isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
339
340Checks whether this OS account has been verified. This API uses an asynchronous callback to return the result.
341
342**System capability**: SystemCapability.Account.OsAccount
343
344**Parameters**
345
346| Name  | Type                        | Mandatory| Description                                       |
347| -------- | ---------------------------- | ---- | ------------------------------------------- |
348| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If the OS account has been verified, **true** will be returned. Otherwise, **false** will be returned.|
349
350**Example**
351
352  ```js
353  const accountManager = account_osAccount.getAccountManager();
354  accountManager.isOsAccountVerified((err, isVerified) => {
355    console.log("isOsAccountVerified err: " + JSON.stringify(err));
356    console.log('isOsAccountVerified isVerified: ' + isVerified);
357  });
358  ```
359
360### isOsAccountVerified
361
362isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): void
363
364Checks whether an OS account has been verified. This API uses an asynchronous callback to return the result.
365
366**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
367
368**System capability**: SystemCapability.Account.OsAccount
369
370**Parameters**
371
372| Name  | Type                        | Mandatory| Description                                       |
373| -------- | ---------------------------- | ---- | ------------------------------------------- |
374| localId  | number                       | No  | ID of the target OS account.                         |
375| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If the OS account has been verified, **true** will be returned. Otherwise, **false** will be returned.|
376
377**Example**
378
379  ```js
380  const accountManager = account_osAccount.getAccountManager();
381  accountManager.isOsAccountVerified((err, isVerified) => {
382    console.log("isOsAccountVerified err: " + JSON.stringify(err));
383    console.log('isOsAccountVerified isVerified: ' + isVerified);
384  });
385  ```
386
387### isOsAccountVerified
388
389isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
390
391Checks whether an OS account has been verified. This API uses a promise to return the result.
392
393**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
394
395**System capability**: SystemCapability.Account.OsAccount
396
397**Parameters**
398
399| Name | Type  | Mandatory| Description              |
400| ------- | ------ | ---- | ------------------ |
401| localId | number | No  | ID of the target OS account.|
402
403**Return value**
404
405| Type                  | Description                                                        |
406| :--------------------- | :----------------------------------------------------------- |
407| Promise&lt;boolean&gt; | Promise used to return the result. If the OS account has been verified, **true** will be returned. Otherwise, **false** will be returned.|
408
409**Example**
410
411  ```js
412  const accountManager = account_osAccount.getAccountManager();
413  accountManager.isOsAccountVerified().then((isVerified) => {
414    console.log('isOsAccountVerified, isVerified: ' + isVerified);
415  }).catch((err) => {
416    console.log("isOsAccountVerified err: "  + JSON.stringify(err));
417  });
418  ```
419
420### removeOsAccount
421
422removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
423
424Removes an OS account. This API uses an asynchronous callback to return the result.
425
426This is a system API and cannot be called by third-party applications.
427
428**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
429
430**System capability**: SystemCapability.Account.OsAccount
431
432**Parameters**
433
434| Name  | Type                     | Mandatory| Description                |
435| -------- | ------------------------- | ---- | -------------------- |
436| localId  | number                    | Yes  | ID of the OS account to remove.|
437| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.          |
438
439**Example**
440
441  ```js
442  const accountManager = account_osAccount.getAccountManager();
443  var createIocalId;
444  osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
445    createIocalId = osAccountInfo.localId;
446  });
447  accountManager.removeOsAccount(createIocalId, (err)=>{
448    console.log("removeOsAccount err:" + JSON.stringify(err));
449  });
450  ```
451
452### removeOsAccount
453
454removeOsAccount(localId: number): Promise&lt;void&gt;
455
456Removes an OS account. This API uses a promise to return the result.
457
458This is a system API and cannot be called by third-party applications.
459
460**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
461
462**System capability**: SystemCapability.Account.OsAccount
463
464**Parameters**
465
466| Name | Type  | Mandatory| Description                |
467| ------- | ------ | ---- | -------------------- |
468| localId | number | Yes  | ID of the OS account to remove.|
469
470**Return value**
471
472| Type               | Description                               |
473| :------------------ | :---------------------------------- |
474| Promise&lt;void&gt; | Promise used to return the result.|
475
476**Example**
477
478  ```js
479  const accountManager = account_osAccount.getAccountManager();
480  var createIocalId;
481  osAccountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
482    createIocalId = osAccountInfo.localId;
483  });
484  createIocalId = osAccount.localId;
485  accountManager.removeOsAccount(createIocalId).then(() => {
486    console.log('removeOsAccount Success');
487  }).catch(() => {
488    console.log("removeOsAccount err: "  + JSON.stringify(err));
489  });
490  ```
491
492### setOsAccountConstraints
493
494setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean,callback: AsyncCallback&lt;void&gt;): void
495
496Sets or removes constraints for an OS account. This API uses an asynchronous callback to return the result.
497
498This is a system API and cannot be called by third-party applications.
499
500**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
501
502**System capability**: SystemCapability.Account.OsAccount
503
504**Parameters**
505
506| Name     | Type                     | Mandatory| Description                                        |
507| ----------- | ------------------------- | ---- | -------------------------------------------- |
508| localId     | number                    | Yes  | ID of the target OS account.                                |
509| constraints | Array&lt;string&gt;       | Yes  | List of [constraints](#constraints) to set or remove.|
510| enable      | boolean                   | Yes  | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints.                      |
511| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.                                  |
512
513**Example**: Disable Wi-Fi for OS account 100.
514
515  ```js
516  const accountManager = account_osAccount.getAccountManager();
517  var localId = 100;
518  accountManager.setOsAccountConstraints(localId, ["constraint.wifi"], true, (err)=>{
519    console.log("setOsAccountConstraints err:" + JSON.stringify(err));
520  });
521  ```
522
523### setOsAccountConstraints
524
525setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean): Promise&lt;void&gt;
526
527Sets or removes constraints for an OS account. This API uses a promise to return the result.
528
529This is a system API and cannot be called by third-party applications.
530
531**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
532
533**System capability**: SystemCapability.Account.OsAccount
534
535**Parameters**
536
537| Name     | Type               | Mandatory| Description                                        |
538| ----------- | ------------------- | ---- | -------------------------------------------- |
539| localId     | number              | Yes  | ID of the target OS account.                                |
540| constraints | Array&lt;string&gt; | Yes  | List of [constraints](#constraints) to set or remove.|
541| enable      | boolean             | Yes  | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints.                    |
542
543**Return value**
544
545| Type               | Description                               |
546| :------------------ | :---------------------------------- |
547| Promise&lt;void&gt; | Promise used to return the result.|
548
549**Example**: Remote the constraint on the use of Wi-Fi for OS account 100.
550
551  ```js
552  const accountManager = account_osAccount.getAccountManager();
553  var localId = 100;
554  accountManager.setOsAccountConstraints(localId, ["constraint.location.set"], false).then(() => {
555    console.log('setOsAccountConstraints Success');
556  }).catch((err) => {
557    console.log("setOsAccountConstraints err: "  + JSON.stringify(err));
558  });
559  ```
560
561### setOsAccountName
562
563setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;void&gt;): void
564
565Sets a name for an OS account. This API uses an asynchronous callback to return the result.
566
567This is a system API and cannot be called by third-party applications.
568
569**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
570
571**System capability**: SystemCapability.Account.OsAccount
572
573**Parameters**
574
575| Name   | Type                     | Mandatory| Description        |
576| :-------- | ------------------------- | ---- | ------------ |
577| localId   | number                    | Yes  | ID of the target OS account.|
578| localName | string                    | Yes  | Account name to set.    |
579| callback  | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.  |
580
581**Example**: Set the name of OS account 100 to **demoName**.
582
583  ```js
584  const accountManager = account_osAccount.getAccountManager();
585  var localId = 100;
586  var newName = "demoName";
587  accountManager.setOsAccountName(localId, newName, (err)=>{
588    console.debug("setOsAccountName err:" + JSON.stringify(err));
589  });
590  ```
591
592### setOsAccountName
593
594setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
595
596Sets a name for an OS account. This API uses a promise to return the result.
597
598This is a system API and cannot be called by third-party applications.
599
600**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
601
602**System capability**: SystemCapability.Account.OsAccount
603
604**Parameters**
605
606| Name   | Type  | Mandatory| Description        |
607| --------- | ------ | ---- | ------------ |
608| localId   | number | Yes  | ID of the target OS account.|
609| localName | string | Yes  | Account name to set.    |
610
611**Return value**
612
613| Type               | Description                               |
614| :------------------ | :---------------------------------- |
615| Promise&lt;void&gt; | Promise used to return the result.|
616
617**Example**: Set the name of OS account 100 to **demoName**.
618
619  ```js
620  const accountManager = account_osAccount.getAccountManager();
621  var localId = 100;
622  var nameLimit = "demoName";
623  accountManager.setOsAccountName(localId, nameLimit).then(() => {
624    console.log('setOsAccountName Success');
625  }).catch((err) => {
626    console.log("setOsAccountName err: "  + JSON.stringify(err));
627  });
628  ```
629
630### getCreatedOsAccountsCount
631
632getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
633
634Obtains the number of OS accounts created. This API uses an asynchronous callback to return the result.
635
636**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
637
638**System capability**: SystemCapability.Account.OsAccount
639
640**Parameters**
641
642| Name  | Type                       | Mandatory| Description                                      |
643| -------- | --------------------------- | ---- | ------------------------------------------ |
644| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the number of OS accounts created.|
645
646**Example**
647
648  ```js
649  const accountManager = account_osAccount.getAccountManager();
650  accountManager.getCreatedOsAccountsCount((err, accountCnt)=>{
651    console.log("obtains the number of all os accounts created err:" + JSON.stringify(err));
652    console.log("obtains the number of all os accounts created accountCnt:" + accountCnt);
653  });
654  ```
655
656### getCreatedOsAccountsCount
657
658getCreatedOsAccountsCount(): Promise&lt;number&gt;
659
660Obtains the number of OS accounts created. This API uses a promise to return the result.
661
662**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
663
664**System capability**: SystemCapability.Account.OsAccount
665
666**Return value**
667
668| Type                 | Description                                                        |
669| :-------------------- | :----------------------------------------------------------- |
670| Promise&lt;number&gt; | Promise used to return the number of OS accounts created.|
671
672**Example**
673
674  ```js
675  const accountManager = account_osAccount.getAccountManager();
676  accountManager.getCreatedOsAccountsCount().then((accountCnt) => {
677    console.log('getCreatedOsAccountsCount, accountCnt: ' + accountCnt);
678  }).catch((err) => {
679    console.log("getCreatedOsAccountsCount err: "  + JSON.stringify(err));
680  });
681  ```
682
683### getOsAccountLocalIdFromProcess
684
685getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
686
687Obtains the ID of the OS account to which the current process belongs. This API uses an asynchronous callback to return the result.
688
689**System capability**: SystemCapability.Account.OsAccount
690
691**Parameters**
692
693| Name  | Type                       | Mandatory| Description                                              |
694| -------- | --------------------------- | ---- | -------------------------------------------------- |
695| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the account ID obtained.|
696
697**Example**
698
699  ```js
700  const accountManager = account_osAccount.getAccountManager();
701  accountManager.getOsAccountLocalIdFromProcess((err, accountID) => {
702    console.log("getOsAccountLocalIdFromProcess err: " + JSON.stringify(err));
703    console.log('getOsAccountLocalIdFromProcess accountID: ' + accountID);
704  });
705  ```
706
707### getOsAccountLocalIdFromProcess
708
709getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
710
711Obtains the ID of the OS account to which the current process belongs. This API uses a promise to return the result.
712
713**System capability**: SystemCapability.Account.OsAccount
714
715**Return value**
716
717| Type                 | Description                                                        |
718| :-------------------- | :----------------------------------------------------------- |
719| Promise&lt;number&gt; | Promise used to return the account ID obtained.|
720
721**Example**
722
723  ```js
724  const accountManager = account_osAccount.getAccountManager();
725  accountManager.getOsAccountLocalIdFromProcess().then((accountID) => {
726    console.log('getOsAccountLocalIdFromProcess, accountID: ' + accountID);
727  }).catch((err) => {
728    console.log("getOsAccountLocalIdFromProcess err: "  + JSON.stringify(err));
729  });
730  ```
731
732### getOsAccountLocalIdFromUid
733
734getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;): void
735
736Obtains the OS account ID based on the process UID. This API uses an asynchronous callback to return the result.
737
738**System capability**: SystemCapability.Account.OsAccount
739
740**Parameters**
741
742| Name  | Type                       | Mandatory| Description                                         |
743| -------- | --------------------------- | ---- | --------------------------------------------- |
744| uid      | number                      | Yes  | Process UID.                                    |
745| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the OS account ID obtained.|
746
747**Example**: Obtain the ID of the OS account whose process UID is **12345678**.
748
749  ```js
750  const accountManager = account_osAccount.getAccountManager();
751  let uid = 12345678;
752  accountManager.getOsAccountLocalIdFromUid(uid, (err, accountID) => {
753    console.log("getOsAccountLocalIdFromUid err: " + JSON.stringify(err));
754    console.log('getOsAccountLocalIdFromUid: ' + accountID);
755  });
756  ```
757
758### getOsAccountLocalIdFromUid
759
760getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
761
762Obtains the OS account ID based on the process UID. This API uses a promise to return the result.
763
764**System capability**: SystemCapability.Account.OsAccount
765
766**Parameters**
767
768| Name| Type  | Mandatory| Description     |
769| ------ | ------ | ---- | --------- |
770| uid    | number | Yes  | Process UID.|
771
772**Return value**
773
774| Type                 | Description                                                        |
775| :-------------------- | :----------------------------------------------------------- |
776| Promise&lt;number&gt; | Promise used to return the OS account ID obtained.|
777
778**Example**: Obtain the ID of the OS account whose process UID is **12345678**.
779
780  ```js
781  const accountManager = account_osAccount.getAccountManager();
782  let uid = 12345678;
783  accountManager.getOsAccountLocalIdFromUid(uid).then((accountID) => {
784    console.log('getOsAccountLocalIdFromUid: ' + accountID);
785  }).catch((err) => {
786    console.log("getOsAccountLocalIdFromUid err: "  + JSON.stringify(err));
787  });
788  ```
789
790### getOsAccountLocalIdFromDomain<sup>8+</sup>
791
792getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;number&gt;): void
793
794Obtains the OS account ID based on domain account information. This API uses an asynchronous callback to return the result.
795
796**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
797
798**System capability**: SystemCapability.Account.OsAccount
799
800**Parameters**
801
802| Name    | Type                                   | Mandatory| Description                                        |
803| ---------- | --------------------------------------- | ---- | -------------------------------------------- |
804| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.                                |
805| callback   | AsyncCallback&lt;number&gt;             | Yes  | Callback used to return the ID of the OS account associated with the domain account.|
806
807**Example**
808
809  ```js
810  var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
811  const accountManager = account_osAccount.getAccountManager();
812  accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err, accountID) => {
813    console.log("getOsAccountLocalIdFromDomain: " + JSON.stringify(err));
814    console.log('getOsAccountLocalIdFromDomain: ' + accountID);
815  });
816  ```
817
818### getOsAccountLocalIdFromDomain<sup>8+</sup>
819
820getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&gt;
821
822Obtains the OS account ID based on domain account information. This API uses a promise to return the result.
823
824**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
825
826**System capability**: SystemCapability.Account.OsAccount
827
828**Parameters**
829
830| Name    | Type                                   | Mandatory| Description        |
831| ---------- | --------------------------------------- | ---- | ------------ |
832| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.|
833
834**Return value**
835
836| Type                 | Description                                                        |
837| :-------------------- | :----------------------------------------------------------- |
838| Promise&lt;number&gt; | Promise used to return the ID of the OS account associated with the domain account.|
839
840**Example**
841
842  ```js
843  const accountManager = account_osAccount.getAccountManager();
844  var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
845  accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((accountID) => {
846    console.log('getOsAccountLocalIdFromDomain: ' + accountID);
847  }).catch((err) => {
848    console.log("getOsAccountLocalIdFromDomain err: "  + JSON.stringify(err));
849  });
850  ```
851
852### queryMaxOsAccountNumber
853
854queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
855
856Obtains the maximum number of OS accounts that can be created. This API uses an asynchronous callback to return the result.
857
858This is a system API and cannot be called by third-party applications.
859
860**System capability**: SystemCapability.Account.OsAccount
861
862**Parameters**
863
864| Name  | Type                       | Mandatory| Description                                            |
865| -------- | --------------------------- | ---- | ------------------------------------------------ |
866| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the maximum number of OS accounts that can be created.|
867
868**Example**
869
870  ```js
871  const accountManager = account_osAccount.getAccountManager();
872  accountManager.queryMaxOsAccountNumber((err, maxCnt)=>{
873    console.log("queryMaxOsAccountNumber err:" + JSON.stringify(err));
874    console.log("queryMaxOsAccountNumber maxCnt:" + maxCnt);
875  });
876  ```
877
878### queryMaxOsAccountNumber
879
880queryMaxOsAccountNumber(): Promise&lt;number&gt;
881
882Obtains the maximum number of OS accounts that can be created. This API uses a promise to return the result.
883
884This is a system API and cannot be called by third-party applications.
885
886**System capability**: SystemCapability.Account.OsAccount
887
888**Return value**
889
890| Type                 | Description                                                        |
891| :-------------------- | :----------------------------------------------------------- |
892| Promise&lt;number&gt; | Promise used to return the maximum number of OS accounts that can be created.|
893
894**Example**
895
896  ```js
897  const accountManager = account_osAccount.getAccountManager();
898  accountManager.queryMaxOsAccountNumber().then((maxCnt) => {
899    console.log('queryMaxOsAccountNumber, maxCnt: ' + maxCnt);
900  }).catch((err) => {
901    console.log("queryMaxOsAccountNumber err: "  + JSON.stringify(err));
902  });
903  ```
904
905### getOsAccountAllConstraints
906
907getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
908
909Obtains all constraints enabled for an OS account. This API uses an asynchronous callback to return the result.
910
911**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
912
913**System capability**: SystemCapability.Account.OsAccount
914
915**Parameters**
916
917| Name  | Type                                    | Mandatory| Description                                                        |
918| -------- | ---------------------------------------- | ---- | ------------------------------------------------------------ |
919| localId  | number                                   | Yes  | ID of the target OS account.                                                |
920| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes  | Callback used to return all [constraints](#constraints) obtained.|
921
922**Example**: Obtain all constraints of OS account 100.
923
924  ```js
925  const accountManager = account_osAccount.getAccountManager();
926  var localId = 100;
927  accountManager.getOsAccountAllConstraints(localId, (err, constraints)=>{
928    console.log("getOsAccountAllConstraints err:" + JSON.stringify(err));
929    console.log("getOsAccountAllConstraints:" + JSON.stringify(constraints));
930  });
931  ```
932
933### getOsAccountAllConstraints
934
935getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
936
937Obtains all constraints enabled for an OS account. This API uses a promise to return the result.
938
939**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
940
941**System capability**: SystemCapability.Account.OsAccount
942
943**Parameters**
944
945| Name | Type  | Mandatory| Description        |
946| ------- | ------ | ---- | ------------ |
947| localId | number | Yes  | ID of the target OS account.|
948
949**Return value**
950
951| Type                              | Description                                                        |
952| :--------------------------------- | :----------------------------------------------------------- |
953| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the [constraints](#constraints) obtained.|
954
955**Example**: Obtain all constraints of OS account 100.
956
957  ```js
958  const accountManager = account_osAccount.getAccountManager();
959  var localId = 100;
960  accountManager.getOsAccountAllConstraints(localId).then((constraints) => {
961    console.log("getOsAccountAllConstraints, constraints: " + constraints);
962  }).catch((err) => {
963    console.log("getOsAccountAllConstraints err: "  + JSON.stringify(err));
964  });
965  ```
966
967### queryAllCreatedOsAccounts
968
969queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&gt;): void
970
971Obtains information about all the OS accounts created. This API uses an asynchronous callback to return the result.
972
973This is a system API and cannot be called by third-party applications.
974
975**System capability**: SystemCapability.Account.OsAccount
976
977**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
978
979**Parameters**
980
981| Name  | Type                                                        | Mandatory| Description                                              |
982| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
983| callback | AsyncCallback&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | Yes  | Callback used to return information about OS accounts created.|
984
985**Example**
986
987  ```js
988  const accountManager = account_osAccount.getAccountManager();
989  accountManager.queryAllCreatedOsAccounts((err, accountArr)=>{
990    console.log("queryAllCreatedOsAccounts err:" + JSON.stringify(err));
991    console.log("queryAllCreatedOsAccounts accountArr:" + JSON.stringify(accountArr));
992  });
993  ```
994
995### queryAllCreatedOsAccounts
996
997queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
998
999Obtains information about all the OS accounts created. This API uses a promise to return the result.
1000
1001This is a system API and cannot be called by third-party applications.
1002
1003**System capability**: SystemCapability.Account.OsAccount
1004
1005**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1006
1007**Return value**
1008
1009| Type                                                       | Description                                                        |
1010| :---------------------------------------------------------- | :----------------------------------------------------------- |
1011| Promise&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | Promise used to return information about OS accounts created.|
1012
1013**Example**
1014
1015  ```js
1016  const accountManager = account_osAccount.getAccountManager();
1017  accountManager.queryAllCreatedOsAccounts().then((accountArr) => {
1018    console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
1019  }).catch((err) => {
1020    console.log("queryAllCreatedOsAccounts err: "  + JSON.stringify(err));
1021  });
1022  ```
1023
1024### queryActivatedOsAccountIds<sup>8+</sup>
1025
1026queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
1027
1028Obtains information about all activated OS accounts. This API uses an asynchronous callback to return the result.
1029
1030**System capability**: SystemCapability.Account.OsAccount
1031
1032**Parameters**
1033
1034| Name  | Type                                    | Mandatory| Description                                                  |
1035| -------- | ---------------------------------------- | ---- | ------------------------------------------------------ |
1036| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes  | Callback used to return information about activated OS accounts.|
1037
1038**Example**
1039
1040  ```js
1041  const accountManager = account_osAccount.getAccountManager();
1042  accountManager.queryActivatedOsAccountIds((err, idArray)=>{
1043    console.log("queryActivatedOsAccountIds err:" + JSON.stringify(err));
1044    console.log("queryActivatedOsAccountIds idArray length:" + idArray.length);
1045    for(var i=0;i<idArray.length;i++) {
1046      console.info("activated os account id: " + idArray[i]);
1047    }
1048  });
1049  ```
1050
1051### queryActivatedOsAccountIds<sup>8+</sup>
1052
1053queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
1054
1055Obtains information about all activated OS accounts. This API uses a promise to return the result.
1056
1057**System capability**: SystemCapability.Account.OsAccount
1058
1059**Return value**
1060
1061| Type                              | Description                                                        |
1062| :--------------------------------- | :----------------------------------------------------------- |
1063| Promise&lt;Array&lt;number&gt;&gt; | Promise used to return information about activated OS accounts.|
1064
1065**Example**
1066
1067  ```js
1068  const accountManager = account_osAccount.getAccountManager();
1069  accountManager.queryActivatedOsAccountIds().then((idArray) => {
1070    console.log('queryActivatedOsAccountIds, idArray: ' + idArray);
1071  }).catch((err) => {
1072    console.log("queryActivatedOsAccountIds err: "  + JSON.stringify(err));
1073  });
1074  ```
1075
1076### createOsAccount
1077
1078createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1079
1080Creates an OS account. This API uses an asynchronous callback to return the result.
1081
1082This is a system API and cannot be called by third-party applications.
1083
1084**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1085
1086**System capability**: SystemCapability.Account.OsAccount
1087
1088**Parameters**
1089
1090| Name   | Type                                                | Mandatory| Description                                      |
1091| :-------- | ---------------------------------------------------- | ---- | ------------------------------------------ |
1092| localName | string                                               | Yes  | Name of the OS account to create.                    |
1093| type      | [OsAccountType](#osaccounttype)                      | Yes  | Type of the OS account to create.                    |
1094| callback  | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return the OS account created.|
1095
1096**Example**
1097
1098  ```js
1099  const accountManager = account_osAccount.getAccountManager();
1100  accountManager.createOsAccount("testName", osaccount.OsAccountType.NORMAL, (err, osAccountInfo)=>{
1101    console.log("createOsAccount err:" + JSON.stringify(err));
1102    console.log("createOsAccount osAccountInfo:" + JSON.stringify(osAccountInfo));
1103  });
1104  ```
1105
1106### createOsAccount
1107
1108createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInfo&gt;
1109
1110Creates an OS account. This API uses a promise to return the result.
1111
1112This is a system API and cannot be called by third-party applications.
1113
1114**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1115
1116**System capability**: SystemCapability.Account.OsAccount
1117
1118**Parameters**
1119
1120| Name   | Type                           | Mandatory| Description                  |
1121| --------- | ------------------------------- | ---- | ---------------------- |
1122| localName | string                          | Yes  | Name of the OS account to create.|
1123| type      | [OsAccountType](#osaccounttype) | Yes  | Type of the OS account to create.|
1124
1125**Return value**
1126
1127| Type                                          | Description                                                        |
1128| :--------------------------------------------- | :----------------------------------------------------------- |
1129| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return the OS account created.|
1130
1131**Example**
1132
1133  ```js
1134  const accountManager = account_osAccount.getAccountManager();
1135  accountManager.createOsAccount("testAccountName", osaccount.OsAccountType.NORMAL).then((accountInfo) => {
1136    console.log("createOsAccount, accountInfo: " + JSON.stringify(accountInfo));
1137  }).catch((err) => {
1138    console.log("createOsAccount err: "  + JSON.stringify(err));
1139  });
1140  ```
1141
1142### createOsAccountForDomain<sup>8+</sup>
1143
1144createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1145
1146Creates an OS account and associates it with the specified domain account. This API uses an asynchronous callback to return the result.
1147
1148This is a system API and cannot be called by third-party applications.
1149
1150**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1151
1152**System capability**: SystemCapability.Account.OsAccount
1153
1154**Parameters**
1155
1156| Name    | Type                                                | Mandatory| Description                                      |
1157| :--------- | ---------------------------------------------------- | ---- | ------------------------------------------ |
1158| type       | [OsAccountType](#osaccounttype)                      | Yes  | Type of the OS account to create.                    |
1159| domainInfo | [DomainAccountInfo](#domainaccountinfo8)              | Yes  | Domain account information.                              |
1160| callback   | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return the OS account created.|
1161
1162**Example**
1163
1164  ```js
1165  const accountManager = account_osAccount.getAccountManager();
1166  var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
1167  accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo, (err, osAccountInfo)=>{
1168    console.log("createOsAccountForDomain err:" + JSON.stringify(err));
1169    console.log("createOsAccountForDomain osAccountInfo:" + JSON.stringify(osAccountInfo));
1170  });
1171  ```
1172
1173### createOsAccountForDomain<sup>8+</sup>
1174
1175createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;
1176
1177Creates an OS account and associates it with the specified domain account. This API uses a promise to return the result.
1178
1179This is a system API and cannot be called by third-party applications.
1180
1181**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1182
1183**System capability**: SystemCapability.Account.OsAccount
1184
1185**Parameters**
1186
1187| Name    | Type                                   | Mandatory| Description                  |
1188| ---------- | --------------------------------------- | ---- | ---------------------- |
1189| type       | [OsAccountType](#osaccounttype)         | Yes  | Type of the OS account to create.|
1190| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.          |
1191
1192**Return value**
1193
1194| Type                                          | Description                                                        |
1195| :--------------------------------------------- | :----------------------------------------------------------- |
1196| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return the OS account created.|
1197
1198**Example**
1199
1200  ```js
1201  const accountManager = account_osAccount.getAccountManager();
1202  var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
1203  accountManager.createOsAccountForDomain(osaccount.OsAccountType.NORMAL, domainInfo).then((accountInfo) => {
1204    console.log("createOsAccountForDomain, account info: " + JSON.stringify(accountInfo));
1205  }).catch((err) => {
1206    console.log("createOsAccountForDomain err: "  + JSON.stringify(err));
1207  });
1208  ```
1209
1210### queryCurrentOsAccount
1211
1212queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1213
1214Obtains information about the OS account to which the current process belongs. This API uses an asynchronous callback to return the result.
1215
1216**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1217
1218**System capability**: SystemCapability.Account.OsAccount
1219
1220**Parameters**
1221
1222| Name  | Type                                                | Mandatory| Description                                          |
1223| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
1224| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return information about the OS account obtained.|
1225
1226**Example**
1227
1228  ```js
1229  const accountManager = account_osAccount.getAccountManager();
1230  accountManager.queryCurrentOsAccount((err, curAccountInfo)=>{
1231    console.log("queryCurrentOsAccount err:" + JSON.stringify(err));
1232    console.log("queryCurrentOsAccount curAccountInfo:" + JSON.stringify(curAccountInfo));
1233  });
1234  ```
1235
1236### queryCurrentOsAccount
1237
1238queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
1239
1240Obtains information about the OS account to which the current process belongs. This API uses a promise to return the result.
1241
1242**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1243
1244**System capability**: SystemCapability.Account.OsAccount
1245
1246**Return value**
1247
1248| Type                                          | Description                                                        |
1249| :--------------------------------------------- | :----------------------------------------------------------- |
1250| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return information about the OS account obtained.|
1251
1252**Example**
1253
1254  ```js
1255  const accountManager = account_osAccount.getAccountManager();
1256  accountManager.queryCurrentOsAccount().then((accountInfo) => {
1257    console.log("queryCurrentOsAccount, accountInfo: " + JSON.stringify(accountInfo));
1258  }).catch((err) => {
1259    console.log("queryCurrentOsAccount err: "  + JSON.stringify(err));
1260  });
1261  ```
1262
1263### queryOsAccountById
1264
1265queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1266
1267Obtains information about an OS account. This API uses an asynchronous callback to return the result.
1268
1269This is a system API and cannot be called by third-party applications.
1270
1271**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1272
1273**System capability**: SystemCapability.Account.OsAccount
1274
1275**Parameters**
1276
1277| Name  | Type                                                | Mandatory| Description                                    |
1278| -------- | ---------------------------------------------------- | ---- | ---------------------------------------- |
1279| localId  | number                                               | Yes  | ID of the target OS account.                    |
1280| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | Yes  | Callback used to return the OS account information obtained.|
1281
1282**Example**: Query information about OS account 100.
1283
1284  ```js
1285  const accountManager = account_osAccount.getAccountManager();
1286  var localId = 100;
1287  accountManager.queryOsAccountById(localId, (err, accountInfo)=>{
1288    console.log("queryOsAccountById err:" + JSON.stringify(err));
1289    console.log("queryOsAccountById accountInfo:" + JSON.stringify(accountInfo));
1290  });
1291  ```
1292
1293### queryOsAccountById
1294
1295queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
1296
1297Obtains information about an OS account. This API uses a promise to return the result.
1298
1299This is a system API and cannot be called by third-party applications.
1300
1301**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1302
1303**System capability**: SystemCapability.Account.OsAccount
1304
1305**Parameters**
1306
1307| Name | Type  | Mandatory| Description                |
1308| ------- | ------ | ---- | -------------------- |
1309| localId | number | Yes  | ID of the target OS account.|
1310
1311**Return value**
1312
1313| Type                                          | Description                                                        |
1314| :--------------------------------------------- | :----------------------------------------------------------- |
1315| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise used to return the OS account information obtained.|
1316
1317**Example**: Query information about OS account 100.
1318
1319  ```js
1320  const accountManager = account_osAccount.getAccountManager();
1321  var localId = 100;
1322  accountManager.queryOsAccountById(localId).then((accountInfo) => {
1323    console.log("queryOsAccountById, accountInfo: " + JSON.stringify(accountInfo));
1324  }).catch((err) => {
1325    console.log("queryOsAccountById err: "  + JSON.stringify(err));
1326  });
1327  ```
1328
1329### getOsAccountTypeFromProcess
1330
1331getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
1332
1333Obtains the type of the OS account to which the current process belongs. This API uses an asynchronous callback to return the result.
1334
1335**System capability**: SystemCapability.Account.OsAccount
1336
1337**Parameters**
1338
1339| Name  | Type                                                | Mandatory| Description                                                |
1340| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------------- |
1341| callback | AsyncCallback&lt;[OsAccountType](#osaccounttype)&gt; | Yes  | Callback used to return the OS account type.|
1342
1343**Example**
1344
1345  ```js
1346  const accountManager = account_osAccount.getAccountManager();
1347  accountManager.getOsAccountTypeFromProcess((err, accountType) => {
1348    console.log("getOsAccountTypeFromProcess err: " + JSON.stringify(err));
1349    console.log('getOsAccountTypeFromProcess accountType: ' + accountType);
1350  });
1351  ```
1352
1353### getOsAccountTypeFromProcess
1354
1355getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
1356
1357Obtains the type of the OS account to which the current process belongs. This API uses a promise to return the result.
1358
1359**System capability**: SystemCapability.Account.OsAccount
1360
1361**Return value**
1362
1363| Type                                          | Description                                                        |
1364| :--------------------------------------------- | :----------------------------------------------------------- |
1365| Promise&lt;[OsAccountType](#osaccounttype)&gt; | Promise used to return the OS account type.|
1366
1367**Example**
1368
1369  ```js
1370  const accountManager = account_osAccount.getAccountManager();
1371  accountManager.getOsAccountTypeFromProcess().then((accountType) => {
1372    console.log('getOsAccountTypeFromProcess, accountType: ' + accountType);
1373  }).catch((err) => {
1374    console.log("getOsAccountTypeFromProcess err: "  + JSON.stringify(err));
1375  });
1376  ```
1377
1378### getDistributedVirtualDeviceId
1379
1380getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
1381
1382Obtains the ID of this distributed virtual device. This API uses an asynchronous callback to return the result.
1383
1384**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
1385
1386**System capability**: SystemCapability.Account.OsAccount
1387
1388**Parameters**
1389
1390| Name  | Type                       | Mandatory| Description                                |
1391| -------- | --------------------------- | ---- | ------------------------------------ |
1392| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the device ID obtained.|
1393
1394**Example**
1395
1396  ```js
1397  const accountManager = account_osAccount.getAccountManager();
1398  accountManager.getDistributedVirtualDeviceId((err, virtualID) => {
1399    console.log("getDistributedVirtualDeviceId err: " + JSON.stringify(err));
1400    console.log('getDistributedVirtualDeviceId virtualID: ' + virtualID);
1401  });
1402  ```
1403
1404### getDistributedVirtualDeviceId
1405
1406getDistributedVirtualDeviceId(): Promise&lt;string&gt;
1407
1408Obtains the ID of this distributed virtual device. This API uses a promise to return the result.
1409
1410**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
1411
1412**System capability**: SystemCapability.Account.OsAccount
1413
1414**Return value**
1415
1416| Type                 | Description                                                        |
1417| :-------------------- | :----------------------------------------------------------- |
1418| Promise&lt;string&gt; | Promise used to return the device ID obtained.|
1419
1420**Example**
1421
1422  ```js
1423  const accountManager = account_osAccount.getAccountManager();
1424  accountManager.getDistributedVirtualDeviceId().then((virtualID) => {
1425    console.log('getDistributedVirtualDeviceId, virtualID: ' + virtualID);
1426  }).catch((err) => {
1427    console.log("getDistributedVirtualDeviceId err: "  + JSON.stringify(err));
1428  });
1429  ```
1430
1431### getOsAccountProfilePhoto
1432
1433getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;): void
1434
1435Obtains the profile photo of an OS account. This API uses an asynchronous callback to return the result.
1436
1437This is a system API and cannot be called by third-party applications.
1438
1439**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1440
1441**System capability**: SystemCapability.Account.OsAccount
1442
1443**Parameters**
1444
1445| Name  | Type                       | Mandatory| Description                                    |
1446| -------- | --------------------------- | ---- | ---------------------------------------- |
1447| localId  | number                      | Yes  | ID of the target OS account.                            |
1448| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the profile photo obtained.|
1449
1450**Example**: Obtain the profile photo of OS account 100.
1451
1452  ```js
1453  const accountManager = account_osAccount.getAccountManager();
1454  var localId = 100;
1455  accountManager.getOsAccountProfilePhoto(localId, (err, photo)=>{
1456    console.log("getOsAccountProfilePhoto err:" + JSON.stringify(err));
1457    console.log("get photo:" + photo + " by localId: " + localId);
1458  });
1459  ```
1460
1461### getOsAccountProfilePhoto
1462
1463getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
1464
1465Obtains the profile photo of an OS account. This API uses a promise to return the result.
1466
1467This is a system API and cannot be called by third-party applications.
1468
1469**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1470
1471**System capability**: SystemCapability.Account.OsAccount
1472
1473**Parameters**
1474
1475| Name | Type  | Mandatory| Description        |
1476| ------- | ------ | ---- | ------------ |
1477| localId | number | Yes  | ID of the target OS account.|
1478
1479**Return value**
1480
1481| Type                 | Description                                                        |
1482| :-------------------- | :----------------------------------------------------------- |
1483| Promise&lt;string&gt; | Promise used to return the profile photo obtained.|
1484
1485**Example**: Obtain the profile photo of OS account 100.
1486
1487  ```js
1488  const accountManager = account_osAccount.getAccountManager();
1489  var localId = 100;
1490  accountManager.getOsAccountProfilePhoto(localId).then((photo) => {
1491    console.log("getOsAccountProfilePhoto: " + photo);
1492  }).catch((err) => {
1493    console.log("getOsAccountProfilePhoto err: "  + JSON.stringify(err));
1494  });
1495  ```
1496
1497### setOsAccountProfilePhoto
1498
1499setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback&lt;void&gt;): void
1500
1501Sets a profile photo for an OS account. This API uses an asynchronous callback to return the result.
1502
1503This is a system API and cannot be called by third-party applications.
1504
1505**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1506
1507**System capability**: SystemCapability.Account.OsAccount
1508
1509**Parameters**
1510
1511| Name  | Type                     | Mandatory| Description        |
1512| -------- | ------------------------- | ---- | ------------ |
1513| localId  | number                    | Yes  | ID of the target OS account.|
1514| photo    | string                    | Yes  | Profile photo information.  |
1515| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.  |
1516
1517**Example**: Set a profile photo for OS account 100.
1518
1519  ```js
1520  const accountManager = account_osAccount.getAccountManager();
1521  var localId = 100;
1522  var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
1523  "Cxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACwSURBVDhPvZLBDYMwDEV/ugsXRjAT0EHCOuFIBwkbdIRewi6unbiAyoGgSn1SFH85+Y"+
1524  "q/4ljARW62X+LHS8uIzjm4dXUYF+utzBikB52Jo5e5iEPKqpACk7R9NM2RvWm5tIkD2czLCUFNKLD6IjdMHFHDzws285MgGrT0xCtp3WOKHo"+
1525  "+7q0mP0DZW9pNmoEFUzrQjp5cCnaen2kSJXLFD8ghbXyZCMQf/8e8Ns1XVAG/XAgqKzVnJFAAAAABJRU5ErkJggg=="
1526  osAccountManager.setOsAccountProfilePhoto(localId, photo, (err)=>{
1527    console.log("setOsAccountProfilePhoto err:" + JSON.stringify(err));
1528  });
1529  ```
1530
1531### setOsAccountProfilePhoto
1532
1533setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
1534
1535Sets a profile photo for an OS account. This API uses a promise to return the result.
1536
1537This is a system API and cannot be called by third-party applications.
1538
1539**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1540
1541**System capability**: SystemCapability.Account.OsAccount
1542
1543**Parameters**
1544
1545| Name | Type  | Mandatory| Description        |
1546| ------- | ------ | ---- | ------------ |
1547| localId | number | Yes  | ID of the target OS account.|
1548| photo   | string | Yes  | Profile photo information.  |
1549
1550**Return value**
1551
1552| Type               | Description                               |
1553| :------------------ | :---------------------------------- |
1554| Promise&lt;void&gt; | Promise used to return the result.|
1555
1556**Example**: Set a profile photo for OS account 100.
1557
1558  ```js
1559  const accountManager = account_osAccount.getAccountManager();
1560  var localId = 100;
1561  var photo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA"+
1562  "Cxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACwSURBVDhPvZLBDYMwDEV/ugsXRjAT0EHCOuFIBwkbdIRewi6unbiAyoGgSn1SFH85+Y"+
1563  "q/4ljARW62X+LHS8uIzjm4dXUYF+utzBikB52Jo5e5iEPKqpACk7R9NM2RvWm5tIkD2czLCUFNKLD6IjdMHFHDzws285MgGrT0xCtp3WOKHo"+
1564  "+7q0mP0DZW9pNmoEFUzrQjp5cCnaen2kSJXLFD8ghbXyZCMQf/8e8Ns1XVAG/XAgqKzVnJFAAAAABJRU5ErkJggg=="
1565  accountManager.setOsAccountProfilePhoto(localId, photo).then(() => {
1566    console.log("setOsAccountProfilePhoto success");
1567  }).catch((err) => {
1568    console.log("setOsAccountProfilePhoto err: "  + JSON.stringify(err));
1569  });
1570  ```
1571
1572### getOsAccountLocalIdBySerialNumber<sup>8+</sup>
1573
1574getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&lt;number&gt;): void
1575
1576Obtains the OS account ID based on the SN. This API uses an asynchronous callback to return the result.
1577
1578**System capability**: SystemCapability.Account.OsAccount
1579
1580**Parameters**
1581
1582| Name      | Type                       | Mandatory| Description                                            |
1583| ------------ | --------------------------- | ---- | ------------------------------------------------ |
1584| serialNumber | number                      | Yes  | Account SN.                                      |
1585| callback     | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the OS account ID obtained.|
1586
1587**Example**: Obtain the ID of the OS account whose SN is **12345**.
1588
1589  ```js
1590  const accountManager = account_osAccount.getAccountManager();
1591  var serialNumber = 12345;
1592  accountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
1593    console.log("ger localId err:" + JSON.stringify(err));
1594    console.log("get localId:" + localId + " by serialNumber: " + serialNumber);
1595  });
1596  ```
1597
1598### getOsAccountLocalIdBySerialNumber<sup>8+</sup>
1599
1600getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
1601
1602Obtains the OS account ID based on the SN. This API uses a promise to return the result.
1603
1604**System capability**: SystemCapability.Account.OsAccount
1605
1606**Parameters**
1607
1608| Name      | Type  | Mandatory| Description      |
1609| ------------ | ------ | ---- | ---------- |
1610| serialNumber | number | Yes  | Account SN.|
1611
1612**Return value**
1613
1614| Type                 | Description                                                        |
1615| :-------------------- | :----------------------------------------------------------- |
1616| Promise&lt;number&gt; | Promise used to return the OS account ID obtained.|
1617
1618**Example**: Obtain the ID of the OS account whose SN is **12345**.
1619
1620  ```js
1621  const accountManager = account_osAccount.getAccountManager();
1622  var serialNumber = 12345;
1623  accountManager.getOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => {
1624    console.log("getOsAccountLocalIdBySerialNumber localId: " + localId);
1625  }).catch((err) => {
1626    console.log("getOsAccountLocalIdBySerialNumber err: "  + JSON.stringify(err));
1627  });
1628  ```
1629
1630### getSerialNumberByOsAccountLocalId<sup>8+</sup>
1631
1632getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;number&gt;): void
1633
1634Obtains the SN of an OS account based on the account ID. This API uses an asynchronous callback to return the result.
1635
1636**System capability**: SystemCapability.Account.OsAccount
1637
1638**Parameters**
1639
1640| Name  | Type                       | Mandatory| Description                                      |
1641| -------- | --------------------------- | ---- | ------------------------------------------ |
1642| localId  | number                      | Yes  | ID of the target OS account.                              |
1643| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the account SN obtained.|
1644
1645**Example**: Obtain the SN of OS account 100.
1646
1647  ```js
1648  const accountManager = account_osAccount.getAccountManager();
1649  var localId = 100;
1650  accountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
1651    console.log("ger serialNumber err:" + JSON.stringify(err));
1652    console.log("get serialNumber:" + serialNumber + " by localId: " + localId);
1653  });
1654  ```
1655
1656### getSerialNumberByOsAccountLocalId<sup>8+</sup>
1657
1658getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
1659
1660Obtains the SN of an OS account based on the account ID. This API uses a promise to return the result.
1661
1662**System capability**: SystemCapability.Account.OsAccount
1663
1664**Parameters**
1665
1666| Name | Type  | Mandatory| Description        |
1667| ------- | ------ | ---- | ------------ |
1668| localId | number | Yes  | ID of the target OS account.|
1669
1670**Return value**
1671
1672| Type                 | Description                                                        |
1673| :-------------------- | :----------------------------------------------------------- |
1674| Promise&lt;number&gt; | Promise used to return the account SN obtained.|
1675
1676**Example**: Obtain the SN of OS account 100.
1677
1678  ```js
1679  const accountManager = account_osAccount.getAccountManager();
1680  var localId = 100;
1681  accountManager.getSerialNumberByOsAccountLocalId(localId).then((serialNumber) => {
1682    console.log("getSerialNumberByOsAccountLocalId serialNumber: " + serialNumber);
1683  }).catch((err) => {
1684    console.log("getSerialNumberByOsAccountLocalId err: "  + JSON.stringify(err));
1685  });
1686  ```
1687
1688### on
1689
1690on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&gt;): void
1691
1692Subscribes to OS account changes. This API uses an asynchronous callback to return the result.
1693
1694This is a system API and cannot be called by third-party applications.
1695
1696**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1697
1698**System capability**: SystemCapability.Account.OsAccount
1699
1700**Parameters**
1701
1702| Name  | Type                      | Mandatory| Description                                                        |
1703| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1704| type     | 'activate' \| 'activating' | Yes  | Type of the event to subscribe to. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.|
1705| name     | string                     | Yes  | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes.          |
1706| callback | Callback&lt;number&gt;     | Yes  | Callback used to return the OS account ID and status changes.  |
1707
1708**Example**
1709
1710  ```js
1711  const accountManager = account_osAccount.getAccountManager();
1712  function onCallback(receiveLocalId){
1713    console.log("receive localId:" + receiveLocalId);
1714  }
1715  accountManager.on("activating", "osAccountOnOffNameA", onCallback);
1716  ```
1717
1718### off
1719
1720off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number&gt;): void
1721
1722Unsubscribes from the OS account changes. This API uses an asynchronous callback to return the result.
1723
1724This is a system API and cannot be called by third-party applications.
1725
1726**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1727
1728**System capability**: SystemCapability.Account.OsAccount
1729
1730**Parameters**
1731
1732| Name  | Type                      | Mandatory| Description                                                        |
1733| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1734| type     | 'activate' \| 'activating' | Yes  | Type of the event to unsubscribe from. The value **activate** means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.|
1735| name     | string                     | Yes  | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
1736| callback | Callback&lt;number&gt;     | No  | Callback used to return the OS account changes. By default, **0** is returned.                     |
1737
1738**Example**
1739
1740  ```js
1741  const accountManager = account_osAccount.getAccountManager();
1742  function offCallback(){
1743    console.log("off enter")
1744  }
1745  accountManager.off("activating", "osAccountOnOffNameA", offCallback);
1746  ```
1747
1748## OsAccountInfo
1749
1750Defines information about an OS account.
1751
1752**System capability**: SystemCapability.Account.OsAccount
1753
1754| Name                        | Type                                                        | Mandatory| Description                             |
1755| ------------------------------ | ------------------------------------------------------------ | ---- | --------------------------------- |
1756| localId                        | number                                                       | Yes  | ID of the target OS account.                     |
1757| localName                      | string                                                       | Yes  | OS account name.                   |
1758| type                           | [OsAccountType](#osaccounttype)                              | Yes  | OS account type.                     |
1759| constraints                    | Array&lt;string&gt;                                          | No  | [Constraints](#constraints) on the OS account.|
1760| isVerified<sup>8+</sup>        | boolean                                                      | Yes  | Whether the OS account is verified.                     |
1761| photo<sup>8+</sup>             | string                                                       | No  | Profile photo of the OS account.                     |
1762| createTime<sup>8+</sup>        | number                                                       | Yes  | Time when the OS account was created.                 |
1763| lastLoginTime<sup>8+</sup>     | number                                                       | No  | Last login time of the OS account.         |
1764| serialNumber<sup>8+</sup>      | number                                                       | Yes  | SN of the OS account.                     |
1765| isActived<sup>8+</sup>         | boolean                                                      | Yes  | Whether the OS account is activated.                 |
1766| isCreateCompleted<sup>8+</sup> | boolean                                                      | Yes  | Whether the OS account information is complete.             |
1767| distributedInfo                | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | No  | Distributed account information.                   |
1768| domainInfo<sup>8+</sup>        | [DomainAccountInfo](#domainaccountinfo8)                      | No  | Domain account information.                       |
1769
1770## DomainAccountInfo<sup>8+</sup>
1771
1772Domain account information.
1773
1774**System capability**: SystemCapability.Account.OsAccount
1775
1776| Name     | Type  | Mandatory| Description      |
1777| ----------- | ------ | ---- | ---------- |
1778| domain      | string | Yes  | Domain name.    |
1779| accountName | string | Yes  | Domain account name.|
1780
1781## Constraints
1782
1783| Constraint                                 | Description                          |
1784| ------------------------------------- | ------------------------------ |
1785| constraint.wifi                       | A user is not allowed to use Wi-Fi.                  |
1786| constraint.wifi.set                   | A user is not allowed to change Wi-Fi settings.                  |
1787| constraint.locale.set                 | A user is not allowed to change the device language.              |
1788| constraint.app.accounts               | A user is not allowed to add or delete app accounts.        |
1789| constraint.apps.install               | A user is not allowed to install apps.                  |
1790| constraint.apps.uninstall             | A user is not allowed to uninstall apps.                  |
1791| constraint.location.shared            | A user is not allowed to enable location sharing.              |
1792| constraint.unknown.sources.install    | A user is not allowed to install apps from unknown sources.        |
1793| constraint.global.unknown.app.install | All users are not allowed to install apps from unknown sources.|
1794| constraint.bluetooth.set              | A user is not allowed to configure Bluetooth.                  |
1795| constraint.bluetooth | The use of Bluetooth is prohibited on the device.|
1796| constraint.bluetooth.share | Bluetooth sharing is prohibited.|
1797| constraint.usb.file.transfer | A user is not allowed to transfer files over USB.|
1798| constraint.credentials.set | A user is not allowed to configure user credentials.|
1799| constraint.os.account.remove | An admin user is not allowed to remove users or a non-admin user is not allowed to remove itself.|
1800| constraint.managed.profile.remove | The managed profiles of this user cannot be removed.|
1801| constraint.debug.features.use | A user is not allowed to enable or access debugging features.|
1802| constraint.vpn.set | A user is not allowed to configure a VPN.|
1803| constraint.date.time.set | A user is not allowed to set date, time, or time zone.|
1804| constraint.tethering.config | A user is not allowed to configure Tethering.|
1805| constraint.network.reset | A user is not allowed to reset network settings.|
1806| constraint.factory.reset | A user is not allowed to reset factory settings.|
1807| constraint.os.account.create | A user is not allowed to create users.|
1808| constraint.add.managed.profile | A user is not allowed to add managed profiles.|
1809| constraint.apps.verify.disable | A user is not allowed to disable app verification.|
1810| constraint.cell.broadcasts.set | A user is not allowed to configure cell broadcasts.|
1811| constraint.mobile.networks.set | A user is not allowed to configure radio networks.|
1812| constraint.control.apps | A user is not allowed to modify apps in **Settings** or the boot module.|
1813| constraint.physical.media | A user is not allowed to mount external physical media.|
1814| constraint.microphone | A user is not allowed to use microphones.|
1815| constraint.microphone.unmute | A user is not allowed to unmute the microphone.|
1816| constraint.volume.adjust | A user is not allowed to adjust the volume.|
1817| constraint.calls.outgoing | A user is not allowed to make outgoing calls.|
1818| constraint.sms.use | A user is not allowed to send or receive SMS messages.|
1819| constraint.fun | A user is not allowed to have entertainment.|
1820| constraint.windows.create | Windows other than app windows cannot be created.|
1821| constraint.system.error.dialogs | Error dialogs for crashed or unresponsive apps are prohibited.|
1822| constraint.cross.profile.copy.paste | Pasting clipboard content to other users or profiles is prohibited.|
1823| constraint.beam.outgoing | A user is not allowed to use Near Field Communications (NFC) to transfer data from apps.|
1824| constraint.wallpaper | A user is not allowed to manage wallpapers.|
1825| constraint.safe.boot | A user is not allowed to reboot the device in safe boot mode.|
1826| constraint.parent.profile.app.linking | The apps in the parent profile are allowed to handle web links from the managed profile.|
1827| constraint.audio.record | Audio recording is prohibited.|
1828| constraint.camera.use | The use of cameras is prohibited.|
1829| constraint.os.account.background.run | Running in the background is prohibited.|
1830| constraint.data.roam | A user is not allowed to use cellular data when roaming.|
1831| constraint.os.account.set.icon | A user is not allowed to change their icon.|
1832| constraint.wallpaper.set | A user is not allowed to set a wallpaper.|
1833| constraint.oem.unlock | A user is not allowed to enable OEM unlock.|
1834| constraint.device.unmute | A user is not allowed to unmute the device.|
1835| constraint.password.unified | The managed profile is not allowed to have unified lock screen challenge with the primary user.|
1836| constraint.autofill | A user is not allowed to use the autofill service.|
1837| constraint.content.capture | Capturing the content of a user's screen is prohibited.|
1838| constraint.content.suggestions | A user is not allowed to receive content suggestions.|
1839| constraint.os.account.start | User switching is blocked.|
1840| constraint.location.set | A user is not allowed to configure the location service.|
1841| constraint.airplane.mode.set | The airplane mode is prohibited on the device.|
1842| constraint.brightness.set | A user is not allowed to configure brightness.|
1843| constraint.share.into.profile | A user is not allowed to share files, images, or data from the primary user to the managed profile.|
1844| constraint.ambient.display | Ambient display is prohibited for the user.|
1845| constraint.screen.timeout.set | A user is not allowed to configure the screen off timeout.|
1846| constraint.print | A user is not allowed to print.|
1847| constraint.private.dns.set | A user is not allowed to configure a private domain name server (DNS).|
1848