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 */ 31/** 32 * Desktop shortcut bundle manager. 33 * 34 * @namespace shortcutManager 35 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 36 * @since 20 37 * @arkts 1.1&1.2 38 */ 39declare namespace shortcutManager { 40 /** 41 * Add desktop shortcut info. 42 * 43 * @permission ohos.permission.MANAGE_SHORTCUTS 44 * @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want. 45 * @param { number } userId - Indicates the id for the user. 46 * @returns { Promise<void> } the promise returned by the function. 47 * @throws { BusinessError } 201 - Verify permission denied. 48 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 49 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 50 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 51 * @throws { BusinessError } 17700004 - The specified user ID is not found. 52 * @throws { BusinessError } 17700026 - The specified bundle is disabled. 53 * @throws { BusinessError } 17700061 - The specified app index is invalid. 54 * @throws { BusinessError } 17700070 - The specified shortcut id is illegal. 55 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 56 * @systemapi 57 * @since arkts {'1.1':'12', '1.2':'20'} 58 * @arkts 1.1&1.2 59 */ 60 function addDesktopShortcutInfo(shortcutInfo: ShortcutInfo, userId: number): Promise<void>; 61 62 /** 63 * Delete desktop shortcut info. 64 * 65 * @permission ohos.permission.MANAGE_SHORTCUTS 66 * @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want. 67 * @param { number } userId - Indicates the id for the user. 68 * @returns { Promise<void> } the promise returned by the function. 69 * @throws { BusinessError } 201 - Verify permission denied. 70 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 71 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 72 * @throws { BusinessError } 17700004 - The specified user ID is not found. 73 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 74 * @systemapi 75 * @since arkts {'1.1':'12', '1.2':'20'} 76 * @arkts 1.1&1.2 77 */ 78 function deleteDesktopShortcutInfo(shortcutInfo: ShortcutInfo, userId: number): Promise<void>; 79 80 /** 81 * Get all desktop shortcut info. 82 * 83 * @permission ohos.permission.MANAGE_SHORTCUTS 84 * @param { number } userId - Indicates the id for the user. 85 * @returns { Promise<Array<ShortcutInfo>> } the LauncherShortcutInfo object. 86 * @throws { BusinessError } 201 - Verify permission denied. 87 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 88 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 89 * @throws { BusinessError } 17700004 - The specified user ID is not found. 90 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 91 * @systemapi 92 * @since arkts {'1.1':'12', '1.2':'20'} 93 * @arkts 1.1&1.2 94 */ 95 function getAllDesktopShortcutInfo(userId: number): Promise<Array<ShortcutInfo>>; 96 97 /** 98 * Set a shortcut of current application is visible or invisible. 99 * 100 * @param { string } id - Indicates id of shortcut to set. 101 * @param { boolean } visible - The value true means to set the shortcut visible, otherwise set the shortcut invisible. 102 * @returns { Promise<void> } The promise returned by the function. 103 * @throws { BusinessError } 17700070 - The specified shortcut id is illegal. 104 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 105 * @since 20 106 */ 107 function setShortcutVisibleForSelf(id: string, visible: boolean): Promise<void>; 108 109 /** 110 * Obtains all shortcut info of the application. 111 * 112 * @returns { Promise<Array<ShortcutInfo>> } The LauncherShortcutInfo object. 113 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 114 * @since 20 115 */ 116 function getAllShortcutInfoForSelf(): Promise<Array<ShortcutInfo>>; 117 118 /** 119 * Provides information about a shortcut, including the shortcut ID and label. 120 * 121 * @typedef { _ShortcutInfo } 122 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 123 * @systemapi 124 * @since 12 125 */ 126 /** 127 * Provides information about a shortcut, including the shortcut ID and label. 128 * 129 * @typedef { _ShortcutInfo } 130 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 131 * @since 20 132 * @arkts 1.1&1.2 133 */ 134 export type ShortcutInfo = _ShortcutInfo; 135 /** 136 * Obtains information about the ability that a shortcut will start. 137 * 138 * @typedef { _ShortcutWant } 139 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 140 * @systemapi 141 * @since 12 142 */ 143 /** 144 * Obtains information about the ability that a shortcut will start. 145 * 146 * @typedef { _ShortcutWant } 147 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 148 * @since 20 149 * @arkts 1.1&1.2 150 */ 151 export type ShortcutWant = _ShortcutWant; 152 /** 153 * Indicates the custom parameters in shortcut want. 154 * 155 * @typedef { _ParameterItem } 156 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 157 * @systemapi 158 * @since 12 159 */ 160 /** 161 * Indicates the custom parameters in shortcut want. 162 * 163 * @typedef { _ParameterItem } 164 * @syscap SystemCapability.BundleManager.BundleFramework.Launcher 165 * @since 20 166 * @arkts 1.1&1.2 167 */ 168 export type ParameterItem = _ParameterItem; 169 } 170 171 export default shortcutManager; 172