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 { AsyncCallback } from './@ohos.base'; 22/*** if arkts 1.1 */ 23import * as _OverlayModuleInfo from './bundleManager/OverlayModuleInfo'; 24/*** endif */ 25/*** if arkts 1.2 */ 26import { OverlayModuleInfo as _OverlayModuleInfo } from './bundleManager/OverlayModuleInfo'; 27/*** endif */ 28 29/** 30 * Used for application interception overlay 31 * 32 * @namespace overlay 33 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 34 * @since arkts {'1.1':'10', '1.2':'20'} 35 * @arkts 1.1&1.2 36 */ 37declare namespace overlay { 38 /** 39 * Set enabled state of overlay module based on specified moduleName. 40 * 41 * @param { string } moduleName - Indicates the module name of the overlay module to be set. 42 * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. 43 * @param { AsyncCallback<void> } callback - The callback of setting specified overlay module enabled state result. 44 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 45 * @throws { BusinessError } 17700002 - The specified module name is not found. 46 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 47 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 48 * @since arkts {'1.1':'10', '1.2':'20'} 49 * @arkts 1.1&1.2 50 */ 51 function setOverlayEnabled(moduleName: string, isEnabled: boolean, callback: AsyncCallback<void>): void; 52 53 /** 54 * Set enabled state of overlay module based on specified moduleName. 55 * 56 * @param { string } moduleName - Indicates the module name of the overlay module to be set. 57 * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. 58 * @returns { Promise<void> } the promise returned by the function. 59 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 60 * @throws { BusinessError } 17700002 - The specified module name is not found. 61 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 62 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 63 * @since arkts {'1.1':'10', '1.2':'20'} 64 * @arkts 1.1&1.2 65 */ 66 function setOverlayEnabled(moduleName: string, isEnabled: boolean): Promise<void>; 67 68 /** 69 * Set enabled state of overlay module based on specified bundleName and moduleName. 70 * 71 * @permission ohos.permission.CHANGE_OVERLAY_ENABLED_STATE 72 * @param { string } bundleName - Indicates the application bundle name of the overlay bundle to be set. 73 * @param { string } moduleName - Indicates the module name of the overlay module to be set. 74 * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. 75 * @param { AsyncCallback<void> } callback - The callback of setting specified overlay module enabled state result. 76 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 77 * @throws { BusinessError } 201 - Permission denied. 78 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 79 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 80 * @throws { BusinessError } 17700002 - The specified module name is not found. 81 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 82 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 83 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 84 * @systemapi 85 * @since arkts {'1.1':'10', '1.2':'20'} 86 * @arkts 1.1&1.2 87 */ 88 function setOverlayEnabledByBundleName(bundleName: string, 89 moduleName: string, isEnabled: boolean, callback: AsyncCallback<void>): void; 90 91 /** 92 * Set enabled state of overlay module based on specified bundleName and moduleName. 93 * 94 * @permission ohos.permission.CHANGE_OVERLAY_ENABLED_STATE 95 * @param { string } bundleName - Indicates the application bundle name of the overlay bundle to be set. 96 * @param { string } moduleName - Indicates the module name of the overlay module to be set. 97 * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. 98 * @returns { Promise<void> } the promise returned by the function. 99 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 100 * @throws { BusinessError } 201 - Permission denied. 101 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 102 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 103 * @throws { BusinessError } 17700002 - The specified module name is not found. 104 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 105 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 106 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 107 * @systemapi 108 * @since arkts {'1.1':'10', '1.2':'20'} 109 * @arkts 1.1&1.2 110 */ 111 function setOverlayEnabledByBundleName(bundleName: string, moduleName: string, isEnabled: boolean): Promise<void>; 112 113 /** 114 * Obtain the OverlayModuleInfo of current application based on moduleName. 115 * 116 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 117 * @param { AsyncCallback<OverlayModuleInfo> } callback - The callback of getting OverlayModuleInfo object. 118 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 119 * @throws { BusinessError } 17700002 - The specified module name is not found. 120 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 121 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 122 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 123 * @since arkts {'1.1':'10', '1.2':'20'} 124 * @arkts 1.1&1.2 125 */ 126 function getOverlayModuleInfo(moduleName: string, callback: AsyncCallback<OverlayModuleInfo>): void; 127 128 /** 129 * Obtain the OverlayModuleInfo of current application based on moduleName. 130 * 131 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 132 * @returns { Promise<OverlayModuleInfo> } The result of getting OverlayModuleInfo object. 133 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 134 * @throws { BusinessError } 17700002 - The specified module name is not found. 135 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 136 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 137 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 138 * @since arkts {'1.1':'10', '1.2':'20'} 139 * @arkts 1.1&1.2 140 */ 141 function getOverlayModuleInfo(moduleName: string): Promise<OverlayModuleInfo>; 142 143 /** 144 * Obtain the OverlayModuleInfo of current application based on moduleName. 145 * 146 * @param { string } targetModuleName - Indicates the target module name of the target module to be queried. 147 * @param { AsyncCallback<Array<OverlayModuleInfo>> } callback - The callback of getting a list of OverlayModuleInfo object. 148 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 149 * @throws { BusinessError } 17700002 - The specified module name is not found. 150 * @throws { BusinessError } 17700034 - The specified module is an overlay module. 151 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 152 * @since arkts {'1.1':'10', '1.2':'20'} 153 * @arkts 1.1&1.2 154 */ 155 function getTargetOverlayModuleInfos(targetModuleName: string, 156 callback: AsyncCallback<Array<OverlayModuleInfo>>): void; 157 158 /** 159 * Obtain the OverlayModuleInfo of current application based on moduleName. 160 * 161 * @param { string } targetModuleName - Indicates the target module name of the target module to be queried. 162 * @returns { Promise<Array<OverlayModuleInfo>> } Returns a list of OverlayModuleInfo object. 163 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 164 * @throws { BusinessError } 17700002 - The specified module name is not found. 165 * @throws { BusinessError } 17700034 - The specified module is an overlay module. 166 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 167 * @since arkts {'1.1':'10', '1.2':'20'} 168 * @arkts 1.1&1.2 169 */ 170 function getTargetOverlayModuleInfos(targetModuleName: string): Promise<Array<OverlayModuleInfo>>; 171 172 /** 173 * Obtain the OverlayModuleInfo of the specified application based on bundleName. 174 * 175 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 176 * @param { string } bundleName - Indicates the application bundle name of the overlay bundle to be quired. 177 * @param { AsyncCallback<Array<OverlayModuleInfo>> } callback - The callback of getting a list of OverlayModuleInfo object. 178 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 179 * @throws { BusinessError } 201 - Permission denied. 180 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 181 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 182 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 183 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 184 * @systemapi 185 * @since arkts {'1.1':'10', '1.2':'20'} 186 * @arkts 1.1&1.2 187 */ 188 function getOverlayModuleInfoByBundleName(bundleName: string, 189 callback: AsyncCallback<Array<OverlayModuleInfo>>): void; 190 191 /** 192 * Obtain the OverlayModuleInfo of the specified application based on bundleName. 193 * 194 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 195 * @param { string } bundleName - Indicates the application bundle name of the overlay bundle to be quired. 196 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 197 * @param { AsyncCallback<Array<OverlayModuleInfo>> } callback - The callback of getting a list of OverlayModuleInfo object. 198 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 199 * @throws { BusinessError } 201 - Permission denied. 200 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 201 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 202 * @throws { BusinessError } 17700002 - The specified module name is not found. 203 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 204 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 205 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 206 * @systemapi 207 * @since arkts {'1.1':'10', '1.2':'20'} 208 * @arkts 1.1&1.2 209 */ 210 function getOverlayModuleInfoByBundleName(bundleName: string, 211 moduleName: string, callback: AsyncCallback<Array<OverlayModuleInfo>>): void; 212 213 /** 214 * Obtain the OverlayModuleInfo of the specified application based on bundleName and moduleName. 215 * 216 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 217 * @param { string } bundleName - Indicates the application bundle name of the overlay bundle to be quired. 218 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 219 * @returns { Promise<Array<OverlayModuleInfo>> } Returns a list of OverlayModuleInfo object. 220 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 221 * @throws { BusinessError } 201 - Permission denied. 222 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 223 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 224 * @throws { BusinessError } 17700002 - The specified module name is not found. 225 * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. 226 * @throws { BusinessError } 17700033 - The specified module is not an overlay module. 227 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 228 * @systemapi 229 * @since arkts {'1.1':'10', '1.2':'20'} 230 * @arkts 1.1&1.2 231 */ 232 function getOverlayModuleInfoByBundleName(bundleName: string, 233 moduleName?: string): Promise<Array<OverlayModuleInfo>>; 234 235 /** 236 * Obtain the OverlayModuleInfo of the specified target application based on bundleName. 237 * 238 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 239 * @param { string } targetBundleName - Indicates the application target bundle name of the overlay bundle to be quired. 240 * @param { AsyncCallback<Array<OverlayModuleInfo>> } callback - The callback of getting a list of OverlayModuleInfo object. 241 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 242 * @throws { BusinessError } 201 - Permission denied. 243 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 244 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 245 * @throws { BusinessError } 17700035 - The specified bundle is an overlay bundle. 246 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 247 * @systemapi 248 * @since arkts {'1.1':'10', '1.2':'20'} 249 * @arkts 1.1&1.2 250 */ 251 function getTargetOverlayModuleInfosByBundleName(targetBundleName: string, 252 callback: AsyncCallback<Array<OverlayModuleInfo>>): void; 253 254 /** 255 * Obtain the OverlayModuleInfo of the specified target application based on bundleName. 256 * 257 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 258 * @param { string } targetBundleName - Indicates the application target bundle name of the overlay bundle to be quired. 259 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 260 * @param { AsyncCallback<Array<OverlayModuleInfo>> } callback - The callback of getting a list of OverlayModuleInfo object. 261 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 262 * @throws { BusinessError } 201 - Permission denied. 263 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 264 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 265 * @throws { BusinessError } 17700002 - The specified module name is not found. 266 * @throws { BusinessError } 17700034 - The specified module is an overlay module. 267 * @throws { BusinessError } 17700035 - The specified bundle is an overlay bundle. 268 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 269 * @systemapi 270 * @since arkts {'1.1':'10', '1.2':'20'} 271 * @arkts 1.1&1.2 272 */ 273 function getTargetOverlayModuleInfosByBundleName(targetBundleName: string, 274 moduleName: string, callback: AsyncCallback<Array<OverlayModuleInfo>>): void; 275 276 /** 277 * Obtain the OverlayModuleInfo of the specified target application based on bundleName and moduleName. 278 * 279 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 280 * @param { string } targetBundleName - Indicates the application target bundle name of the overlay bundle to be quired. 281 * @param { string } moduleName - Indicates the module name of the overlay module to be queried. 282 * @returns { Promise<Array<OverlayModuleInfo>> } Returns a list of OverlayModuleInfo object. 283 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 284 * @throws { BusinessError } 201 - Permission denied. 285 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 286 * @throws { BusinessError } 17700001 - The specified bundleName is not found. 287 * @throws { BusinessError } 17700002 - The specified module name is not found. 288 * @throws { BusinessError } 17700034 - The specified module is an overlay module. 289 * @throws { BusinessError } 17700035 - The specified bundle is an overlay bundle. 290 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 291 * @systemapi 292 * @since arkts {'1.1':'10', '1.2':'20'} 293 * @arkts 1.1&1.2 294 */ 295 function getTargetOverlayModuleInfosByBundleName(targetBundleName: string, 296 moduleName?: string): Promise<Array<OverlayModuleInfo>>; 297 298 /** 299 * Obtains configuration information about a overlay hap module. 300 * 301 * @typedef { _OverlayModuleInfo.OverlayModuleInfo } 302 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 303 * @since 10 304 */ 305 export type OverlayModuleInfo = _OverlayModuleInfo.OverlayModuleInfo; 306 307 /** 308 * Obtains configuration information about a overlay hap module. 309 * 310 * @typedef { _OverlayModuleInfo } 311 * @syscap SystemCapability.BundleManager.BundleFramework.Overlay 312 * @since 20 313 * @arkts 1.2 314 */ 315 export type OverlayModuleInfo = _OverlayModuleInfo; 316} 317 318export default overlay; 319