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