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