strengthen static shortcut

Signed-off-by: zhaogan <zhaogan2@huawei.com>
This commit is contained in:
zhaogan 2024-04-08 14:25:49 +08:00
parent c745bbf6fa
commit 9b5a20fed6
2 changed files with 62 additions and 0 deletions

View File

@ -21,6 +21,7 @@
import { AsyncCallback } from './@ohos.base';
import { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundleManager/LauncherAbilityInfo';
import { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant } from './bundleManager/ShortcutInfo';
import { StartOptions } from './@ohos.app.ability.StartOptions';
/**
* Launcher bundle manager.
@ -174,6 +175,24 @@ declare namespace launcherBundleManager {
*/
function getShortcutInfoSync(bundleName: string): Array<ShortcutInfo>;
/**
* Starts shortcut.
*
* @permission ohos.permission.START_SHORTCUT
* @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want.
* @param { StartOptions } [options] - Indicates the start options.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 201 - Verify permission denied.
* @throws { BusinessError } 202 - Permission denied, non-system app called system api.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not support.
* @throws { BusinessError } 17700065 - The specified shortcut want in shortcut info is not supported to be started.
* @syscap SystemCapability.BundleManager.BundleFramework.Launcher
* @systemapi
* @since 12
*/
function startShortcut(shortcutInfo: ShortcutInfo, options?: StartOptions): Promise<void>;
/**
* Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo.
*

View File

@ -156,4 +156,47 @@ export interface ShortcutWant {
* @since 9
*/
readonly targetAbility: string;
/**
* Indicates the parameters of the shortcut want
*
* @type { Array<ParameterItem> }
* @readonly
* @syscap SystemCapability.BundleManager.BundleFramework.Launcher
* @systemapi
* @since 12
*/
readonly parameters: Array<ParameterItem>;
}
/**
* Obtains information about the ability that a shortcut will start.
*
* @typedef ParameterItem
* @syscap SystemCapability.BundleManager.BundleFramework.Launcher
* @systemapi
* @since 12
*/
export interface ParameterItem {
/**
* Indicates the key of the parameter item.
*
* @type { string }
* @readonly
* @syscap SystemCapability.BundleManager.BundleFramework.Launcher
* @systemapi
* @since 12
*/
readonly key: string;
/**
* Indicates the value of the parameter item.
*
* @type { string }
* @readonly
* @syscap SystemCapability.BundleManager.BundleFramework.Launcher
* @systemapi
* @since 12
*/
readonly value: string;
}