1/* 2 * Copyright (c) 2022-2023 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 16import { AsyncCallback } from './basic'; 17import { ApplicationInfo as _ApplicationInfo } from './bundleManager/ApplicationInfo'; 18import { Metadata as _Metadata } from './bundleManager/Metadata'; 19import { PermissionDef as _PermissionDef } from './bundleManager/PermissionDef'; 20import { ElementName as _ElementName } from './bundleManager/ElementName'; 21import Want from './@ohos.app.ability.Want'; 22import * as _AbilityInfo from './bundleManager/AbilityInfo'; 23import * as _BundleInfo from './bundleManager/BundleInfo'; 24import * as _HapModuleInfo from './bundleManager/HapModuleInfo'; 25import * as _ExtensionAbilityInfo from './bundleManager/ExtensionAbilityInfo'; 26 27/** 28 * This module is used to obtain package information of various applications installed on the current device. 29 * @namespace bundleManager 30 * @syscap SystemCapability.BundleManager.BundleFramework.Core 31 * @since 9 32 */ 33 declare namespace bundleManager { 34 /** 35 * Used to query the enumeration value of bundleInfo. Multiple values can be passed in the form. 36 * @enum { number } 37 * @syscap SystemCapability.BundleManager.BundleFramework.Core 38 * @since 9 39 */ 40 enum BundleFlag { 41 /** 42 * Used to obtain the default bundleInfo. The obtained bundleInfo does not contain information of 43 * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. 44 * @syscap SystemCapability.BundleManager.BundleFramework.Core 45 * @since 9 46 */ 47 GET_BUNDLE_INFO_DEFAULT = 0x00000000, 48 /** 49 * Used to obtain the bundleInfo containing applicationInfo. The obtained bundleInfo does not 50 * contain the information of signatureInfo, hapModuleInfo, ability, extensionAbility and permission. 51 * @syscap SystemCapability.BundleManager.BundleFramework.Core 52 * @since 9 53 */ 54 GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, 55 /** 56 * Used to obtain the bundleInfo containing hapModuleInfo. The obtained bundleInfo does not 57 * contain the information of signatureInfo, applicationInfo, ability, extensionAbility and permission. 58 * @syscap SystemCapability.BundleManager.BundleFramework.Core 59 * @since 9 60 */ 61 GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, 62 /** 63 * Used to obtain the bundleInfo containing ability. The obtained bundleInfo does not 64 * contain the information of signatureInfo, applicationInfo, extensionAbility and permission. 65 * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. 66 * @syscap SystemCapability.BundleManager.BundleFramework.Core 67 * @since 9 68 */ 69 GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, 70 /** 71 * Used to obtain the bundleInfo containing extensionAbility. The obtained bundleInfo does not 72 * contain the information of signatureInfo, applicationInfo, ability and permission. 73 * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. 74 * @syscap SystemCapability.BundleManager.BundleFramework.Core 75 * @since 9 76 */ 77 GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, 78 /** 79 * Used to obtain the bundleInfo containing permission. The obtained bundleInfo does not 80 * contain the information of signatureInfo, applicationInfo, hapModuleInfo, extensionAbility and ability. 81 * @syscap SystemCapability.BundleManager.BundleFramework.Core 82 * @since 9 83 */ 84 GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, 85 /** 86 * Used to obtain the metadata contained in applicationInfo, moduleInfo and abilityInfo. 87 * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_APPLICATION, 88 * GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITIES, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. 89 * @syscap SystemCapability.BundleManager.BundleFramework.Core 90 * @since 9 91 */ 92 GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, 93 /** 94 * Used to obtain the default bundleInfo containing disabled application and ability. 95 * The obtained bundleInfo does not contain information of signatureInfo, applicationInfo, 96 * hapModuleInfo, ability, extensionAbility and permission. 97 * @syscap SystemCapability.BundleManager.BundleFramework.Core 98 * @since 9 99 */ 100 GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, 101 /** 102 * Used to obtain the bundleInfo containing signatureInfo. The obtained bundleInfo does not 103 * contain the information of applicationInfo, hapModuleInfo, extensionAbility, ability and permission. 104 * @syscap SystemCapability.BundleManager.BundleFramework.Core 105 * @since 9 106 */ 107 GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, 108 } 109 110 /** 111 * Used to query the enumeration value of applicationInfo. Multiple values can be passed in the form. 112 * @enum { number } 113 * @syscap SystemCapability.BundleManager.BundleFramework.Core 114 * @systemapi 115 * @since 9 116 */ 117 enum ApplicationFlag { 118 /** 119 * Used to obtain the default applicationInfo. The obtained applicationInfo does not contain the information of 120 * permission and metadata. 121 * @syscap SystemCapability.BundleManager.BundleFramework.Core 122 * @since 9 123 */ 124 GET_APPLICATION_INFO_DEFAULT = 0x00000000, 125 /** 126 * Used to obtain the applicationInfo containing permission. 127 * @syscap SystemCapability.BundleManager.BundleFramework.Core 128 * @since 9 129 */ 130 GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000001, 131 /** 132 * Used to obtain the applicationInfo containing metadata. 133 * @syscap SystemCapability.BundleManager.BundleFramework.Core 134 * @since 9 135 */ 136 GET_APPLICATION_INFO_WITH_METADATA = 0x00000002, 137 /** 138 * Used to obtain the applicationInfo containing disabled application. 139 * @syscap SystemCapability.BundleManager.BundleFramework.Core 140 * @since 9 141 */ 142 GET_APPLICATION_INFO_WITH_DISABLE = 0x00000004, 143 } 144 145/** 146 * Used to query the enumeration value of abilityInfo. Multiple values can be passed in the form. 147 * @enum { number } 148 * @syscap SystemCapability.BundleManager.BundleFramework.Core 149 * @systemapi 150 * @since 9 151 */ 152 enum AbilityFlag { 153 /** 154 * Used to obtain the default abilityInfo. The obtained abilityInfo does not contain the information of 155 * permission, metadata and disabled abilityInfo. 156 * @syscap SystemCapability.BundleManager.BundleFramework.Core 157 * @since 9 158 */ 159 GET_ABILITY_INFO_DEFAULT = 0x00000000, 160 /** 161 * Used to obtain the abilityInfo containing permission. 162 * @syscap SystemCapability.BundleManager.BundleFramework.Core 163 * @since 9 164 */ 165 GET_ABILITY_INFO_WITH_PERMISSION = 0x00000001, 166 /** 167 * Used to obtain the abilityInfo containing applicationInfo. 168 * @syscap SystemCapability.BundleManager.BundleFramework.Core 169 * @since 9 170 */ 171 GET_ABILITY_INFO_WITH_APPLICATION = 0x00000002, 172 /** 173 * Used to obtain the abilityInfo containing metadata. 174 * @syscap SystemCapability.BundleManager.BundleFramework.Core 175 * @since 9 176 */ 177 GET_ABILITY_INFO_WITH_METADATA = 0x00000004, 178 /** 179 * Used to obtain the abilityInfo containing disabled abilityInfo. 180 * @syscap SystemCapability.BundleManager.BundleFramework.Core 181 * @since 9 182 */ 183 GET_ABILITY_INFO_WITH_DISABLE = 0x00000008, 184 /** 185 * Used to obtain the abilityInfo only for system app. 186 * @syscap SystemCapability.BundleManager.BundleFramework.Core 187 * @since 9 188 */ 189 GET_ABILITY_INFO_ONLY_SYSTEM_APP = 0x00000010, 190 } 191 192 /** 193 * Used to query the enumeration value of ExtensionAbilityInfo. Multiple values can be passed in the form. 194 * @enum { number } 195 * @syscap SystemCapability.BundleManager.BundleFramework.Core 196 * @systemapi 197 * @since 9 198 */ 199 enum ExtensionAbilityFlag { 200 /** 201 * Used to obtain the default extensionAbilityInfo. The obtained extensionAbilityInfo does not contain the information of 202 * permission, metadata and disabled abilityInfo. 203 * @syscap SystemCapability.BundleManager.BundleFramework.Core 204 * @since 9 205 */ 206 GET_EXTENSION_ABILITY_INFO_DEFAULT = 0x00000000, 207 /** 208 * Used to obtain the extensionAbilityInfo containing permission. 209 * @syscap SystemCapability.BundleManager.BundleFramework.Core 210 * @since 9 211 */ 212 GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION = 0x00000001, 213 /** 214 * Used to obtain the extensionAbilityInfo containing applicationInfo. 215 * @syscap SystemCapability.BundleManager.BundleFramework.Core 216 * @since 9 217 */ 218 GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION = 0x00000002, 219 /** 220 * Used to obtain the extensionAbilityInfo containing metadata. 221 * @syscap SystemCapability.BundleManager.BundleFramework.Core 222 * @since 9 223 */ 224 GET_EXTENSION_ABILITY_INFO_WITH_METADATA = 0x00000004, 225 } 226 227 /** 228 * This enumeration value is used to identify various types of extension ability 229 * @enum {number} 230 * @syscap SystemCapability.BundleManager.BundleFramework.Core 231 * @since 9 232 */ 233 export enum ExtensionAbilityType { 234 /** 235 * Indicates extension info with type of form 236 * @syscap SystemCapability.BundleManager.BundleFramework.Core 237 * @since 9 238 */ 239 FORM = 0, 240 241 /** 242 * Indicates extension info with type of work schedule 243 * @syscap SystemCapability.BundleManager.BundleFramework.Core 244 * @since 9 245 */ 246 WORK_SCHEDULER = 1, 247 248 /** 249 * Indicates extension info with type of input method 250 * @syscap SystemCapability.BundleManager.BundleFramework.Core 251 * @since 9 252 */ 253 INPUT_METHOD = 2, 254 255 /** 256 * Indicates extension info with type of service 257 * @syscap SystemCapability.BundleManager.BundleFramework.Core 258 * @since 9 259 */ 260 SERVICE = 3, 261 262 /** 263 * Indicates extension info with type of accessibility 264 * @syscap SystemCapability.BundleManager.BundleFramework.Core 265 * @since 9 266 */ 267 ACCESSIBILITY = 4, 268 269 /** 270 * Indicates extension info with type of dataShare 271 * @syscap SystemCapability.BundleManager.BundleFramework.Core 272 * @since 9 273 */ 274 DATA_SHARE = 5, 275 276 /** 277 * Indicates extension info with type of filesShare 278 * @syscap SystemCapability.BundleManager.BundleFramework.Core 279 * @since 9 280 */ 281 FILE_SHARE = 6, 282 283 /** 284 * Indicates extension info with type of staticSubscriber 285 * @syscap SystemCapability.BundleManager.BundleFramework.Core 286 * @since 9 287 */ 288 STATIC_SUBSCRIBER = 7, 289 290 /** 291 * Indicates extension info with type of wallpaper 292 * @syscap SystemCapability.BundleManager.BundleFramework.Core 293 * @since 9 294 */ 295 WALLPAPER = 8, 296 297 /** 298 * Indicates extension info with type of backup 299 * @syscap SystemCapability.BundleManager.BundleFramework.Core 300 * @since 9 301 */ 302 BACKUP = 9, 303 304 /** 305 * Indicates extension info with type of window 306 * @syscap SystemCapability.BundleManager.BundleFramework.Core 307 * @since 9 308 */ 309 WINDOW = 10, 310 311 /** 312 * Indicates extension info with type of enterprise admin 313 * @syscap SystemCapability.BundleManager.BundleFramework.Core 314 * @since 9 315 */ 316 ENTERPRISE_ADMIN = 11, 317 318 /** 319 * Indicates extension info with type of thumbnail 320 * @syscap SystemCapability.BundleManager.BundleFramework.Core 321 * @since 9 322 */ 323 THUMBNAIL = 13, 324 325 /** 326 * Indicates extension info with type of preview 327 * @syscap SystemCapability.BundleManager.BundleFramework.Core 328 * @since 9 329 */ 330 PREVIEW = 14, 331 332 /** 333 * Indicates extension info with type of unspecified 334 * @syscap SystemCapability.BundleManager.BundleFramework.Core 335 * @since 9 336 */ 337 UNSPECIFIED = 255, 338 } 339 340 /** 341 * PermissionGrantState 342 * @enum {number} 343 * @syscap SystemCapability.BundleManager.BundleFramework.Core 344 * @since 9 345 */ 346 export enum PermissionGrantState { 347 /** 348 * PERMISSION_DENIED 349 * @syscap SystemCapability.BundleManager.BundleFramework.Core 350 * @since 9 351 */ 352 PERMISSION_DENIED = -1, 353 354 /** 355 * PERMISSION_GRANTED 356 * @syscap SystemCapability.BundleManager.BundleFramework.Core 357 * @since 9 358 */ 359 PERMISSION_GRANTED = 0, 360 } 361 362 /** 363 * Support window mode 364 * @enum {number} 365 * @syscap SystemCapability.BundleManager.BundleFramework.Core 366 * @since 9 367 */ 368 export enum SupportWindowMode { 369 /** 370 * Indicates supported window mode of full screen mode 371 * @syscap SystemCapability.BundleManager.BundleFramework.Core 372 * @since 9 373 */ 374 FULL_SCREEN = 0, 375 /** 376 * Indicates supported window mode of split mode 377 * @syscap SystemCapability.BundleManager.BundleFramework.Core 378 * @since 9 379 */ 380 SPLIT = 1, 381 /** 382 * Indicates supported window mode of floating mode 383 * @syscap SystemCapability.BundleManager.BundleFramework.Core 384 * @since 9 385 */ 386 FLOATING = 2, 387 } 388 389 /** 390 * Launch type 391 * @enum {number} 392 * @syscap SystemCapability.BundleManager.BundleFramework.Core 393 * @since 9 394 */ 395 export enum LaunchType { 396 /** 397 * Indicates that the ability has only one instance 398 * @syscap SystemCapability.BundleManager.BundleFramework.Core 399 * @since 9 400 */ 401 SINGLETON = 0, 402 403 /** 404 * Indicates that the ability can have multiple instances 405 * @syscap SystemCapability.BundleManager.BundleFramework.Core 406 * @since 9 407 */ 408 MULTITON = 1, 409 410 /** 411 * Indicates that the ability can have specified instances 412 * @syscap SystemCapability.BundleManager.BundleFramework.Core 413 * @since 9 414 */ 415 SPECIFIED = 2, 416 } 417 418 /** 419 * Indicates ability type 420 * @enum {number} 421 * @syscap SystemCapability.BundleManager.BundleFramework.Core 422 * @FAModelOnly 423 * @since 9 424 */ 425 export enum AbilityType { 426 /** 427 * Indicates that the ability has a UI 428 * @syscap SystemCapability.BundleManager.BundleFramework.Core 429 * @since 9 430 */ 431 PAGE = 1, 432 433 /** 434 * Indicates that the ability does not have a UI 435 * @syscap SystemCapability.BundleManager.BundleFramework.Core 436 * @since 9 437 */ 438 SERVICE = 2, 439 440 /** 441 * Indicates that the ability is used to provide data access services 442 * @syscap SystemCapability.BundleManager.BundleFramework.Core 443 * @since 9 444 */ 445 DATA = 3, 446 } 447 448 /** 449 * Display orientation 450 * @enum {number} 451 * @syscap SystemCapability.BundleManager.BundleFramework.Core 452 * @since 9 453 */ 454 export enum DisplayOrientation { 455 /** 456 * Indicates that the system automatically determines the display orientation 457 * @syscap SystemCapability.BundleManager.BundleFramework.Core 458 * @since 9 459 */ 460 UNSPECIFIED, 461 462 /** 463 * Indicates the landscape orientation 464 * @syscap SystemCapability.BundleManager.BundleFramework.Core 465 * @since 9 466 */ 467 LANDSCAPE, 468 469 /** 470 * Indicates the portrait orientation 471 * @syscap SystemCapability.BundleManager.BundleFramework.Core 472 * @since 9 473 */ 474 PORTRAIT, 475 476 /** 477 * Indicates the page ability orientation is the same as that of the nearest ability in the stack 478 * @syscap SystemCapability.BundleManager.BundleFramework.Core 479 * @since 9 480 */ 481 FOLLOW_RECENT, 482 483 /** 484 * Indicates the inverted landscape orientation 485 * @syscap SystemCapability.BundleManager.BundleFramework.Core 486 * @since 9 487 */ 488 LANDSCAPE_INVERTED, 489 490 /** 491 * Indicates the inverted portrait orientation 492 * @syscap SystemCapability.BundleManager.BundleFramework.Core 493 * @since 9 494 */ 495 PORTRAIT_INVERTED, 496 497 /** 498 * Indicates the orientation can be auto-rotated 499 * @syscap SystemCapability.BundleManager.BundleFramework.Core 500 * @since 9 501 */ 502 AUTO_ROTATION, 503 504 /** 505 * Indicates the landscape orientation rotated with sensor 506 * @syscap SystemCapability.BundleManager.BundleFramework.Core 507 * @since 9 508 */ 509 AUTO_ROTATION_LANDSCAPE, 510 511 /** 512 * Indicates the portrait orientation rotated with sensor 513 * @syscap SystemCapability.BundleManager.BundleFramework.Core 514 * @since 9 515 */ 516 AUTO_ROTATION_PORTRAIT, 517 518 /** 519 * Indicates the sensor restricted mode 520 * @syscap SystemCapability.BundleManager.BundleFramework.Core 521 * @since 9 522 */ 523 AUTO_ROTATION_RESTRICTED, 524 525 /** 526 * Indicates the sensor landscape restricted mode 527 * @syscap SystemCapability.BundleManager.BundleFramework.Core 528 * @since 9 529 */ 530 AUTO_ROTATION_LANDSCAPE_RESTRICTED, 531 532 /** 533 * Indicates the sensor portrait restricted mode 534 * @syscap SystemCapability.BundleManager.BundleFramework.Core 535 * @since 9 536 */ 537 AUTO_ROTATION_PORTRAIT_RESTRICTED, 538 539 /** 540 * Indicates the locked orientation mode 541 * @syscap SystemCapability.BundleManager.BundleFramework.Core 542 * @since 9 543 */ 544 LOCKED, 545 } 546 547 /** 548 * Indicates module type 549 * @enum {number} 550 * @syscap SystemCapability.BundleManager.BundleFramework.Core 551 * @since 9 552 */ 553 export enum ModuleType { 554 /** 555 * Indicates entry type 556 * @syscap SystemCapability.BundleManager.BundleFramework.Core 557 * @since 9 558 */ 559 ENTRY = 1, 560 /** 561 * Indicates feature type 562 * @syscap SystemCapability.BundleManager.BundleFramework.Core 563 * @since 9 564 */ 565 FEATURE = 2, 566 /** 567 * Indicates shared type 568 * @syscap SystemCapability.BundleManager.BundleFramework.Core 569 * @since 9 570 */ 571 SHARED = 3, 572 } 573 574 /** 575 * Indicates bundle type 576 * @enum {number} 577 * @syscap SystemCapability.BundleManager.BundleFramework.Core 578 * @since 9 579 */ 580 export enum BundleType { 581 /** 582 * Indicates app 583 * @syscap SystemCapability.BundleManager.BundleFramework.Core 584 * @since 9 585 */ 586 APP = 0, 587 /* 588 * Indicates atomic service 589 * @syscap SystemCapability.BundleManager.BundleFramework.Core 590 * @since 9 591 */ 592 ATOMIC_SERVICE = 1, 593 } 594 595 /** 596 * Obtains own bundleInfo. 597 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. 598 * @returns { Promise<BundleInfo> } The result of getting the bundle info. 599 * @throws { BusinessError } 401 - The parameter check failed. 600 * @syscap SystemCapability.BundleManager.BundleFramework.Core 601 * @since 9 602 */ 603 function getBundleInfoForSelf(bundleFlags: number): Promise<BundleInfo>; 604 605 /** 606 * Obtains own bundleInfo. 607 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. 608 * @param { AsyncCallback<BundleInfo> } callback - The callback of getting bundle info result. 609 * @throws { BusinessError } 401 - The parameter check failed. 610 * @syscap SystemCapability.BundleManager.BundleFramework.Core 611 * @since 9 612 */ 613 function getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 614 615 /** 616 * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 617 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 618 * @param { string } bundleName - Indicates the application bundle name to be queried. 619 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. 620 * @param { number } userId - Indicates the user ID or do not pass user ID. 621 * @param { AsyncCallback } callback - The callback of getting bundle info result. 622 * @throws { BusinessError } 201 - Permission denied. 623 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 624 * @throws { BusinessError } 401 - The parameter check failed. 625 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 626 * @throws { BusinessError } 17700004 - The specified user ID is not found. 627 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 628 * @syscap SystemCapability.BundleManager.BundleFramework.Core 629 * @systemapi 630 * @since 9 631 */ 632 function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 633 function getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback<BundleInfo>): void; 634 635 /** 636 * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 637 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 638 * @param { string } bundleName - Indicates the application bundle name to be queried. 639 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. 640 * @param { number } userId - Indicates the user ID or do not pass user ID. 641 * @returns { Promise<BundleInfo> } The result of getting the bundle info. 642 * @throws { BusinessError } 201 - Permission denied. 643 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 644 * @throws { BusinessError } 401 - The parameter check failed. 645 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 646 * @throws { BusinessError } 17700004 - The specified user ID is not found. 647 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 648 * @syscap SystemCapability.BundleManager.BundleFramework.Core 649 * @systemapi 650 * @since 9 651 */ 652 function getBundleInfo(bundleName: string, bundleFlags: number, userId?: number): Promise<BundleInfo>; 653 654 /** 655 * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 656 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 657 * @param { string } bundleName - Indicates the application bundle name to be queried. 658 * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. 659 * @param { number } userId - Indicates the user ID or do not pass user ID. 660 * @param { AsyncCallback<ApplicationInfo> } callback - The callback of getting application info result. 661 * @throws { BusinessError } 201 - Permission denied. 662 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 663 * @throws { BusinessError } 401 - The parameter check failed. 664 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 665 * @throws { BusinessError } 17700004 - The specified user ID is not found. 666 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 667 * @syscap SystemCapability.BundleManager.BundleFramework.Core 668 * @systemapi 669 * @since 9 670 */ 671 function getApplicationInfo(bundleName: string, appFlags: number, callback: AsyncCallback<ApplicationInfo>): void; 672 function getApplicationInfo(bundleName: string, appFlags: number, userId: number, callback: AsyncCallback<ApplicationInfo>): void; 673 674 /** 675 * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 676 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 677 * @param { string } bundleName - Indicates the application bundle name to be queried. 678 * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. 679 * @param { number } userId - Indicates the user ID or do not pass user ID. 680 * @returns { Promise<ApplicationInfo> } The result of getting the application info. 681 * @throws { BusinessError } 201 - Permission denied. 682 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 683 * @throws { BusinessError } 401 - The parameter check failed. 684 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 685 * @throws { BusinessError } 17700004 - The specified user ID is not found. 686 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 687 * @syscap SystemCapability.BundleManager.BundleFramework.Core 688 * @systemapi 689 * @since 9 690 */ 691 function getApplicationInfo(bundleName: string, appFlags: number, userId?: number): Promise<ApplicationInfo>; 692 693 /** 694 * Obtains BundleInfo of all bundles available in the system. 695 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 696 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. 697 * @param { number } userId - Indicates the user id. 698 * @param { AsyncCallback } callback - The callback of getting a list of BundleInfo objects. 699 * @throws { BusinessError } 201 - Permission denied. 700 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 701 * @throws { BusinessError } 401 - The parameter check failed. 702 * @throws { BusinessError } 17700004 - The specified user ID is not found. 703 * @syscap SystemCapability.BundleManager.BundleFramework.Core 704 * @systemapi 705 * @since 9 706 */ 707 function getAllBundleInfo(bundleFlags: number, callback: AsyncCallback<Array<BundleInfo>>): void; 708 function getAllBundleInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array<BundleInfo>>): void; 709 710 /** 711 * Obtains BundleInfo of all bundles available in the system. 712 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 713 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. 714 * @param { number } userId - Indicates the user id. 715 * @returns { Promise<Array<BundleInfo>> } Returns a list of BundleInfo objects. 716 * @throws { BusinessError } 201 - Permission denied. 717 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 718 * @throws { BusinessError } 401 - The parameter check failed. 719 * @throws { BusinessError } 17700004 - The specified user ID is not found. 720 * @syscap SystemCapability.BundleManager.BundleFramework.Core 721 * @systemapi 722 * @since 9 723 */ 724 function getAllBundleInfo(bundleFlags: number, userId?: number): Promise<Array<BundleInfo>>; 725 726 /** 727 * Obtains information about all installed applications of a specified user. 728 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 729 * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. 730 * @param { number } userId - Indicates the user ID or do not pass user ID. 731 * @param { AsyncCallback } callback - The callback of getting a list of ApplicationInfo objects. 732 * @throws { BusinessError } 201 - Permission denied. 733 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 734 * @throws { BusinessError } 401 - The parameter check failed. 735 * @throws { BusinessError } 17700004 - The specified user ID is not found. 736 * @syscap SystemCapability.BundleManager.BundleFramework.Core 737 * @systemapi 738 * @since 9 739 */ 740 function getAllApplicationInfo(appFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 741 function getAllApplicationInfo(appFlags: number, userId: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 742 743 /** 744 * Obtains information about all installed applications of a specified user. 745 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 746 * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. 747 * @param { number } userId - Indicates the user ID or do not pass user ID. 748 * @returns { Promise<Array<ApplicationInfo>> } Returns a list of ApplicationInfo objects. 749 * @throws { BusinessError } 201 - Permission denied. 750 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 751 * @throws { BusinessError } 401 - The parameter check failed. 752 * @throws { BusinessError } 17700004 - The specified user ID is not found. 753 * @syscap SystemCapability.BundleManager.BundleFramework.Core 754 * @systemapi 755 * @since 9 756 */ 757 function getAllApplicationInfo(appFlags: number, userId?: number): Promise<Array<ApplicationInfo>>; 758 759 /** 760 * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 761 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 762 * @param { Want } want - Indicates the Want containing the application bundle name to be queried. 763 * @param { number } abilityFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. 764 * @param { number } userId - userId Indicates the user ID. 765 * @param { AsyncCallback<Array<AbilityInfo>> } callback - The callback of querying ability info result. 766 * @throws { BusinessError } 201 - Permission denied. 767 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 768 * @throws { BusinessError } 401 - The parameter check failed. 769 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 770 * @throws { BusinessError } 17700003 - The specified ability is not found. 771 * @throws { BusinessError } 17700004 - The specified userId is invalid. 772 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 773 * @throws { BusinessError } 17700029 - The specified ability is disabled. 774 * @syscap SystemCapability.BundleManager.BundleFramework.Core 775 * @systemapi 776 * @since 9 777 */ 778 function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 779 function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 780 781 /** 782 * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 783 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 784 * @param { Want } want - Indicates the Want containing the application bundle name to be queried. 785 * @param { number } abilityFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. 786 * @param { number } userId - userId Indicates the user ID. 787 * @returns { Promise<Array<AbilityInfo>> } Returns a list of AbilityInfo objects. 788 * @throws { BusinessError } 201 - Permission denied. 789 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 790 * @throws { BusinessError } 401 - The parameter check failed. 791 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 792 * @throws { BusinessError } 17700003 - The specified ability is not found. 793 * @throws { BusinessError } 17700004 - The specified userId is invalid. 794 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 795 * @throws { BusinessError } 17700029 - The specified ability is disabled. 796 * @syscap SystemCapability.BundleManager.BundleFramework.Core 797 * @systemapi 798 * @since 9 799 */ 800 function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise<Array<AbilityInfo>>; 801 802 /** 803 * Query extension info of by utilizing a Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 804 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 805 * @param { Want } want - Indicates the Want containing the application bundle name to be queried. 806 * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType. 807 * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionAbilityInfo objects that will be returned. 808 * @param { number } userId - Indicates the user ID. 809 * @param { AsyncCallback<Array<ExtensionAbilityInfo>> } callback - The callback of querying extension ability info result. 810 * @throws { BusinessError } 201 - Permission denied. 811 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 812 * @throws { BusinessError } 401 - The parameter check failed. 813 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 814 * @throws { BusinessError } 17700003 - The specified extensionAbility is not found. 815 * @throws { BusinessError } 17700004 - The specified userId is invalid. 816 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 817 * @syscap SystemCapability.BundleManager.BundleFramework.Core 818 * @systemapi 819 * @since 9 820 */ 821 function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, callback: AsyncCallback<Array<ExtensionAbilityInfo>>): void; 822 function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId: number, callback: AsyncCallback<Array<ExtensionAbilityInfo>>): void; 823 824 /** 825 * Query the ExtensionAbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. 826 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 827 * @param { Want } want - Indicates the Want containing the application bundle name to be queried. 828 * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType. 829 * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionAbilityInfo objects that will be returned. 830 * @param { number } userId - Indicates the user ID. 831 * @returns { Promise<Array<ExtensionAbilityInfo>> } Returns a list of ExtensionAbilityInfo objects. 832 * @throws { BusinessError } 201 - Permission denied. 833 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 834 * @throws { BusinessError } 401 - The parameter check failed. 835 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 836 * @throws { BusinessError } 17700003 - The specified extensionAbility is not found. 837 * @throws { BusinessError } 17700004 - The specified userId is invalid. 838 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 839 * @syscap SystemCapability.BundleManager.BundleFramework.Core 840 * @systemapi 841 * @since 9 842 */ 843 function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId?: number): Promise<Array<ExtensionAbilityInfo>>; 844 845 /** 846 * Obtains bundle name by the given uid. 847 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 848 * @param { number } uid - Indicates the UID of an application. 849 * @param { AsyncCallback<string> } callback - The callback of getting bundle name. 850 * @throws { BusinessError } 201 - Permission denied. 851 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 852 * @throws { BusinessError } 401 - The parameter check failed. 853 * @throws { BusinessError } 17700021 - The uid is not found. 854 * @syscap SystemCapability.BundleManager.BundleFramework.Core 855 * @systemapi 856 * @since 9 857 */ 858 function getBundleNameByUid(uid: number, callback: AsyncCallback<string>): void 859 860 /** 861 * Obtains bundle name by the given uid. 862 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 863 * @param { number } uid - Indicates the UID of an application. 864 * @returns { Promise<string> } Returns the bundle name. 865 * @throws { BusinessError } 201 - Permission denied. 866 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 867 * @throws { BusinessError } 401 - The parameter check failed. 868 * @throws { BusinessError } 17700021 - The uid is not found. 869 * @syscap SystemCapability.BundleManager.BundleFramework.Core 870 * @systemapi 871 * @since 9 872 */ 873 function getBundleNameByUid(uid: number): Promise<string>; 874 875 /** 876 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 877 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 878 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. 879 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. 880 * @param { AsyncCallback<BundleInfo> } callback - The callback of getting bundle archive info result. 881 * @throws { BusinessError } 201 - Permission denied. 882 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 883 * @throws { BusinessError } 401 - The parameter check failed. 884 * @throws { BusinessError } 17700022 - The hapFilePath is invalid. 885 * @syscap SystemCapability.BundleManager.BundleFramework.Core 886 * @systemapi 887 * @since 9 888 */ 889 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void 890 891 /** 892 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 893 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 894 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. 895 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. 896 * @returns { Promise<BundleInfo> } Returns the BundleInfo object. 897 * @throws { BusinessError } 201 - Permission denied. 898 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 899 * @throws { BusinessError } 401 - The parameter check failed. 900 * @throws { BusinessError } 17700022 - The hapFilePath is invalid. 901 * @syscap SystemCapability.BundleManager.BundleFramework.Core 902 * @systemapi 903 * @since 9 904 */ 905 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise<BundleInfo>; 906 907 /** 908 * Clears cache data of a specified application. 909 * @permission ohos.permission.REMOVE_CACHE_FILES 910 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. 911 * @param { AsyncCallback<void> } callback - The callback of cleaning bundle cache files result. 912 * @throws { BusinessError } 201 - Permission denied. 913 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 914 * @throws { BusinessError } 401 - The parameter check failed. 915 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 916 * @throws { BusinessError } 17700030 - The specified bundle does not support clearing of cache files. 917 * @syscap SystemCapability.BundleManager.BundleFramework.Core 918 * @systemapi 919 * @since 9 920 */ 921 function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; 922 923 /** 924 * Clears cache data of a specified application. 925 * @permission ohos.permission.REMOVE_CACHE_FILES 926 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. 927 * @returns { Promise<void> } Clean bundle cache files result 928 * @throws { BusinessError } 201 - Permission denied. 929 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 930 * @throws { BusinessError } 401 - The parameter check failed. 931 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 932 * @throws { BusinessError } 17700030 - The specified bundle does not support clearing of cache files. 933 * @syscap SystemCapability.BundleManager.BundleFramework.Core 934 * @systemapi 935 * @since 9 936 */ 937 function cleanBundleCacheFiles(bundleName: string): Promise<void>; 938 939 /** 940 * Sets whether to enable a specified application. 941 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 942 * @param { string } bundleName - Indicates the bundle name of the application. 943 * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. 944 * @param { AsyncCallback<void> } callback - The callback of setting app enabled result. 945 * @throws { BusinessError } 201 - Permission denied. 946 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 947 * @throws { BusinessError } 401 - The parameter check failed. 948 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 949 * @syscap SystemCapability.BundleManager.BundleFramework.Core 950 * @systemapi 951 * @since 9 952 */ 953 function setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCallback<void>): void; 954 955 /** 956 * Sets whether to enable a specified application. 957 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 958 * @param { string } bundleName - Indicates the bundle name of the application. 959 * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. 960 * @returns { Promise<void> } set app enabled result. 961 * @throws { BusinessError } 201 - Permission denied. 962 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 963 * @throws { BusinessError } 401 - The parameter check failed. 964 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 965 * @syscap SystemCapability.BundleManager.BundleFramework.Core 966 * @systemapi 967 * @since 9 968 */ 969 function setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise<void>; 970 971 /** 972 * Sets whether to enable a specified ability. 973 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 974 * @param { AbilityInfo } abilityInfo - Indicates information about the ability to set. 975 * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. 976 * @param { AsyncCallback<void> } callback - The callback of setting ability enabled result. 977 * @throws { BusinessError } 201 - Permission denied. 978 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 979 * @throws { BusinessError } 401 - The parameter check failed. 980 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 981 * @throws { BusinessError } 17700003 - The specified abilityInfo is not found. 982 * @syscap SystemCapability.BundleManager.BundleFramework.Core 983 * @systemapi 984 * @since 9 985 */ 986 function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean, callback: AsyncCallback<void>): void; 987 988 /** 989 * Sets whether to enable a specified ability. 990 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 991 * @param { AbilityInfo } abilityInfo - Indicates information about the ability to set. 992 * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. 993 * @returns { Promise<void> } set ability enabled result. 994 * @throws { BusinessError } 201 - Permission denied. 995 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 996 * @throws { BusinessError } 401 - The parameter check failed. 997 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 998 * @throws { BusinessError } 17700003 - The specified abilityInfo is not found. 999 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1000 * @systemapi 1001 * @since 9 1002 */ 1003 function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean): Promise<void>; 1004 1005 /** 1006 * Checks whether a specified application is enabled. 1007 * @param { string } bundleName - Indicates the bundle name of the application. 1008 * @param { AsyncCallback<boolean> } callback - The callback of checking application enabled result. The result is true if enabled, false otherwise. 1009 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1010 * @throws { BusinessError } 401 - The parameter check failed. 1011 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1012 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1013 * @systemapi 1014 * @since 9 1015 */ 1016 function isApplicationEnabled(bundleName: string, callback: AsyncCallback<boolean>): void; 1017 1018 /** 1019 * Checks whether a specified application is enabled. 1020 * @param { string } bundleName - Indicates the bundle name of the application. 1021 * @returns { Promise<boolean> } Returns true if the application is enabled; returns false otherwise. 1022 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1023 * @throws { BusinessError } 401 - The parameter check failed. 1024 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1025 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1026 * @systemapi 1027 * @since 9 1028 */ 1029 function isApplicationEnabled(bundleName: string): Promise<boolean>; 1030 1031 /** 1032 * Checks whether a specified ability is enabled. 1033 * @param { AbilityInfo } info - Indicates information about the ability to check. 1034 * @param { AsyncCallback<boolean> } callback - The callback of checking ability enabled result. The result is true if enabled, false otherwise. 1035 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1036 * @throws { BusinessError } 401 - The parameter check failed. 1037 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1038 * @throws { BusinessError } 17700003 - The specified abilityName is not found. 1039 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1040 * @systemapi 1041 * @since 9 1042 */ 1043 function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback<boolean>): void; 1044 1045 /** 1046 * Checks whether a specified ability is enabled. 1047 * @param { AbilityInfo } info - Indicates information about the ability to check. 1048 * @returns { Promise<boolean> } Returns true if the ability is enabled; returns false otherwise. 1049 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1050 * @throws { BusinessError } 401 - The parameter check failed. 1051 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1052 * @throws { BusinessError } 17700003 - The specified abilityName is not found. 1053 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1054 * @systemapi 1055 * @since 9 1056 */ 1057 function isAbilityEnabled(info: AbilityInfo): Promise<boolean>; 1058 1059 /** 1060 * Obtains the Want for starting the main ability of an application based on the 1061 * given bundle name. The main ability of an application is the ability that has the 1062 * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's <b>config.json</b> or <b>module.json</b> file. 1063 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1064 * @param { string } bundleName - Indicates the bundle name of the application. 1065 * @param { number } userId - Indicates the user ID or do not pass user ID. 1066 * @param { AsyncCallback<Want> } callback - The callback for starting the application's main ability. 1067 * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. 1068 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1069 * @throws { BusinessError } 401 - Input parameters check failed. 1070 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1071 * @throws { BusinessError } 17700004 - The specified user ID is not found. 1072 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1073 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1074 * @systemapi 1075 * @since 9 1076 */ 1077 function getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallback<Want>): void; 1078 1079 /** 1080 * Obtains the Want for starting the main ability of an application based on the 1081 * given bundle name. The main ability of an application is the ability that has the 1082 * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's <b>config.json</b> or <b>module.json</b> file. 1083 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1084 * @param { string } bundleName - Indicates the bundle name of the application. 1085 * @param { AsyncCallback<Want> } callback - The callback for starting the application's main ability. 1086 * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. 1087 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1088 * @throws { BusinessError } 401 - Input parameters check failed. 1089 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1090 * @throws { BusinessError } 17700004 - The specified user ID is not found. 1091 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1092 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1093 * @systemapi 1094 * @since 9 1095 */ 1096 function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback<Want>): void; 1097 1098 /** 1099 * Obtains the Want for starting the main ability of an application based on the 1100 * given bundle name. The main ability of an application is the ability that has the 1101 * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's <b>config.json</b> or <b>module.json</b> file. 1102 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1103 * @param { string } bundleName - Indicates the bundle name of the application. 1104 * @param { number } userId - Indicates the user ID or do not pass user ID. 1105 * @returns { Promise<Want> } the Want for starting the application's main ability. 1106 * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. 1107 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1108 * @throws { BusinessError } 401 - Input parameters check failed. 1109 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1110 * @throws { BusinessError } 17700004 - The specified user ID is not found. 1111 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1112 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1113 * @systemapi 1114 * @since 9 1115 */ 1116 function getLaunchWantForBundle(bundleName: string, userId?: number): Promise<Want>; 1117 1118 /** 1119 * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. 1120 * @param { string } moduleName - Indicates the moduleName of the application. 1121 * @param { string } abilityName - Indicates the abilityName of the application. 1122 * @param { string } metadataName - Indicates the name of metadata in ability. 1123 * @param { AsyncCallback<Array<string>> } callback - The callback of returning string in json-format of the corresponding config file. 1124 * @throws { BusinessError } 401 - Input parameters check failed. 1125 * @throws { BusinessError } 17700002 - The specified moduleName is not existed. 1126 * @throws { BusinessError } 17700003 - The specified abilityName is not existed. 1127 * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. 1128 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1129 * @throws { BusinessError } 17700029 - The specified ability is disabled. 1130 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1131 * @since 9 1132 */ 1133 function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback<Array<string>>): void; 1134 1135 /** 1136 * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. 1137 * @param { string } moduleName - Indicates the moduleName of the application. 1138 * @param { string } abilityName - Indicates the abilityName of the application. 1139 * @param { string } metadataName - Indicates the name of metadata in ability. 1140 * @returns { Promise<Array<string>> } Returns string in json-format of the corresponding config file. 1141 * @throws { BusinessError } 401 - Input parameters check failed. 1142 * @throws { BusinessError } 17700002 - The specified moduleName is not existed. 1143 * @throws { BusinessError } 17700003 - The specified abilityName is not existed. 1144 * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. 1145 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1146 * @throws { BusinessError } 17700029 - The specified ability is disabled. 1147 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1148 * @since 9 1149 */ 1150 function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise<Array<string>>; 1151 1152 /** 1153 * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. 1154 * @param { string } moduleName - Indicates the moduleName of the application. 1155 * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. 1156 * @param { string } metadataName - Indicates the name of metadata in ability. 1157 * @param { AsyncCallback } callback - The callback of returning string in json-format of the corresponding config file. 1158 * @throws { BusinessError } 401 - Input parameters check failed. 1159 * @throws { BusinessError } 17700002 - The specified moduleName is not existed. 1160 * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. 1161 * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. 1162 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1163 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1164 * @since 9 1165 */ 1166 function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback<Array<string>>): void; 1167 1168 /** 1169 * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. 1170 * @param { string } moduleName - Indicates the moduleName of the application. 1171 * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. 1172 * @param { string } metadataName - Indicates the name of metadata in ability. 1173 * @returns { Promise<Array<string>> } Returns string in json-format of the corresponding config file. 1174 * @throws { BusinessError } 401 - Input parameters check failed. 1175 * @throws { BusinessError } 17700002 - The specified moduleName is not existed. 1176 * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. 1177 * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. 1178 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1179 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1180 * @since 9 1181 */ 1182 function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise<Array<string>>; 1183 1184 /** 1185 * Get the permission details by permission name. 1186 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1187 * @param { string } permissionName - Indicates permission name. 1188 * @param { AsyncCallback<PermissionDef> } callback - The callback of get permissionDef object result. 1189 * @throws { BusinessError } 201 - Permission denied. 1190 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1191 * @throws { BusinessError } 401 - Input parameters check failed. 1192 * @throws { BusinessError } 17700006 - The specified permission is not found. 1193 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1194 * @systemapi 1195 * @since 9 1196 */ 1197 function getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; 1198 1199 /** 1200 * Get the permission details by permission name. 1201 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1202 * @param { string } permissionName - Indicates permission name. 1203 * @returns { Promise<PermissionDef> } Returns permissionDef object. 1204 * @throws { BusinessError } 201 - Permission denied. 1205 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1206 * @throws { BusinessError } 401 - Input parameters check failed. 1207 * @throws { BusinessError } 17700006 - The specified permission is not found. 1208 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1209 * @systemapi 1210 * @since 9 1211 */ 1212 function getPermissionDef(permissionName: string): Promise<PermissionDef>; 1213 1214 /** 1215 * Obtains the label of a specified ability. 1216 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1217 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 1218 * @param { string } moduleName - Indicates the module name. 1219 * @param { string } abilityName - Indicates the ability name. 1220 * @param { AsyncCallback<string> } callback - The callback of getting ability label result. 1221 * @throws { BusinessError } 201 - Permission denied. 1222 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1223 * @throws { BusinessError } 401 - The parameter check failed. 1224 * @throws { BusinessError } 801 - Capability not supported. 1225 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1226 * @throws { BusinessError } 17700002 - The specified moduleName is not found. 1227 * @throws { BusinessError } 17700003 - The specified abilityName is not found. 1228 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1229 * @throws { BusinessError } 17700029 - The specified ability is disabled. 1230 * @syscap SystemCapability.BundleManager.BundleFramework.Resource 1231 * @systemapi 1232 * @since 9 1233 */ 1234 function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback<string>): void; 1235 1236 /** 1237 * Obtains the label of a specified ability. 1238 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1239 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 1240 * @param { string } moduleName - Indicates the module name. 1241 * @param { string } abilityName - Indicates the ability name. 1242 * @returns { Promise<string> } Returns the label representing the label of the specified ability. 1243 * @throws { BusinessError } 201 - Permission denied. 1244 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1245 * @throws { BusinessError } 401 - The parameter check failed. 1246 * @throws { BusinessError } 801 - Capability not supported. 1247 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1248 * @throws { BusinessError } 17700002 - The specified moduleName is not found. 1249 * @throws { BusinessError } 17700003 - The specified abilityName is not found. 1250 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1251 * @throws { BusinessError } 17700029 - The specified ability is disabled. 1252 * @syscap SystemCapability.BundleManager.BundleFramework.Resource 1253 * @systemapi 1254 * @since 9 1255 */ 1256 function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise<string>; 1257 1258 /** 1259 * Obtains applicationInfo based on a given bundleName and bundleFlags. 1260 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1261 * @param { string } bundleName - Indicates the application bundle name to be queried. 1262 * @param { number } applicationFlags - Indicates the flag used to specify information contained in the ApplicationInfo object that will be returned. 1263 * @param { number } userId - Indicates the user ID or do not pass user ID. 1264 * @returns Returns the ApplicationInfo object. 1265 * @throws { BusinessError } 201 - Permission denied. 1266 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1267 * @throws { BusinessError } 401 - The parameter check failed. 1268 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1269 * @throws { BusinessError } 17700004 - The specified user ID is not found. 1270 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1271 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1272 * @systemapi 1273 * @since 9 1274 */ 1275 function getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : ApplicationInfo; 1276 1277 /** 1278 * Obtains applicationInfo based on a given bundleName and bundleFlags. 1279 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1280 * @param { string } bundleName - Indicates the application bundle name to be queried. 1281 * @param { number } applicationFlags - Indicates the flag used to specify information contained in the ApplicationInfo object that will be returned. 1282 * @returns Returns the ApplicationInfo object. 1283 * @throws { BusinessError } 201 - Permission denied. 1284 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1285 * @throws { BusinessError } 401 - The parameter check failed. 1286 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1287 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1288 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1289 * @systemapi 1290 * @since 9 1291 */ 1292 function getApplicationInfoSync(bundleName: string, applicationFlags: number) : ApplicationInfo; 1293 1294 /** 1295 * Obtains bundleInfo based on bundleName, bundleFlags and options. 1296 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1297 * @param { string } bundleName - Indicates the application bundle name to be queried. 1298 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object that will be returned. 1299 * @param { number } userId - Indicates the user ID or do not pass user ID. 1300 * @returns Returns the BundleInfo object. 1301 * @throws { BusinessError } 201 - Permission denied. 1302 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1303 * @throws { BusinessError } 401 - The parameter check failed. 1304 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1305 * @throws { BusinessError } 17700004 - The specified user ID is not found. 1306 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1307 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1308 * @systemapi 1309 * @since 9 1310 */ 1311 function getBundleInfoSync(bundleName: string, bundleFlags: number, userId: number): BundleInfo; 1312 1313 /** 1314 * Obtains bundleInfo based on bundleName, bundleFlags and options. 1315 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1316 * @param { string } bundleName - Indicates the application bundle name to be queried. 1317 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object that will be returned. 1318 * @returns Returns the BundleInfo object. 1319 * @throws { BusinessError } 201 - Permission denied. 1320 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 1321 * @throws { BusinessError } 401 - The parameter check failed. 1322 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 1323 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 1324 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1325 * @systemapi 1326 * @since 9 1327 */ 1328 function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo; 1329 1330 /** 1331 * Obtains configuration information about an application. 1332 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1333 * @since 9 1334 */ 1335 export type ApplicationInfo = _ApplicationInfo; 1336 1337 /** 1338 * Indicates the Metadata. 1339 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1340 * @since 9 1341 */ 1342 export type Metadata = _Metadata; 1343 1344 /** 1345 * Obtains configuration information about a bundle. 1346 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1347 * @since 9 1348 */ 1349 export type BundleInfo = _BundleInfo.BundleInfo; 1350 1351 /** 1352 * The scene which is used. 1353 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1354 * @since 9 1355 */ 1356 export type UsedScene = _BundleInfo.UsedScene; 1357 1358 /** 1359 * Indicates the required permissions details defined in file config.json. 1360 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1361 * @since 9 1362 */ 1363 export type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail; 1364 1365 /** 1366 * Indicates the SignatureInfo. 1367 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1368 * @since 9 1369 */ 1370 export type SignatureInfo = _BundleInfo.SignatureInfo; 1371 1372 /** 1373 * Obtains configuration information about a module. 1374 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1375 * @since 9 1376 */ 1377 export type HapModuleInfo = _HapModuleInfo.HapModuleInfo; 1378 1379 /** 1380 * Obtains preload information about a module. 1381 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1382 * @since 9 1383 */ 1384 export type PreloadItem = _HapModuleInfo.PreloadItem; 1385 1386 /** 1387 * Obtains dependency information about a module. 1388 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1389 * @since 9 1390 */ 1391 export type Dependency = _HapModuleInfo.Dependency; 1392 1393 /** 1394 * Obtains configuration information about an ability. 1395 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1396 * @since 9 1397 */ 1398 export type AbilityInfo = _AbilityInfo.AbilityInfo; 1399 1400 /** 1401 * Contains basic Ability information. Indicates the window size.. 1402 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1403 * @since 9 1404 */ 1405 export type WindowSize = _AbilityInfo.WindowSize; 1406 1407 /** 1408 * Obtains extension information about a bundle. 1409 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1410 * @since 9 1411 */ 1412 export type ExtensionAbilityInfo = _ExtensionAbilityInfo.ExtensionAbilityInfo; 1413 1414 /** 1415 * Indicates the defined permission details in file config.json. 1416 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1417 * @systemapi 1418 * @since 9 1419 */ 1420 export type PermissionDef = _PermissionDef; 1421 1422 /** 1423 * Contains basic Ability information, which uniquely identifies an ability. 1424 * @syscap SystemCapability.BundleManager.BundleFramework.Core 1425 * @since 9 1426 */ 1427 export type ElementName = _ElementName; 1428} 1429 1430export default bundleManager; 1431