• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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 { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundleManager/LauncherAbilityInfo';
18import { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant } from './bundleManager/ShortcutInfo';
19
20/**
21 * Launcher bundle manager.
22 *
23 * @namespace launcherBundleManager
24 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
25 * @systemapi
26 * @since 9
27 */
28declare namespace launcherBundleManager {
29  /**
30   * Obtains launcher abilities info based on a given bundleName and userId.
31   *
32   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
33   * @param { string } bundleName - Indicates the application bundle name to be queried.
34   * @param { number } userId - Indicates the id for the user.
35   * @param { AsyncCallback<Array<LauncherAbilityInfo>> } callback -The callback of the LauncherAbilityInfo object result.
36   * @throws { BusinessError } 201 - Verify permission denied.
37   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
38   * @throws { BusinessError } 401 - The parameter check failed.
39   * @throws { BusinessError } 801 - Capability not support.
40   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
41   * @throws { BusinessError } 17700004 - The specified user ID is not found.
42   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
43   * @systemapi
44   * @since 9
45   */
46  function getLauncherAbilityInfo(bundleName: string,
47    userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>): void;
48
49  /**
50   * Obtains launcher abilities info based on a given bundleName and userId.
51   *
52   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
53   * @param { string } bundleName - Indicates the application bundle name to be queried.
54   * @param { number } userId - Indicates the id for the user.
55   * @returns { Promise<Array<LauncherAbilityInfo>> } the LauncherAbilityInfo object.
56   * @throws { BusinessError } 201 - Verify permission denied.
57   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
58   * @throws { BusinessError } 401 - The parameter check failed.
59   * @throws { BusinessError } 801 - Capability not support.
60   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
61   * @throws { BusinessError } 17700004 - The specified user ID is not found.
62   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
63   * @systemapi
64   * @since 9
65   */
66  function getLauncherAbilityInfo(bundleName: string, userId: number): Promise<Array<LauncherAbilityInfo>>;
67
68  /**
69   * Obtains launcher abilities info based on a given bundleName and userId.
70   *
71   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
72   * @param { string } bundleName - Indicates the application bundle name to be queried.
73   * @param { number } userId - Indicates the id for the user.
74   * @returns { Array<LauncherAbilityInfo> } the LauncherAbilityInfo object.
75   * @throws { BusinessError } 201 - Verify permission denied.
76   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
77   * @throws { BusinessError } 401 - The parameter check failed.
78   * @throws { BusinessError } 801 - Capability not support.
79   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
80   * @throws { BusinessError } 17700004 - The specified user ID is not found.
81   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
82   * @systemapi
83   * @since 10
84   */
85  function getLauncherAbilityInfoSync(bundleName: string, userId: number): Array<LauncherAbilityInfo>;
86
87  /**
88   * Obtains launcher abilities info based on a given userId.
89   *
90   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
91   * @param { number } userId - Indicates the id for the user.
92   * @param { AsyncCallback<Array<LauncherAbilityInfo>> } callback -The callback of the LauncherAbilityInfo object result.
93   * @throws { BusinessError } 201 - Verify permission denied.
94   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
95   * @throws { BusinessError } 401 - The parameter check failed.
96   * @throws { BusinessError } 801 - Capability not support.
97   * @throws { BusinessError } 17700004 - The specified user ID is not found.
98   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
99   * @systemapi
100   * @since 9
101   */
102  function getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>): void;
103
104  /**
105   * Obtains launcher abilities info based on a given userId.
106   *
107   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
108   * @param { number } userId - Indicates the id for the user.
109   * @returns { Promise<Array<LauncherAbilityInfo>> } the LauncherAbilityInfo object.
110   * @throws { BusinessError } 201 - Verify permission denied.
111   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
112   * @throws { BusinessError } 401 - The parameter check failed.
113   * @throws { BusinessError } 801 - Capability not support.
114   * @throws { BusinessError } 17700004 - The specified user ID is not found.
115   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
116   * @systemapi
117   * @since 9
118   */
119  function getAllLauncherAbilityInfo(userId: number): Promise<Array<LauncherAbilityInfo>>;
120
121  /**
122   * Obtains shortcut info based on a given bundleName.
123   *
124   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
125   * @param { string } bundleName - Indicates the application bundle name to be queried.
126   * @param { AsyncCallback<Array<ShortcutInfo>> } callback -The callback of the ShortcutInfo object result.
127   * @throws { BusinessError } 201 - Verify permission denied.
128   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
129   * @throws { BusinessError } 401 - The parameter check failed.
130   * @throws { BusinessError } 801 - Capability not support.
131   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
132   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
133   * @systemapi
134   * @since 9
135   */
136  function getShortcutInfo(bundleName: string, callback: AsyncCallback<Array<ShortcutInfo>>): void;
137
138  /**
139   * Obtains shortcut info based on a given bundleName.
140   *
141   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
142   * @param { string } bundleName - Indicates the application bundle name to be queried.
143   * @returns { Promise<Array<ShortcutInfo>> } the LauncherShortcutInfo object.
144   * @throws { BusinessError } 201 - Verify permission denied.
145   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
146   * @throws { BusinessError } 401 - The parameter check failed.
147   * @throws { BusinessError } 801 - Capability not support.
148   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
149   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
150   * @systemapi
151   * @since 9
152   */
153  function getShortcutInfo(bundleName: string): Promise<Array<ShortcutInfo>>;
154
155  /**
156   * Obtains shortcut info based on a given bundleName.
157   *
158   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
159   * @param { string } bundleName - Indicates the application bundle name to be queried.
160   * @returns { Array<ShortcutInfo> } the LauncherShortcutInfo object.
161   * @throws { BusinessError } 201 - Verify permission denied.
162   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
163   * @throws { BusinessError } 401 - The parameter check failed.
164   * @throws { BusinessError } 801 - Capability not support.
165   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
166   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
167   * @systemapi
168   * @since 10
169   */
170  function getShortcutInfoSync(bundleName: string): Array<ShortcutInfo>;
171
172  /**
173   * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo.
174   *
175   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
176   * @systemapi
177   * @since 9
178   */
179  export type LauncherAbilityInfo = _LauncherAbilityInfo;
180
181  /**
182   * Provides information about a shortcut, including the shortcut ID and label.
183   *
184   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
185   * @systemapi
186   * @since 9
187   */
188  export type ShortcutInfo = _ShortcutInfo;
189  /**
190   * Obtains information about the ability that a shortcut will start.
191   *
192   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
193   * @systemapi
194   * @since 9
195   */
196  export type ShortcutWant = _ShortcutWant;
197}
198
199export default launcherBundleManager;
200