1# @ohos.enterprise.restrictions (限制类策略)(系统接口) 2 3本模块提供设置通用限制类策略能力,包括禁用或启用设备打印、HDC等能力。 4 5> **说明**: 6> 7> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 8> 9> 本模块接口仅可在Stage模型下使用。 10> 11> 本模块接口仅对[设备管理应用](../../mdm/mdm-kit-guide.md#功能介绍)开放,需将[设备管理应用激活](js-apis-enterprise-adminManager-sys.md#adminmanagerenableadmin)后调用,实现相应功能。 12> 13> 当前页面仅包含本模块的系统接口,其他公开接口参见。其他公开接口参见[@ohos.enterprise.restrictions](js-apis-enterprise-restrictions.md)。 14 15## 导入模块 16 17```ts 18import { restrictions } from '@kit.MDMKit'; 19``` 20 21## restrictions.setPrinterDisabled 22 23setPrinterDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void 24 25指定设备管理应用使设备禁用或启用打印能力。使用callback异步回调。 26 27**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 28 29**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 30 31**参数:** 32 33| 参数名 | 类型 | 必填 | 说明 | 34| ----- | ----------------------------------- | ---- | ------- | 35| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 36| disabled | boolean | 是 | true表示禁止使用打印能力,false表示允许使用打印能力。 | 37| callback | AsyncCallback\<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | 38 39**错误码**: 40 41以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 42 43| 错误码ID | 错误信息 | 44| ------- | ---------------------------------------------------------------------------- | 45| 9200001 | The application is not an administrator application of the device. | 46| 9200002 | The administrator application does not have permission to manage the device. | 47| 201 | Permission verification failed. The application does not have the permission required to call the API. | 48| 202 | Permission verification failed. A non-system application calls a system API. | 49| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 50 51**示例:** 52 53```ts 54import { Want } from '@kit.AbilityKit'; 55let wantTemp: Want = { 56 bundleName: 'bundleName', 57 abilityName: 'abilityName', 58}; 59 60restrictions.setPrinterDisabled(wantTemp, true, (err) => { 61 if (err) { 62 console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`); 63 return; 64 } 65 console.info('Succeeded in setting printer disabled'); 66}) 67``` 68 69## restrictions.setPrinterDisabled 70 71setPrinterDisabled(admin: Want, disabled: boolean): Promise\<void> 72 73指定设备管理应用使设备禁用或启用打印能力。使用Promise异步回调。 74 75**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 76 77**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 78 79**参数:** 80 81| 参数名 | 类型 | 必填 | 说明 | 82| ----- | ----------------------------------- | ---- | ------- | 83| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 84| disabled | boolean | 是 | true表示禁止使用打印能力,false表示允许使用打印能力。 | 85 86**返回值:** 87 88| 类型 | 说明 | 89| ----- | ----------------------------------- | 90| Promise\<void> | 无返回结果的Promise对象。当指定设备管理应用禁止或允许使用打印能力失败时抛出错误对象。 | 91 92**错误码**: 93 94以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 95 96| 错误码ID | 错误信息 | 97| ------- | ---------------------------------------------------------------------------- | 98| 9200001 | The application is not an administrator application of the device. | 99| 9200002 | The administrator application does not have permission to manage the device. | 100| 201 | Permission verification failed. The application does not have the permission required to call the API. | 101| 202 | Permission verification failed. A non-system application calls a system API. | 102| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 103 104**示例:** 105 106```ts 107import { Want } from '@kit.AbilityKit'; 108import { BusinessError } from '@kit.BasicServicesKit'; 109let wantTemp: Want = { 110 bundleName: 'bundleName', 111 abilityName: 'abilityName', 112}; 113 114restrictions.setPrinterDisabled(wantTemp, true).then(() => { 115 console.info('Succeeded in setting printer disabled'); 116}).catch((err: BusinessError) => { 117 console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`); 118}) 119``` 120 121## restrictions.isPrinterDisabled 122 123isPrinterDisabled(admin: Want, callback: AsyncCallback\<boolean>): void 124 125指定设备管理应用查询设备打印能力是否被禁用。使用callback异步回调。 126 127**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 128 129**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 130 131**参数:** 132 133| 参数名 | 类型 | 必填 | 说明 | 134| ----- | ----------------------------------- | ---- | ------- | 135| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 136| callback | AsyncCallback\<boolean> | 是 | 回调函数,callback方式返回设备打印能力是否被禁用,true表示设备打印能力被禁用,false表示设备打印能力未被禁用。 | 137 138**错误码**: 139 140以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 141 142| 错误码ID | 错误信息 | 143| ------- | ---------------------------------------------------------------------------- | 144| 9200001 | The application is not an administrator application of the device. | 145| 9200002 | The administrator application does not have permission to manage the device. | 146| 201 | Permission verification failed. The application does not have the permission required to call the API. | 147| 202 | Permission verification failed. A non-system application calls a system API. | 148| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 149 150**示例:** 151 152```ts 153import { Want } from '@kit.AbilityKit'; 154let wantTemp: Want = { 155 bundleName: 'bundleName', 156 abilityName: 'abilityName', 157}; 158 159restrictions.isPrinterDisabled(wantTemp, (err, result) => { 160 if (err) { 161 console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`); 162 return; 163 } 164 console.info(`Succeeded in querying is the printing function disabled : ${result}`); 165}) 166``` 167 168## restrictions.isPrinterDisabled 169 170isPrinterDisabled(admin: Want): Promise\<boolean> 171 172指定设备管理应用查询设备打印能力是否被禁用。使用Promise异步回调。 173 174**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 175 176**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 177 178**参数:** 179 180| 参数名 | 类型 | 必填 | 说明 | 181| ----- | ----------------------------------- | ---- | ------- | 182| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 183 184**返回值:** 185 186| 类型 | 说明 | 187| ----- | ----------------------------------- | 188| Promise\<boolean> | Promise对象。promise方式返回设备打印能力是否被禁用,true表示设备打印能力被禁用,false表示设备打印能力未被禁用。 | 189 190**错误码**: 191 192以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 193 194| 错误码ID | 错误信息 | 195| ------- | ---------------------------------------------------------------------------- | 196| 9200001 | The application is not an administrator application of the device. | 197| 9200002 | The administrator application does not have permission to manage the device. | 198| 201 | Permission verification failed. The application does not have the permission required to call the API. | 199| 202 | Permission verification failed. A non-system application calls a system API. | 200| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 201 202**示例:** 203 204```ts 205import { Want } from '@kit.AbilityKit'; 206import { BusinessError } from '@kit.BasicServicesKit'; 207let wantTemp: Want = { 208 bundleName: 'bundleName', 209 abilityName: 'abilityName', 210}; 211 212restrictions.isPrinterDisabled(wantTemp).then((result) => { 213 console.info(`Succeeded in querying is the printing function disabled : ${result}`); 214}).catch((err: BusinessError) => { 215 console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`); 216}) 217``` 218 219## restrictions.setHdcDisabled 220 221setHdcDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void 222 223指定设备管理应用使设备禁用或启用HDC。使用callback异步回调。 224 225**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 226 227**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 228 229**参数:** 230 231| 参数名 | 类型 | 必填 | 说明 | 232| ----- | ----------------------------------- | ---- | ------- | 233| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 234| disabled | boolean | 是 | true表示禁止使用HDC,false表示允许使用HDC。 | 235| callback | AsyncCallback\<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | 236 237**错误码**: 238 239以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 240 241| 错误码ID | 错误信息 | 242| ------- | ---------------------------------------------------------------------------- | 243| 9200001 | The application is not an administrator application of the device. | 244| 9200002 | The administrator application does not have permission to manage the device. | 245| 201 | Permission verification failed. The application does not have the permission required to call the API. | 246| 202 | Permission verification failed. A non-system application calls a system API. | 247| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 248 249**示例:** 250 251```ts 252import { Want } from '@kit.AbilityKit'; 253let wantTemp: Want = { 254 bundleName: 'bundleName', 255 abilityName: 'abilityName', 256}; 257 258restrictions.setHdcDisabled(wantTemp, true, (err) => { 259 if (err) { 260 console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`); 261 return; 262 } 263 console.info('Succeeded in setting hdc disabled'); 264}) 265``` 266 267## restrictions.setHdcDisabled 268 269setHdcDisabled(admin: Want, disabled: boolean): Promise\<void> 270 271指定设备管理应用使设备禁用或启用HDC。使用Promise异步回调。 272 273**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 274 275**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 276 277**参数:** 278 279| 参数名 | 类型 | 必填 | 说明 | 280| ----- | ----------------------------------- | ---- | ------- | 281| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 282| disabled | boolean | 是 | true表示禁止使用HDC,false表示允许使用HDC。 | 283 284**返回值:** 285 286| 类型 | 说明 | 287| ----- | ----------------------------------- | 288| Promise\<void> | 无返回结果的Promise对象。当指定设备管理应用禁止或允许使用HDC失败时,抛出错误对象。 | 289 290**错误码**: 291 292以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 293 294| 错误码ID | 错误信息 | 295| ------- | ---------------------------------------------------------------------------- | 296| 9200001 | The application is not an administrator application of the device. | 297| 9200002 | The administrator application does not have permission to manage the device. | 298| 201 | Permission verification failed. The application does not have the permission required to call the API. | 299| 202 | Permission verification failed. A non-system application calls a system API. | 300| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 301 302**示例:** 303 304```ts 305import { Want } from '@kit.AbilityKit'; 306import { BusinessError } from '@kit.BasicServicesKit'; 307let wantTemp: Want = { 308 bundleName: 'bundleName', 309 abilityName: 'abilityName', 310}; 311 312restrictions.setHdcDisabled(wantTemp, true).then(() => { 313 console.info('Succeeded in setting hdc disabled'); 314}).catch((err: BusinessError) => { 315 console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`); 316}) 317``` 318 319## restrictions.isHdcDisabled 320 321isHdcDisabled(admin: Want, callback: AsyncCallback\<boolean>): void 322 323指定设备管理应用查询HDC是否被禁用。使用callback异步回调。 324 325**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 326 327**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 328 329**参数:** 330 331| 参数名 | 类型 | 必填 | 说明 | 332| ----- | ----------------------------------- | ---- | ------- | 333| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 334| callback | AsyncCallback\<boolean> | 是 | 回调函数,callbac方式返回HDC是否被禁用,true表示HDC被禁用,false表示HDC未被禁用。 | 335 336**错误码**: 337 338以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 339 340| 错误码ID | 错误信息 | 341| ------- | ---------------------------------------------------------------------------- | 342| 9200001 | The application is not an administrator application of the device. | 343| 9200002 | The administrator application does not have permission to manage the device. | 344| 201 | Permission verification failed. The application does not have the permission required to call the API. | 345| 202 | Permission verification failed. A non-system application calls a system API. | 346| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 347 348**示例:** 349 350```ts 351import { Want } from '@kit.AbilityKit'; 352let wantTemp: Want = { 353 bundleName: 'bundleName', 354 abilityName: 'abilityName', 355}; 356 357restrictions.isHdcDisabled(wantTemp, (err, result) => { 358 if (err) { 359 console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`); 360 return; 361 } 362 console.info(`Succeeded in querying is hdc disabled : ${result}`); 363}) 364``` 365 366## restrictions.isHdcDisabled 367 368isHdcDisabled(admin: Want): Promise\<boolean> 369 370指定设备管理应用查询HDC是否被禁用。使用Promise异步回调。 371 372**需要权限:** ohos.permission.ENTERPRISE_RESTRICT_POLICY 373 374**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 375 376**参数:** 377 378| 参数名 | 类型 | 必填 | 说明 | 379| ----- | ----------------------------------- | ---- | ------- | 380| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 381 382**返回值:** 383 384| 类型 | 说明 | 385| ----- | ----------------------------------- | 386| Promise\<boolean> | Promise对象。promise方式返回HDC是否被禁用,true表示HDC被禁用,false表示HDC未被禁用。 | 387 388**错误码**: 389 390以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 391 392| 错误码ID | 错误信息 | 393| ------- | ---------------------------------------------------------------------------- | 394| 9200001 | The application is not an administrator application of the device. | 395| 9200002 | The administrator application does not have permission to manage the device. | 396| 201 | Permission verification failed. The application does not have the permission required to call the API. | 397| 202 | Permission verification failed. A non-system application calls a system API. | 398| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 399 400**示例:** 401 402```ts 403import { Want } from '@kit.AbilityKit'; 404import { BusinessError } from '@kit.BasicServicesKit'; 405let wantTemp: Want = { 406 bundleName: 'bundleName', 407 abilityName: 'abilityName', 408}; 409 410restrictions.isHdcDisabled(wantTemp).then((result) => { 411 console.info(`Succeeded in querying is hdc disabled : ${result}`); 412}).catch((err: BusinessError) => { 413 console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`); 414}) 415``` 416 417## restrictions.isMicrophoneDisabled<sup>11+</sup> 418 419isMicrophoneDisabled(admin: Want): boolean 420 421指定设备管理应用查询麦克风是否被禁用。 422 423**需要权限:** ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS 424 425**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 426 427**参数:** 428 429| 参数名 | 类型 | 必填 | 说明 | 430| ----- | ----------------------------------- | ---- | ------- | 431| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 432 433**返回值:** 434 435| 类型 | 说明 | 436| ----- | ----------------------------------- | 437| boolean | boolean方式返回麦克风是否被禁用,true表示麦克风被禁用,false表示麦克风未被禁用。 | 438 439**错误码**: 440 441以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 442 443| 错误码ID | 错误信息 | 444| ------- | ---------------------------------------------------------------------------- | 445| 9200001 | The application is not an administrator application of the device. | 446| 9200002 | The administrator application does not have permission to manage the device. | 447| 201 | Permission verification failed. The application does not have the permission required to call the API. | 448| 202 | Permission verification failed. A non-system application calls a system API. | 449| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 450 451**示例:** 452 453```ts 454import { Want } from '@kit.AbilityKit'; 455let wantTemp: Want = { 456 bundleName: 'com.example.myapplication', 457 abilityName: 'EntryAbility', 458}; 459 460try { 461 let result = restrictions.isMicrophoneDisabled(wantTemp); 462 console.info(`Succeeded in querying is microphone disabled : ${result}`); 463} catch (err) { 464 console.error(`Failed to query is microphone disabled or not. Code is ${err.code}, message is ${err.message}`); 465} 466``` 467 468## restrictions.disableMicrophone<sup>11+</sup> 469 470disableMicrophone(admin: Want, disable: boolean): void 471 472指定设备管理应用使设备禁用或启用麦克风。 473 474**需要权限:** ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS 475 476**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 477 478**参数:** 479 480| 参数名 | 类型 | 必填 | 说明 | 481| ----- | ----------------------------------- | ---- | ------- | 482| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 483| disable | boolean | 是 | true表示禁止使用麦克风,false表示允许使用麦克风。 | 484 485**错误码**: 486 487以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 488 489| 错误码ID | 错误信息 | 490| ------- | ---------------------------------------------------------------------------- | 491| 9200001 | The application is not an administrator application of the device. | 492| 9200002 | The administrator application does not have permission to manage the device. | 493| 201 | Permission verification failed. The application does not have the permission required to call the API. | 494| 202 | Permission verification failed. A non-system application calls a system API. | 495| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 496 497**示例:** 498 499```ts 500import { Want } from '@kit.AbilityKit'; 501import { BusinessError } from '@kit.BasicServicesKit'; 502let wantTemp: Want = { 503 bundleName: 'com.example.myapplication', 504 abilityName: 'EntryAbility', 505}; 506 507try { 508 restrictions.disableMicrophone(wantTemp, true); 509 console.info('Succeeded in setting microphone disabled'); 510} catch (err) { 511 console.error(`Failed to disable microphone. Code is ${err.code}, message is ${err.message}`); 512} 513``` 514 515## restrictions.setFingerprintAuthDisabled<sup>11+</sup> 516 517setFingerprintAuthDisabled(admin: Want, disabled: boolean): void 518 519以同步方法指定设备管理应用禁用或启用指纹认证。 520 521**需要权限:** ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS 522 523**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 524 525**参数:** 526 527| 参数名 | 类型 | 必填 | 说明 | 528| ----- | ----------------------------------- | ---- | ------- | 529| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 530| disabled | boolean | 是 | true表示禁止指纹认证,false表示允许指纹认证。 | 531 532**错误码**: 533 534以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 535 536| 错误码ID | 错误信息 | 537| ------- | ---------------------------------------------------------------------------- | 538| 9200001 | The application is not an administrator application of the device. | 539| 9200002 | The administrator application does not have permission to manage the device. | 540| 201 | Permission verification failed. The application does not have the permission required to call the API. | 541| 202 | Permission verification failed. A non-system application calls a system API. | 542| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 543 544**示例:** 545 546```ts 547import { Want } from '@kit.AbilityKit'; 548 549let wantTemp: Want = { 550 bundleName: 'bundleName', 551 abilityName: 'abilityName', 552}; 553 554try { 555 restrictions.setFingerprintAuthDisabled(wantTemp, true); 556 console.info('Succeeded in disabling the fingerprint auth'); 557} catch (err) { 558 console.error(`Failed to disable fingerprint auth. Code: ${err.code}, message: ${err.message}`); 559}; 560 561``` 562 563## restrictions.isFingerprintAuthDisabled<sup>11+</sup> 564 565isFingerprintAuthDisabled(admin: Want): boolean 566 567以同步方法指定设备管理应用查询指纹认证是否被禁用。 568 569**需要权限:** ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS 570 571**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager 572 573**参数:** 574 575| 参数名 | 类型 | 必填 | 说明 | 576| ----- | ----------------------------------- | ---- | ------- | 577| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | 是 | 设备管理应用。 | 578 579**返回值:** 580 581| 类型 | 说明 | 582| ----- | ----------------------------------- | 583| boolean | 返回指纹认证是否被禁用,true表示指纹认证被禁用,false表示指纹认证未被禁用。 | 584 585**错误码**: 586 587以下错误码的详细介绍请参见[企业设备管理错误码](errorcode-enterpriseDeviceManager.md)和[通用错误码](../errorcode-universal.md)。 588 589| 错误码ID | 错误信息 | 590| ------- | ---------------------------------------------------------------------------- | 591| 9200001 | The application is not an administrator application of the device. | 592| 9200002 | The administrator application does not have permission to manage the device. | 593| 201 | Permission verification failed. The application does not have the permission required to call the API. | 594| 202 | Permission verification failed. A non-system application calls a system API. | 595| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 596 597**示例:** 598 599```ts 600import { Want } from '@kit.AbilityKit'; 601 602let wantTemp: Want = { 603 bundleName: 'bundleName', 604 abilityName: 'abilityName', 605}; 606 607try { 608 let result: boolean = restrictions.isFingerprintAuthDisabled(wantTemp); 609 console.info(`Succeeded in getting the state of fingerprint auth. result : ${result}`); 610} catch (err) { 611 console.error(`Failed to get the state of fingerprint auth. Code: ${err.code}, message: ${err.message}`); 612}; 613```