1/* 2 * Copyright (c) 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 type { AsyncCallback } from './@ohos.base'; 17import type * as _BusinessAbilityInfo from './application/BusinessAbilityInfo'; 18 19/** 20 * This module is used to obtain business ability information of various applications installed on the current device. 21 * 22 * @namespace businessAbilityRouter 23 * @syscap SystemCapability.Ability.AbilityRuntime.Core 24 * @systemapi 25 * @since 10 26 */ 27declare namespace businessAbilityRouter { 28 /** 29 * This enumeration value is used to identify various types of business ability info 30 * 31 * @enum { number } 32 * @syscap SystemCapability.Ability.AbilityRuntime.Core 33 * @systemapi 34 * @since 10 35 */ 36 export enum BusinessType { 37 /** 38 * Indicates business ability info with type of share 39 * 40 * @syscap SystemCapability.Ability.AbilityRuntime.Core 41 * @systemapi 42 * @since 10 43 */ 44 SHARE = 0, 45 46 /** 47 * Indicates business ability info with type of unspecified 48 * 49 * @syscap SystemCapability.Ability.AbilityRuntime.Core 50 * @systemapi 51 * @since 10 52 */ 53 UNSPECIFIED = 255 54 } 55 56 /** 57 * This filter value is used to filter business ability info 58 * 59 * @typedef BusinessAbilityFilter 60 * @syscap SystemCapability.Ability.AbilityRuntime.Core 61 * @systemapi 62 * @since 10 63 */ 64 export interface BusinessAbilityFilter { 65 /** 66 * Indicates the type of business ability info 67 * 68 * @type { BusinessType } 69 * @syscap SystemCapability.Ability.AbilityRuntime.Core 70 * @systemapi 71 * @since 10 72 */ 73 businessType: BusinessType; 74 75 /** 76 * Indicates the supported mime type of business ability info 77 * 78 * @type { ?string } 79 * @syscap SystemCapability.Ability.AbilityRuntime.Core 80 * @systemapi 81 * @since 10 82 */ 83 mimeType?: string; 84 85 /** 86 * Indicates the supported uri of business ability info 87 * 88 * @type { ?string } 89 * @syscap SystemCapability.Ability.AbilityRuntime.Core 90 * @systemapi 91 * @since 10 92 */ 93 uri?: string; 94 } 95 96 /** 97 * Query the business ability info of by the given filter. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required 98 * for cross user access. 99 * 100 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 101 * @param { BusinessAbilityFilter } filter - Indicates the filter containing the business ability info to be queried. 102 * @param { AsyncCallback<Array<BusinessAbilityInfo>> } callback - The callback of querying business ability info 103 * result. 104 * @throws { BusinessError } 201 - Permission denied. 105 * @throws { BusinessError } 202 - non-system app called system api. 106 * @throws { BusinessError } 401 - The parameter check failed. 107 * @syscap SystemCapability.Ability.AbilityRuntime.Core 108 * @systemapi 109 * @since 10 110 */ 111 function queryBusinessAbilityInfo( 112 filter: BusinessAbilityFilter, 113 callback: AsyncCallback<Array<BusinessAbilityInfo>> 114 ): void; 115 116 /** 117 * Query the business ability info of by the given filter. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required 118 * for cross user access. 119 * 120 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 121 * @param { BusinessAbilityFilter } filter - Indicates the filter containing the business ability info to be queried. 122 * @returns { Promise<Array<BusinessAbilityInfo>> } Returns a list of business ability info objects. 123 * @throws { BusinessError } 201 - Permission denied. 124 * @throws { BusinessError } 202 - non-system app called system api. 125 * @throws { BusinessError } 401 - The parameter check failed. 126 * @syscap SystemCapability.Ability.AbilityRuntime.Core 127 * @systemapi 128 * @since 10 129 */ 130 function queryBusinessAbilityInfo(filter: BusinessAbilityFilter): Promise<Array<BusinessAbilityInfo>>; 131 132 /** 133 * Obtains business ability info. 134 * 135 * @syscap SystemCapability.Ability.AbilityRuntime.Core 136 * @systemapi 137 * @since 10 138 */ 139 export type BusinessAbilityInfo = _BusinessAbilityInfo.BusinessAbilityInfo; 140} 141 142export default businessAbilityRouter; 143