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