1/* 2 * Copyright (c) 2021 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 './@ohos.base'; 17import { ApplicationInfo } from './bundle/applicationInfo'; 18import { AbilityInfo } from './bundle/abilityInfo'; 19import { PermissionDef } from './bundle/PermissionDef'; 20import Want from './@ohos.app.ability.Want'; 21import image from './@ohos.multimedia.image'; 22import { BundleInfo } from './bundle/bundleInfo'; 23import { BundleInstaller } from './bundle/bundleInstaller'; 24 25/** 26 * bundle. 27 * 28 * @namespace bundle 29 * @syscap SystemCapability.BundleManager.BundleFramework 30 * @since 7 31 * @deprecated since 9 32 * @useinstead ohos.bundle.bundleManager 33 */ 34declare namespace bundle { 35 /** 36 * BundleFlag 37 * 38 * @enum { number } 39 * @syscap SystemCapability.BundleManager.BundleFramework 40 * @since 7 41 * @deprecated since 9 42 * @useinstead ohos.bundle.bundleManager.BundleFlag 43 */ 44 enum BundleFlag { 45 GET_BUNDLE_DEFAULT = 0x00000000, 46 GET_BUNDLE_WITH_ABILITIES = 0x00000001, 47 GET_ABILITY_INFO_WITH_PERMISSION = 0x00000002, 48 GET_ABILITY_INFO_WITH_APPLICATION = 0x00000004, 49 GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, 50 GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010, 51 GET_ALL_APPLICATION_INFO = 0xFFFF0000, 52 /** 53 * @syscap SystemCapability.BundleManager.BundleFramework 54 * @since 8 55 * @deprecated since 9 56 */ 57 GET_ABILITY_INFO_WITH_METADATA = 0x00000020, 58 /** 59 * @syscap SystemCapability.BundleManager.BundleFramework 60 * @since 8 61 * @deprecated since 9 62 */ 63 GET_APPLICATION_INFO_WITH_METADATA = 0x00000040, 64 /** 65 * @syscap SystemCapability.BundleManager.BundleFramework 66 * @since 8 67 * @deprecated since 9 68 */ 69 GET_ABILITY_INFO_SYSTEMAPP_ONLY = 0x00000080, 70 /** 71 * @syscap SystemCapability.BundleManager.BundleFramework 72 * @since 8 73 * @deprecated since 9 74 */ 75 GET_ABILITY_INFO_WITH_DISABLE = 0x00000100, 76 /** 77 * @syscap SystemCapability.BundleManager.BundleFramework 78 * @since 8 79 * @deprecated since 9 80 */ 81 GET_APPLICATION_INFO_WITH_DISABLE = 0x00000200 82 } 83 84 /** 85 * ColorMode 86 * 87 * @enum { number } 88 * @syscap SystemCapability.BundleManager.BundleFramework 89 * @since 7 90 * @deprecated since 9 91 */ 92 export enum ColorMode { 93 AUTO_MODE = -1, 94 DARK_MODE = 0, 95 LIGHT_MODE = 1 96 } 97 98 /** 99 * GrantStatus 100 * 101 * @enum { number } 102 * @syscap SystemCapability.BundleManager.BundleFramework 103 * @since 7 104 * @deprecated since 9 105 * @useinstead ohos.bundle.bundleManager.PermissionGrantState 106 */ 107 export enum GrantStatus { 108 PERMISSION_DENIED = -1, 109 PERMISSION_GRANTED = 0 110 } 111 112 /** 113 * AbilityType 114 * 115 * @enum { number } 116 * @syscap SystemCapability.BundleManager.BundleFramework 117 * @since 7 118 * @deprecated since 9 119 * @useinstead ohos.bundle.bundleManager.AbilityType 120 */ 121 export enum AbilityType { 122 /** 123 * Indicates an unknown ability type 124 * 125 * @syscap SystemCapability.BundleManager.BundleFramework 126 * @since 7 127 * @deprecated since 9 128 */ 129 UNKNOWN, 130 131 /** 132 * Indicates that the ability has a UI 133 * 134 * @syscap SystemCapability.BundleManager.BundleFramework 135 * @since 7 136 * @deprecated since 9 137 */ 138 PAGE, 139 140 /** 141 * Indicates that the ability does not have a UI 142 * 143 * @syscap SystemCapability.BundleManager.BundleFramework 144 * @since 7 145 * @deprecated since 9 146 */ 147 SERVICE, 148 149 /** 150 * Indicates that the ability is used to provide data access services 151 * 152 * @syscap SystemCapability.BundleManager.BundleFramework 153 * @since 7 154 * @deprecated since 9 155 */ 156 DATA 157 } 158 159 /** 160 * AbilitySubType 161 * 162 * @enum { number } 163 * @syscap SystemCapability.BundleManager.BundleFramework 164 * @since 7 165 * @deprecated since 9 166 */ 167 export enum AbilitySubType { 168 UNSPECIFIED = 0, 169 CA = 1 170 } 171 172 /** 173 * DisplayOrientation 174 * 175 * @enum { number } 176 * @syscap SystemCapability.BundleManager.BundleFramework 177 * @since 7 178 * @deprecated since 9 179 * @useinstead ohos.bundle.bundleManager.DisplayOrientation 180 */ 181 export enum DisplayOrientation { 182 /** 183 * Indicates that the system automatically determines the display orientation 184 * 185 * @syscap SystemCapability.BundleManager.BundleFramework 186 * @since 7 187 * @deprecated since 9 188 */ 189 UNSPECIFIED, 190 191 /** 192 * Indicates the landscape orientation 193 * 194 * @syscap SystemCapability.BundleManager.BundleFramework 195 * @since 7 196 * @deprecated since 9 197 */ 198 LANDSCAPE, 199 200 /** 201 * Indicates the portrait orientation 202 * 203 * @syscap SystemCapability.BundleManager.BundleFramework 204 * @since 7 205 * @deprecated since 9 206 */ 207 PORTRAIT, 208 209 /** 210 * Indicates the page ability orientation is the same as that of the nearest ability in the stack 211 * 212 * @syscap SystemCapability.BundleManager.BundleFramework 213 * @since 7 214 * @deprecated since 9 215 */ 216 FOLLOW_RECENT 217 } 218 219 /** 220 * LaunchMode 221 * 222 * @enum { number } 223 * @syscap SystemCapability.BundleManager.BundleFramework 224 * @since 7 225 * @deprecated since 9 226 * @useinstead ohos.bundle.bundleManager.LaunchType 227 */ 228 export enum LaunchMode { 229 /** 230 * Indicates that the ability has only one instance 231 * 232 * @syscap SystemCapability.BundleManager.BundleFramework 233 * @since 7 234 * @deprecated since 9 235 */ 236 SINGLETON = 0, 237 238 /** 239 * Indicates that the ability can have multiple instances 240 * 241 * @syscap SystemCapability.BundleManager.BundleFramework 242 * @since 7 243 * @deprecated since 9 244 */ 245 STANDARD = 1 246 } 247 248 /** 249 * BundleOptions 250 * 251 * @typedef BundleOptions 252 * @syscap SystemCapability.BundleManager.BundleFramework 253 * @since 7 254 * @deprecated since 9 255 */ 256 export interface BundleOptions { 257 /** 258 * Indicates the user id 259 * 260 * @syscap SystemCapability.BundleManager.BundleFramework 261 * @since 7 262 * @deprecated since 9 263 */ 264 userId?: number; 265 } 266 267 /** 268 * InstallErrorCode 269 * 270 * @enum { number } 271 * @syscap SystemCapability.BundleManager.BundleFramework 272 * @since 7 273 * @deprecated since 9 274 */ 275 export enum InstallErrorCode { 276 SUCCESS = 0, 277 STATUS_INSTALL_FAILURE = 1, 278 STATUS_INSTALL_FAILURE_ABORTED = 2, 279 STATUS_INSTALL_FAILURE_INVALID = 3, 280 STATUS_INSTALL_FAILURE_CONFLICT = 4, 281 STATUS_INSTALL_FAILURE_STORAGE = 5, 282 STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, 283 STATUS_UNINSTALL_FAILURE = 7, 284 STATUS_UNINSTALL_FAILURE_BLOCKED = 8, 285 STATUS_UNINSTALL_FAILURE_ABORTED = 9, 286 STATUS_UNINSTALL_FAILURE_CONFLICT = 10, 287 STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, 288 STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, 289 /** 290 * @syscap SystemCapability.BundleManager.BundleFramework 291 * @since 8 292 * @deprecated since 9 293 */ 294 STATUS_RECOVER_FAILURE_INVALID = 0x0D, 295 /** 296 * @syscap SystemCapability.BundleManager.BundleFramework 297 * @since 7 298 * @deprecated since 9 299 */ 300 STATUS_ABILITY_NOT_FOUND = 0x40, 301 /** 302 * @syscap SystemCapability.BundleManager.BundleFramework 303 * @since 7 304 * @deprecated since 9 305 */ 306 STATUS_BMS_SERVICE_ERROR = 0x41, 307 /** 308 * @syscap SystemCapability.BundleManager.BundleFramework 309 * @since 8 310 * @deprecated since 9 311 */ 312 STATUS_FAILED_NO_SPACE_LEFT = 0x42, 313 /** 314 * @syscap SystemCapability.BundleManager.BundleFramework 315 * @since 8 316 * @deprecated since 9 317 */ 318 STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43, 319 /** 320 * @syscap SystemCapability.BundleManager.BundleFramework 321 * @since 8 322 * @deprecated since 9 323 */ 324 STATUS_INSTALL_PERMISSION_DENIED = 0x44, 325 /** 326 * @syscap SystemCapability.BundleManager.BundleFramework 327 * @since 8 328 * @deprecated since 9 329 */ 330 STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 331 } 332 333 /** 334 * Obtains bundleInfo based on bundleName, bundleFlags and options. 335 * 336 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 337 * @param { string } bundleName - Indicates the application bundle name to be queried. 338 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 339 * @param { BundleOptions } options Indicates the bundle options object. 340 * @param { AsyncCallback<BundleInfo> } callback 341 * @syscap SystemCapability.BundleManager.BundleFramework 342 * @since 7 343 * @deprecated since 9 344 */ 345 function getBundleInfo(bundleName: string, 346 bundleFlags: number, options: BundleOptions, callback: AsyncCallback<BundleInfo>): void; 347 348 /** 349 * Obtains bundleInfo based on bundleName, bundleFlags and options. 350 * 351 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 352 * @param { string } bundleName - Indicates the application bundle name to be queried. 353 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 354 * @param { AsyncCallback<BundleInfo> } callback 355 * @syscap SystemCapability.BundleManager.BundleFramework 356 * @since 7 357 * @deprecated since 9 358 */ 359 function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 360 361 /** 362 * Obtains bundleInfo based on bundleName, bundleFlags and options. 363 * 364 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 365 * @param { string } bundleName - Indicates the application bundle name to be queried. 366 * @param { number } bundleFlags - Indicates the application bundle flags to be queried. 367 * @param { BundleOptions } options Indicates the bundle options object. 368 * @returns { Promise<BundleInfo> } Returns the BundleInfo object. 369 * @syscap SystemCapability.BundleManager.BundleFramework 370 * @since 7 371 * @deprecated since 9 372 */ 373 function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise<BundleInfo>; 374 375 /** 376 * Obtains the interface used to install bundles. 377 * 378 * @permission ohos.permission.INSTALL_BUNDLE 379 * @param { AsyncCallback<BundleInstaller> } callback 380 * @syscap SystemCapability.BundleManager.BundleFramework 381 * @systemapi Hide this for inner system use 382 * @since 7 383 * @deprecated since 9 384 * @useinstead ohos.bundle.installer#getBundleInstaller 385 */ 386 function getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void; 387 388 /** 389 * Obtains the interface used to install bundles. 390 * 391 * @permission ohos.permission.INSTALL_BUNDLE 392 * @returns { Promise<BundleInstaller> } Returns the IBundleInstaller interface. 393 * @syscap SystemCapability.BundleManager.BundleFramework 394 * @systemapi Hide this for inner system use 395 * @since 7 396 * @deprecated since 9 397 * @useinstead ohos.bundle.installer#getBundleInstaller 398 */ 399 function getBundleInstaller(): Promise<BundleInstaller>; 400 401 /** 402 * Obtains information about the current ability. 403 * 404 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 405 * @param { string } bundleName - Indicates the application bundle name to be queried. 406 * @param { string } abilityName - Indicates the ability name. 407 * @param { AsyncCallback<AbilityInfo> } callback 408 * @syscap SystemCapability.BundleManager.BundleFramework 409 * @since 7 410 * @deprecated since 9 411 */ 412 function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback<AbilityInfo>): void; 413 414 /** 415 * Obtains information about the current ability. 416 * 417 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 418 * @param { string } bundleName - Indicates the application bundle name to be queried. 419 * @param { string } abilityName - Indicates the ability name. 420 * @returns { Promise<AbilityInfo> } Returns the AbilityInfo object for the current ability. 421 * @syscap SystemCapability.BundleManager.BundleFramework 422 * @since 7 423 * @deprecated since 9 424 */ 425 function getAbilityInfo(bundleName: string, abilityName: string): Promise<AbilityInfo>; 426 427 /** 428 * Obtains based on a given bundle name. 429 * 430 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 431 * @param { string } bundleName - Indicates the application bundle name to be queried. 432 * @param { number } bundleFlags - Indicates the flag used to specify information contained 433 * in the ApplicationInfo object that will be returned. 434 * @param { number } userId - Indicates the user ID or do not pass user ID. 435 * @param { AsyncCallback<ApplicationInfo> } callback 436 * @syscap SystemCapability.BundleManager.BundleFramework 437 * @since 7 438 * @deprecated since 9 439 */ 440 function getApplicationInfo(bundleName: string, 441 bundleFlags: number, userId: number, callback: AsyncCallback<ApplicationInfo>): void; 442 443 /** 444 * Obtains based on a given bundle name. 445 * 446 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 447 * @param { string } bundleName - Indicates the application bundle name to be queried. 448 * @param { number } bundleFlags - Indicates the flag used to specify information contained 449 * in the ApplicationInfo object that will be returned. 450 * @param { AsyncCallback<ApplicationInfo> } callback 451 * @syscap SystemCapability.BundleManager.BundleFramework 452 * @since 7 453 * @deprecated since 9 454 */ 455 function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<ApplicationInfo>): void; 456 457 /** 458 * Obtains based on a given bundle name. 459 * 460 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 461 * @param { string } bundleName - Indicates the application bundle name to be queried. 462 * @param { number } bundleFlags - Indicates the flag used to specify information contained 463 * in the ApplicationInfo object that will be returned. 464 * @param { number } userId - Indicates the user ID or do not pass user ID. 465 * @returns { Promise<ApplicationInfo> } Returns the ApplicationInfo object. 466 * @syscap SystemCapability.BundleManager.BundleFramework 467 * @since 7 468 * @deprecated since 9 469 */ 470 function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise<ApplicationInfo>; 471 472 /** 473 * Query the AbilityInfo by the given Want. 474 * 475 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 476 * @param { Want } want - Indicates the Want containing the application bundle name 477 * to be queried. 478 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 479 * will be returned. 480 * @param { number } userId - Indicates the user ID. 481 * @param { AsyncCallback<Array<AbilityInfo>> } callback 482 * @syscap SystemCapability.BundleManager.BundleFramework 483 * @since 7 484 * @deprecated since 9 485 */ 486 function queryAbilityByWant(want: Want, 487 bundleFlags: number, userId: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 488 489 /** 490 * Query the AbilityInfo by the given Want. 491 * 492 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 493 * @param { Want } want - Indicates the Want containing the application bundle name 494 * to be queried. 495 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 496 * will be returned. 497 * @param { AsyncCallback<Array<AbilityInfo>> } callback 498 * @syscap SystemCapability.BundleManager.BundleFramework 499 * @since 7 500 * @deprecated since 9 501 */ 502 function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void; 503 504 /** 505 * Query the AbilityInfo by the given Want. 506 * 507 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 508 * @param { Want } want - Indicates the Want containing the application bundle name 509 * to be queried. 510 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that 511 * will be returned. 512 * @param { number } userId - Indicates the user ID. 513 * @returns { Promise<Array<AbilityInfo>> } Returns a list of AbilityInfo objects. 514 * @syscap SystemCapability.BundleManager.BundleFramework 515 * @since 7 516 * @deprecated since 9 517 */ 518 function queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array<AbilityInfo>>; 519 520 /** 521 * Obtains BundleInfo of all bundles available in the system. 522 * 523 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 524 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 525 * in the BundleInfo that will be returned. 526 * @param { number } userId - Indicates the user ID. 527 * @param { AsyncCallback<Array<BundleInfo>> } callback 528 * @syscap SystemCapability.BundleManager.BundleFramework 529 * @since 7 530 * @deprecated since 9 531 */ 532 function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array<BundleInfo>>): void; 533 534 /** 535 * Obtains BundleInfo of all bundles available in the system. 536 * 537 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 538 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 539 * in the BundleInfo that will be returned. 540 * @param { AsyncCallback<Array<BundleInfo>> } callback 541 * @syscap SystemCapability.BundleManager.BundleFramework 542 * @since 7 543 * @deprecated since 9 544 */ 545 function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array<BundleInfo>>): void; 546 547 /** 548 * Obtains BundleInfo of all bundles available in the system. 549 * 550 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 551 * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained 552 * in the BundleInfo that will be returned. 553 * @param { number } userId - Indicates the user ID. 554 * @returns { Promise<Array<BundleInfo>> } Returns a list of BundleInfo objects. 555 * @syscap SystemCapability.BundleManager.BundleFramework 556 * @since 7 557 * @deprecated since 9 558 */ 559 function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array<BundleInfo>>; 560 561 /** 562 * Obtains information about all installed applications of a specified user. 563 * 564 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 565 * @param { number } bundleFlags - Indicates the flag used to specify information contained 566 * in the ApplicationInfo objects that will be returned. 567 * @param { number } userId - Indicates the user ID. 568 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 569 * @syscap SystemCapability.BundleManager.BundleFramework 570 * @since 7 571 * @deprecated since 9 572 */ 573 function getAllApplicationInfo(bundleFlags: number, 574 userId: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 575 576 /** 577 * Obtains information about all installed applications of a specified user. 578 * 579 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 580 * @param { number } bundleFlags - Indicates the flag used to specify information contained 581 * in the ApplicationInfo objects that will be returned. 582 * @param { AsyncCallback<Array<ApplicationInfo>> } callback 583 * @syscap SystemCapability.BundleManager.BundleFramework 584 * @since 7 585 * @deprecated since 9 586 */ 587 function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>): void; 588 589 /** 590 * Obtains information about all installed applications of a specified user. 591 * 592 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 593 * @param { number } bundleFlags - Indicates the flag used to specify information contained 594 * in the ApplicationInfo objects that will be returned. 595 * @param { number } userId - Indicates the user ID or do not pass user ID. 596 * @returns { Promise<Array<ApplicationInfo>> } Returns a list of ApplicationInfo objects. 597 * @syscap SystemCapability.BundleManager.BundleFramework 598 * @since 7 599 * @deprecated since 9 600 */ 601 function getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array<ApplicationInfo>>; 602 603 /** 604 * Obtains bundle name by the given uid. 605 * 606 * @param { number } uid - Indicates the UID of an application. 607 * @param { AsyncCallback<string> } callback 608 * @syscap SystemCapability.BundleManager.BundleFramework 609 * @since 8 610 * @deprecated since 9 611 */ 612 function getNameForUid(uid: number, callback: AsyncCallback<string>): void; 613 614 /** 615 * Obtains bundle name by the given uid. 616 * 617 * @param { number } uid - Indicates the UID of an application. 618 * @returns { Promise<string> } Returns the bundle name. 619 * @syscap SystemCapability.BundleManager.BundleFramework 620 * @since 8 621 * @deprecated since 9 622 */ 623 function getNameForUid(uid: number): Promise<string>; 624 625 /** 626 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 627 * 628 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 629 * to the data directory of the current application. 630 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 631 * BundleInfo object to be returned. 632 * @param { AsyncCallback<BundleInfo> } callback 633 * @syscap SystemCapability.BundleManager.BundleFramework 634 * @since 7 635 * @deprecated since 9 636 */ 637 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void; 638 639 /** 640 * Obtains information about an application bundle contained in an ohos Ability Package (HAP). 641 * 642 * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path 643 * to the data directory of the current application. 644 * @param { number } bundleFlags - Indicates the flag used to specify information contained in the 645 * BundleInfo object to be returned. 646 * @returns { Promise<BundleInfo> } - Returns the BundleInfo object. 647 * @syscap SystemCapability.BundleManager.BundleFramework 648 * @since 7 649 * @deprecated since 9 650 */ 651 function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise<BundleInfo>; 652 653 /** 654 * Obtains the Want for starting the main ability of an application based on the 655 * given bundle name. The main ability of an application is the ability that has the 656 * #ACTION_HOME and #ENTITY_HOME Want 657 * filters set in the application's <b>config.json</b> file. 658 * 659 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 660 * @param { string } bundleName - Indicates the bundle name of the application. 661 * @param { AsyncCallback<Want> } callback 662 * @syscap SystemCapability.BundleManager.BundleFramework 663 * @since 7 664 * @deprecated since 9 665 */ 666 function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback<Want>): void; 667 668 /** 669 * Obtains the Want for starting the main ability of an application based on the 670 * given bundle name. The main ability of an application is the ability that has the 671 * #ACTION_HOME and #ENTITY_HOME Want 672 * filters set in the application's <b>config.json</b> file. 673 * 674 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 675 * @param { string } bundleName - Indicates the bundle name of the application. 676 * @returns { Promise<Want> } Returns the Want for starting the application's main ability if any. 677 * @syscap SystemCapability.BundleManager.BundleFramework 678 * @since 7 679 * @deprecated since 9 680 */ 681 function getLaunchWantForBundle(bundleName: string): Promise<Want>; 682 683 /** 684 * Clears cache data of a specified application. 685 * 686 * @permission ohos.permission.REMOVE_CACHE_FILES 687 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 688 * @param { AsyncCallback<void> } callback Indicates the callback to be invoked for returning the operation result. 689 * @syscap SystemCapability.BundleManager.BundleFramework 690 * @systemapi Hide this for inner system use 691 * @since 8 692 * @deprecated since 9 693 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 694 */ 695 function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void; 696 697 /** 698 * Clears cache data of a specified application. 699 * 700 * @permission ohos.permission.REMOVE_CACHE_FILES 701 * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleared. 702 * @returns { Promise<void> } 703 * @syscap SystemCapability.BundleManager.BundleFramework 704 * @systemapi Hide this for inner system use 705 * @since 8 706 * @deprecated since 9 707 * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles 708 */ 709 function cleanBundleCacheFiles(bundleName: string): Promise<void>; 710 711 /** 712 * Sets whether to enable a specified application. 713 * 714 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 715 * @param { string } bundleName - Indicates the bundle name of the application. 716 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 717 * and the value false means to disable it. 718 * @param { AsyncCallback<void> } callback 719 * @syscap SystemCapability.BundleManager.BundleFramework 720 * @systemapi Hide this for inner system use 721 * @since 8 722 * @deprecated since 9 723 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 724 */ 725 function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; 726 727 /** 728 * Sets whether to enable a specified application. 729 * 730 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 731 * @param { string } bundleName - Indicates the bundle name of the application. 732 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 733 * and the value false means to disable it. 734 * @returns { Promise<void> } 735 * @syscap SystemCapability.BundleManager.BundleFramework 736 * @systemapi Hide this for inner system use 737 * @since 8 738 * @deprecated since 9 739 * @useinstead ohos.bundle.bundleManager#setApplicationEnabled 740 */ 741 function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void>; 742 743 /** 744 * Sets whether to enable a specified ability. 745 * 746 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 747 * @param { AbilityInfo } info - Indicates information about the ability to set. 748 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 749 * and the value false means to disable it. 750 * @param { AsyncCallback<void> } callback 751 * @syscap SystemCapability.BundleManager.BundleFramework 752 * @systemapi Hide this for inner system use 753 * @since 8 754 * @deprecated since 9 755 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 756 */ 757 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void; 758 759 /** 760 * Sets whether to enable a specified ability. 761 * 762 * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE 763 * @param { AbilityInfo } info - Indicates information about the ability to set. 764 * @param { boolean } isEnable - Specifies whether to enable the application. The value true means to enable it, 765 * and the value false means to disable it. 766 * @returns { Promise<void> } 767 * @syscap SystemCapability.BundleManager.BundleFramework 768 * @systemapi Hide this for inner system use 769 * @since 8 770 * @deprecated since 9 771 * @useinstead ohos.bundle.bundleManager#setAbilityEnabled 772 */ 773 function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void>; 774 775 /** 776 * Get the permission details by permissionName. 777 * 778 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 779 * @param { string } permissionName - Indicates permission name. 780 * @param { AsyncCallback<PermissionDef> } callback 781 * @syscap SystemCapability.BundleManager.BundleFramework 782 * @systemapi 783 * @since 8 784 * @deprecated since 9 785 * @useinstead ohos.bundle.bundleManager#getPermissionDef 786 */ 787 function getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void; 788 789 /** 790 * Get the permission details by permissionName. 791 * 792 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 793 * @param { string } permissionName - Indicates permission name. 794 * @returns { Promise<PermissionDef> } Returns permissionDef object. 795 * @syscap SystemCapability.BundleManager.BundleFramework 796 * @systemapi 797 * @since 8 798 * @deprecated since 9 799 * @useinstead ohos.bundle.bundleManager#getPermissionDef 800 */ 801 function getPermissionDef(permissionName: string): Promise<PermissionDef>; 802 803 /** 804 * Obtains the label of a specified ability. 805 * 806 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 807 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 808 * @param { string } abilityName - Indicates the ability name. 809 * @param { AsyncCallback<string> } callback 810 * @syscap SystemCapability.BundleManager.BundleFramework 811 * @since 8 812 * @deprecated since 9 813 */ 814 function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback<string>): void; 815 816 /** 817 * Obtains the label of a specified ability. 818 * 819 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 820 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 821 * @param { string } abilityName - Indicates the ability name. 822 * @returns { Promise<string> } Returns the label representing the label of the specified ability. 823 * @syscap SystemCapability.BundleManager.BundleFramework 824 * @since 8 825 * @deprecated since 9 826 */ 827 function getAbilityLabel(bundleName: string, abilityName: string): Promise<string>; 828 829 /** 830 * Obtains the icon of a specified ability. 831 * 832 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 833 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 834 * @param { string } abilityName - Indicates the ability name. 835 * @param { AsyncCallback<image.PixelMap> } callback 836 * @syscap SystemCapability.BundleManager.BundleFramework 837 * @since 8 838 * @deprecated since 9 839 * @useinstead ohos.resourceManager#getMediaContent 840 */ 841 function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback<image.PixelMap>): void; 842 843 /** 844 * Obtains the icon of a specified ability. 845 * 846 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 847 * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. 848 * @param { string } abilityName - Indicates the ability name. 849 * @returns { Promise<image.PixelMap> } Returns the PixelMap object representing the icon of the specified ability. 850 * @syscap SystemCapability.BundleManager.BundleFramework 851 * @since 8 852 * @deprecated since 9 853 * @useinstead ohos.resourceManager#getMediaContent 854 */ 855 function getAbilityIcon(bundleName: string, abilityName: string): Promise<image.PixelMap>; 856 857 /** 858 * Checks whether a specified ability is enabled. 859 * 860 * @param { AbilityInfo } info - Indicates information about the ability to check. 861 * @param { AsyncCallback<boolean> } callback 862 * @syscap SystemCapability.BundleManager.BundleFramework 863 * @since 8 864 * @deprecated since 9 865 */ 866 function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback<boolean>): void; 867 868 /** 869 * Checks whether a specified ability is enabled. 870 * 871 * @param { AbilityInfo } info - Indicates information about the ability to check. 872 * @returns { Promise<boolean> } Returns true if the ability is enabled; returns false otherwise. 873 * @syscap SystemCapability.BundleManager.BundleFramework 874 * @since 8 875 * @deprecated since 9 876 */ 877 function isAbilityEnabled(info: AbilityInfo): Promise<boolean>; 878 879 /** 880 * Checks whether a specified application is enabled. 881 * 882 * @param { string } bundleName - Indicates the bundle name of the application. 883 * @param { AsyncCallback<boolean> } callback 884 * @syscap SystemCapability.BundleManager.BundleFramework 885 * @since 8 886 * @deprecated since 9 887 */ 888 function isApplicationEnabled(bundleName: string, callback: AsyncCallback<boolean>): void; 889 890 /** 891 * Checks whether a specified application is enabled. 892 * 893 * @param { string } bundleName - Indicates the bundle name of the application. 894 * @returns { Promise<boolean> } Returns true if the application is enabled; returns false otherwise. 895 * @syscap SystemCapability.BundleManager.BundleFramework 896 * @since 8 897 * @deprecated since 9 898 */ 899 function isApplicationEnabled(bundleName: string): Promise<boolean>; 900} 901 902export default bundle; 903