• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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 { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant, ParameterItem as _ParameterItem } from './bundleManager/ShortcutInfo';
22
23/**
24 * Desktop shortcut bundle manager.
25 *
26 * @namespace shortcutManager
27 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
28 * @systemapi
29 * @since 12
30 */
31declare namespace shortcutManager {
32  /**
33   * Add desktop shortcut info.
34   *
35   * @permission ohos.permission.MANAGE_SHORTCUTS
36   * @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want.
37   * @param { number } userId - Indicates the id for the user.
38   * @returns { Promise<void> } the promise returned by the function.
39   * @throws { BusinessError } 201 - Verify permission denied.
40   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
41   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
42   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
43   * @throws { BusinessError } 17700004 - The specified user ID is not found.
44   * @throws { BusinessError } 17700026 - The specified bundle is disabled.
45   * @throws { BusinessError } 17700061 - The specified app index is invalid.
46   * @throws { BusinessError } 17700070 - The specified shortcut id is illegal.
47   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
48   * @systemapi
49   * @since 12
50   */
51  function addDesktopShortcutInfo(shortcutInfo: ShortcutInfo, userId: number): Promise<void>;
52
53  /**
54   * Delete desktop shortcut info.
55   *
56   * @permission ohos.permission.MANAGE_SHORTCUTS
57   * @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want.
58   * @param { number } userId - Indicates the id for the user.
59   * @returns { Promise<void> } the promise returned by the function.
60   * @throws { BusinessError } 201 - Verify permission denied.
61   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
62   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
63   * @throws { BusinessError } 17700004 - The specified user ID is not found.
64   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
65   * @systemapi
66   * @since 12
67   */
68  function deleteDesktopShortcutInfo(shortcutInfo: ShortcutInfo, userId: number): Promise<void>;
69
70  /**
71   * Get all desktop shortcut info.
72   *
73   * @permission ohos.permission.MANAGE_SHORTCUTS
74   * @param { number } userId - Indicates the id for the user.
75   * @returns { Promise<Array<ShortcutInfo>> } the LauncherShortcutInfo object.
76   * @throws { BusinessError } 201 - Verify permission denied.
77   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
78   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
79   * @throws { BusinessError } 17700004 - The specified user ID is not found.
80   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
81   * @systemapi
82   * @since 12
83   */
84  function getAllDesktopShortcutInfo(userId: number): Promise<Array<ShortcutInfo>>;
85
86  /**
87   * Provides information about a shortcut, including the shortcut ID and label.
88   *
89   * @typedef { _ShortcutInfo }
90   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
91   * @systemapi
92   * @since 12
93   */
94  export type ShortcutInfo = _ShortcutInfo;
95  /**
96   * Obtains information about the ability that a shortcut will start.
97   *
98   * @typedef { _ShortcutWant }
99   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
100   * @systemapi
101   * @since 12
102   */
103  export type ShortcutWant = _ShortcutWant;
104  /**
105   * Indicates the custom parameters in shortcut want.
106   *
107   * @typedef { _ParameterItem }
108   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
109   * @systemapi
110   * @since 12
111   */
112  export type ParameterItem = _ParameterItem;
113  }
114
115  export default shortcutManager;
116