1/* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit MDMKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22import type Want from './@ohos.app.ability.Want'; 23 24/** 25 * This module provides the capability to manage the administrator of the enterprise devices. 26 * 27 * @namespace adminManager 28 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 29 * @since 9 30 */ 31declare namespace adminManager { 32 /** 33 * Provides the enterprise information. 34 * 35 * @typedef EnterpriseInfo 36 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 37 * @systemapi 38 * @since 9 39 */ 40 export interface EnterpriseInfo { 41 /** 42 * The name of enterprise. 43 * 44 * @type { string } 45 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 46 * @systemapi 47 * @since 9 48 */ 49 name: string; 50 51 /** 52 * The description of enterprise. 53 * 54 * @type { string } 55 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 56 * @systemapi 57 * @since 9 58 */ 59 description: string; 60 } 61 62 /** 63 * Enum for type of administrator. 64 * 65 * @enum { number } 66 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 67 * @systemapi 68 * @since 9 69 */ 70 export enum AdminType { 71 /** 72 * The value of normal administrator. 73 * 74 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 75 * @systemapi 76 * @since 9 77 */ 78 ADMIN_TYPE_NORMAL = 0x00, 79 80 /** 81 * The value of super administrator. 82 * 83 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 84 * @systemapi 85 * @since 9 86 */ 87 ADMIN_TYPE_SUPER = 0x01 88 } 89 90 /** 91 * Enum for managed event 92 * 93 * @enum { number } 94 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 95 * @since 12 96 */ 97 export enum ManagedEvent { 98 /** 99 * The event of bundle added. 100 * 101 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 102 * @since 12 103 */ 104 MANAGED_EVENT_BUNDLE_ADDED = 0, 105 106 /** 107 * The event of bundle removed. 108 * 109 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 110 * @since 12 111 */ 112 MANAGED_EVENT_BUNDLE_REMOVED = 1, 113 114 /** 115 * The event of app start. 116 * 117 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 118 * @since 12 119 */ 120 MANAGED_EVENT_APP_START = 2, 121 122 /** 123 * The event of app stop. 124 * 125 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 126 * @since 12 127 */ 128 MANAGED_EVENT_APP_STOP = 3, 129 130 /** 131 * The event of system update. 132 * 133 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 134 * @since 12 135 */ 136 MANAGED_EVENT_SYSTEM_UPDATE = 4, 137 } 138 139 /** 140 * Enables the given ability as a administrator of the device. 141 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 142 * 143 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 144 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 145 * The admin must have the corresponding permission. 146 * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. 147 * @param { AdminType } type - type indicates the type of administrator to set. 148 * @param { AsyncCallback<void> } callback - the callback of enableAdmin. 149 * @throws { BusinessError } 9200003 - The administrator ability component is invalid. 150 * @throws { BusinessError } 9200004 - Failed to activate the administrator application of the device. 151 * @throws { BusinessError } 9200007 - The system ability works abnormally. 152 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 153 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 154 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 155 * 2. Incorrect parameter types; 3. Parameter verification failed. 156 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 157 * @systemapi 158 * @stagemodelonly 159 * @since 9 160 */ 161 function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback<void>): void; 162 163 /** 164 * Enables the given ability as a administrator of the device. 165 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 166 * 167 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 168 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 169 * The admin must have the corresponding permission. 170 * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. 171 * @param { AdminType } type - type indicates the type of administrator to set. 172 * @param { number } userId - userId indicates the user ID. 173 * @param { AsyncCallback<void> } callback - the callback of enableAdmin. 174 * @throws { BusinessError } 9200003 - The administrator ability component is invalid. 175 * @throws { BusinessError } 9200004 - Failed to activate the administrator application of the device. 176 * @throws { BusinessError } 9200007 - The system ability works abnormally. 177 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 178 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 180 * 2. Incorrect parameter types; 3. Parameter verification failed. 181 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 182 * @systemapi 183 * @stagemodelonly 184 * @since 9 185 */ 186 function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback<void>): void; 187 188 /** 189 * Enables the given ability as a administrator of the device. 190 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 191 * 192 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 193 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 194 * The admin must have the corresponding permission. 195 * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. 196 * @param { AdminType } type - type indicates the type of administrator to set. 197 * @param { number } [userId] - userId indicates the user ID or do not pass user ID. 198 * @returns { Promise<void> } the promise returned by the enableAdmin. 199 * @throws { BusinessError } 9200003 - The administrator ability component is invalid. 200 * @throws { BusinessError } 9200004 - Failed to activate the administrator application of the device. 201 * @throws { BusinessError } 9200007 - The system ability works abnormally. 202 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 203 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 204 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 205 * 2. Incorrect parameter types; 3. Parameter verification failed. 206 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 207 * @systemapi 208 * @stagemodelonly 209 * @since 9 210 */ 211 function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise<void>; 212 213 /** 214 * Disables a current normal administrator ability. 215 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 216 * 217 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 218 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 219 * The admin must have the corresponding permission. 220 * @param { AsyncCallback<void> } callback - the callback of disableAdmin. 221 * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. 222 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 223 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 224 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 225 * 2. Incorrect parameter types; 3. Parameter verification failed. 226 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 227 * @systemapi 228 * @stagemodelonly 229 * @since 9 230 */ 231 function disableAdmin(admin: Want, callback: AsyncCallback<void>): void; 232 233 /** 234 * Disables a current normal administrator ability. 235 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 236 * 237 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 238 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 239 * The admin must have the corresponding permission. 240 * @param { number } userId - userId indicates the user ID. 241 * @param { AsyncCallback<void> } callback - the callback of disableAdmin. 242 * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. 243 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 244 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 245 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 246 * 2. Incorrect parameter types; 3. Parameter verification failed. 247 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 248 * @systemapi 249 * @stagemodelonly 250 * @since 9 251 */ 252 function disableAdmin(admin: Want, userId: number, callback: AsyncCallback<void>): void; 253 254 /** 255 * Disables a current administrator ability. 256 * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. 257 * 258 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 259 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 260 * The admin must have the corresponding permission. 261 * @param { number } [userId] - userId indicates the user ID or do not pass user ID. 262 * @returns { Promise<void> } the promise returned by the disableAdmin. 263 * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. 264 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 265 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 266 * 2. Incorrect parameter types; 3. Parameter verification failed. 267 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 268 * @stagemodelonly 269 * @since 12 270 */ 271 function disableAdmin(admin: Want, userId?: number): Promise<void>; 272 273 /** 274 * Disables a current super administrator ability. 275 * Only the administrator app or apps with the shell uid can call this method. 276 * 277 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 278 * @param { String } bundleName - bundleName indicates the administrator bundle information. 279 * @param { AsyncCallback<void> } callback - the callback of disableSuperAdmin. 280 * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. 281 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 282 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 283 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 284 * 2. Incorrect parameter types; 3. Parameter verification failed. 285 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 286 * @systemapi 287 * @stagemodelonly 288 * @since 9 289 */ 290 function disableSuperAdmin(bundleName: String, callback: AsyncCallback<void>): void; 291 292 /** 293 * Disables a current super administrator ability. 294 * Only the administrator app or apps with the shell uid can call this method. 295 * 296 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 297 * @param { String } bundleName - bundleName indicates the administrator bundle information. 298 * @returns { Promise<void> } the promise returned by the disableSuperAdmin. 299 * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. 300 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 301 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 303 * 2. Incorrect parameter types; 3. Parameter verification failed. 304 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 305 * @systemapi 306 * @stagemodelonly 307 * @since 9 308 */ 309 function disableSuperAdmin(bundleName: String): Promise<void>; 310 311 /** 312 * Get whether the ability is enabled as device administrator. 313 * 314 * @param { Want } admin - admin indicates the administrator ability information. 315 * @param { AsyncCallback<boolean> } callback - callback contained true if the administrator is enabled. 316 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 317 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 318 * 2. Incorrect parameter types. 319 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 320 * @systemapi 321 * @stagemodelonly 322 * @since 9 323 */ 324 function isAdminEnabled(admin: Want, callback: AsyncCallback<boolean>): void; 325 326 /** 327 * Get whether the ability is enabled as device administrator. 328 * 329 * @param { Want } admin - admin indicates the administrator ability information. 330 * @param { number } userId - userId indicates the user ID. 331 * @param { AsyncCallback<boolean> } callback - callback contained true if the administrator is enabled. 332 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 333 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 334 * 2. Incorrect parameter types. 335 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 336 * @systemapi 337 * @stagemodelonly 338 * @since 9 339 */ 340 function isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback<boolean>): void; 341 342 /** 343 * Get whether the ability is enabled as device administrator. 344 * 345 * @param { Want } admin - admin indicates the administrator ability information. 346 * @param { number } [userId] - userId indicates the user ID or do not pass user ID. 347 * @returns { Promise<boolean> } promise contained true if the administrator is enabled. 348 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 349 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 350 * 2. Incorrect parameter types. 351 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 352 * @systemapi 353 * @stagemodelonly 354 * @since 9 355 */ 356 function isAdminEnabled(admin: Want, userId?: number): Promise<boolean>; 357 358 /** 359 * Get information of the administrator's enterprise. 360 * 361 * @param { Want } admin - admin indicates the administrator ability information. 362 * @param { AsyncCallback<EnterpriseInfo> } callback - callback contained the enterprise info of administrator. 363 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 364 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 365 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 366 * 2. Incorrect parameter types; 3. Parameter verification failed. 367 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 368 * @systemapi 369 * @stagemodelonly 370 * @since 9 371 */ 372 function getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): void; 373 374 /** 375 * Get information of the administrator's enterprise. 376 * 377 * @param { Want } admin - admin indicates the administrator ability information. 378 * @returns { Promise<EnterpriseInfo> } promise contained the enterprise info of administrator. 379 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 380 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 381 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 382 * 2. Incorrect parameter types; 3. Parameter verification failed. 383 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 384 * @systemapi 385 * @stagemodelonly 386 * @since 9 387 */ 388 function getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo>; 389 390 /** 391 * Set the information of the administrator's enterprise. 392 * Only the administrator app can call this method. 393 * 394 * @permission ohos.permission.SET_ENTERPRISE_INFO 395 * @param { Want } admin - admin indicates the administrator ability information. 396 * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. 397 * @param { AsyncCallback<void> } callback - the callback of setEnterpriseInfo. 398 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 399 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 400 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 401 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 402 * 2. Incorrect parameter types; 3. Parameter verification failed. 403 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 404 * @systemapi 405 * @stagemodelonly 406 * @since 9 407 */ 408 function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback<void>): void; 409 410 /** 411 * Set the information of the administrator's enterprise. 412 * Only the administrator app can call this method. 413 * 414 * @permission ohos.permission.SET_ENTERPRISE_INFO 415 * @param { Want } admin - admin indicates the administrator ability information. 416 * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. 417 * @returns { Promise<void> } the promise returned by the setEnterpriseInfo. 418 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 419 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 420 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 421 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 422 * 2. Incorrect parameter types; 3. Parameter verification failed. 423 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 424 * @systemapi 425 * @stagemodelonly 426 * @since 9 427 */ 428 function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<void>; 429 430 /** 431 * Get whether the ability is enabled as super device administrator. 432 * 433 * @param { String } bundleName - bundleName indicates the administrator bundle information. 434 * @param { AsyncCallback<boolean> } callback - callback contained true if the administrator is super administrator. 435 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 437 * 2. Incorrect parameter types. 438 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 439 * @systemapi 440 * @stagemodelonly 441 * @since 9 442 */ 443 function isSuperAdmin(bundleName: String, callback: AsyncCallback<boolean>): void; 444 445 /** 446 * Get whether the ability is enabled as super device administrator. 447 * 448 * @param { String } bundleName - bundleName indicates the administrator bundle information. 449 * @returns { Promise<boolean> } promise contained true if the administrator is super administrator. 450 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 451 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 452 * 2. Incorrect parameter types. 453 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 454 * @systemapi 455 * @stagemodelonly 456 * @since 9 457 */ 458 function isSuperAdmin(bundleName: String): Promise<boolean>; 459 460 /** 461 * Subscribes the managed event of admin. 462 * 463 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 464 * @param { Want } admin - admin indicates the administrator ability information. 465 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 466 * @param { AsyncCallback<void> } callback - the callback of subscribeManagedEvent. 467 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 468 * @throws { BusinessError } 9200008 - The specified system event is invalid. 469 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 470 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 472 * 2. Incorrect parameter types; 3. Parameter verification failed. 473 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 474 * @systemapi 475 * @stagemodelonly 476 * @since 9 477 */ 478 function subscribeManagedEvent(admin: Want, managedEvents: Array<ManagedEvent>, callback: AsyncCallback<void>): void; 479 480 /** 481 * Subscribes the managed event of admin. 482 * 483 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 484 * @param { Want } admin - admin indicates the administrator ability information. 485 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 486 * @returns { Promise<void> } the promise returned by the subscribeManagedEvent. 487 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 488 * @throws { BusinessError } 9200008 - The specified system event is invalid. 489 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 490 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 491 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 492 * 2. Incorrect parameter types; 3. Parameter verification failed. 493 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 494 * @systemapi 495 * @stagemodelonly 496 * @since 9 497 */ 498 function subscribeManagedEvent(admin: Want, managedEvents: Array<ManagedEvent>): Promise<void>; 499 500 /** 501 * Unsubscribes the managed event of admin. 502 * 503 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 504 * @param { Want } admin - admin indicates the administrator ability information. 505 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 506 * @param { AsyncCallback<void> } callback - the callback of unsubscribeManagedEvent. 507 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 508 * @throws { BusinessError } 9200008 - The specified system event is invalid. 509 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 510 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 511 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 512 * 2. Incorrect parameter types; 3. Parameter verification failed. 513 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 514 * @systemapi 515 * @stagemodelonly 516 * @since 9 517 */ 518 function unsubscribeManagedEvent(admin: Want, managedEvents: Array<ManagedEvent>, callback: AsyncCallback<void>): void; 519 520 /** 521 * Unsubscribes the managed event of admin. 522 * 523 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 524 * @param { Want } admin - admin indicates the administrator ability information. 525 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 526 * @returns { Promise<void> } the promise returned by the unsubscribeManagedEvent. 527 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 528 * @throws { BusinessError } 9200008 - The specified system event is invalid. 529 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 530 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 531 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 532 * 2. Incorrect parameter types; 3. Parameter verification failed. 533 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 534 * @systemapi 535 * @stagemodelonly 536 * @since 9 537 */ 538 function unsubscribeManagedEvent(admin: Want, managedEvents: Array<ManagedEvent>): Promise<void>; 539 540 /** 541 * Administrator authorize permissions to other applications. 542 * 543 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 544 * @param { Want } admin - admin indicates the administrator ability information. 545 * @param { string } bundleName - bundleName indicates the administrator bundle information. 546 * @param { AsyncCallback<void> } callback - the callback of authorizeAdmin. 547 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 548 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 549 * @throws { BusinessError } 9200009 - Failed to grant the permission to the application. 550 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 551 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 553 * 2. Incorrect parameter types; 3. Parameter verification failed. 554 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 555 * @systemapi 556 * @stagemodelonly 557 * @since 10 558 */ 559 function authorizeAdmin(admin: Want, bundleName: string, callback: AsyncCallback<void>): void; 560 561 /** 562 * Administrator authorize permissions to other applications. 563 * 564 * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN 565 * @param { Want } admin - admin indicates the administrator ability information. 566 * @param { string } bundleName - bundleName indicates the administrator bundle information. 567 * @returns { Promise<void> } the promise returned by the authorizeAdmin. 568 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 569 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 570 * @throws { BusinessError } 9200009 - Failed to grant the permission to the application. 571 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 572 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 573 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 574 * 2. Incorrect parameter types; 3. Parameter verification failed. 575 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 576 * @systemapi 577 * @stagemodelonly 578 * @since 10 579 */ 580 function authorizeAdmin(admin: Want, bundleName: string): Promise<void>; 581 582 /** 583 * Get the super administrator of device. 584 * 585 * @returns { Promise<Want> } promise contained the want indicates the super administrator of the device. 586 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 587 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 588 * @systemapi 589 * @stagemodelonly 590 * @since 12 591 */ 592 function getSuperAdmin(): Promise<Want>; 593 594 /** 595 * Subscribes the managed event of admin. 596 * 597 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 598 * @param { Want } admin - admin indicates the administrator ability information. 599 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 600 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 601 * @throws { BusinessError } 9200008 - The specified system event is invalid. 602 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 603 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 604 * 2. Incorrect parameter types; 3. Parameter verification failed. 605 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 606 * @stagemodelonly 607 * @since 12 608 */ 609 function subscribeManagedEventSync(admin: Want, managedEvents: Array<ManagedEvent>): void; 610 611 /** 612 * Unsubscribes the managed event of admin. 613 * 614 * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT 615 * @param { Want } admin - admin indicates the administrator ability information. 616 * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. 617 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 618 * @throws { BusinessError } 9200008 - The specified system event is invalid. 619 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 620 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 621 * 2. Incorrect parameter types; 3. Parameter verification failed. 622 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 623 * @stagemodelonly 624 * @since 12 625 */ 626 function unsubscribeManagedEventSync(admin: Want, managedEvents: Array<ManagedEvent>): void; 627 628 /** 629 * Administrator delegates access to policies to another application. 630 * 631 * @permission ohos.permission.ENTERPRISE_MANAGE_DELEGATED_POLICY 632 * @param { Want } admin - admin indicates the administrator ability information. 633 * @param { string } bundleName - bundleName indicates the bundle name of the delegated application. 634 * @param { Array<string> } policies - policies indicates the policies accessible to the delegated application. 635 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 636 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 637 * @throws { BusinessError } 9200009 - Failed to grant the permission to the application. 638 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 639 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 640 * 2. Incorrect parameter types; 3. Parameter verification failed. 641 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 642 * @stagemodelonly 643 * @since 14 644 */ 645 function setDelegatedPolicies(admin: Want, bundleName: string, policies: Array<string>): void; 646 647 /** 648 * Administrator gets the list of delegation policies for the application. 649 * 650 * @permission ohos.permission.ENTERPRISE_MANAGE_DELEGATED_POLICY 651 * @param { Want } admin - admin indicates the administrator ability information. 652 * @param { string } bundleName - bundleName indicates the bundle name of the delegated application. 653 * @returns { Array<string> } the policies accessible to the delegated application. 654 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 655 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 656 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 657 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 658 * 2. Incorrect parameter types; 3. Parameter verification failed. 659 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 660 * @stagemodelonly 661 * @since 14 662 */ 663 function getDelegatedPolicies(admin: Want, bundleName: string): Array<string>; 664 665 /** 666 * Administrator gets the delegated applications which access to the policy. 667 * 668 * @permission ohos.permission.ENTERPRISE_MANAGE_DELEGATED_POLICY 669 * @param { Want } admin - admin indicates the administrator ability information. 670 * @param { string } policy - policy indicates the policy that delegated to other applications. 671 * @returns { Array<string> } the bundle names of the delegated application that access to the policy. 672 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 673 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 674 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 675 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 676 * 2. Incorrect parameter types; 3. Parameter verification failed. 677 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 678 * @stagemodelonly 679 * @since 14 680 */ 681 function getDelegatedBundleNames(admin: Want, policy: string): Array<string>; 682} 683 684export default adminManager; 685