161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit AbilityKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundleManager/LauncherAbilityInfo';
2361847f8eSopenharmony_ciimport { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant, ParameterItem as _ParameterItem } from './bundleManager/ShortcutInfo';
2461847f8eSopenharmony_ciimport { StartOptions } from './@ohos.app.ability.StartOptions';
2561847f8eSopenharmony_ci
2661847f8eSopenharmony_ci/**
2761847f8eSopenharmony_ci * Launcher bundle manager.
2861847f8eSopenharmony_ci *
2961847f8eSopenharmony_ci * @namespace launcherBundleManager
3061847f8eSopenharmony_ci * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
3161847f8eSopenharmony_ci * @systemapi
3261847f8eSopenharmony_ci * @since 9
3361847f8eSopenharmony_ci */
3461847f8eSopenharmony_cideclare namespace launcherBundleManager {
3561847f8eSopenharmony_ci  /**
3661847f8eSopenharmony_ci   * Obtains launcher abilities info based on a given bundleName and userId.
3761847f8eSopenharmony_ci   *
3861847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
3961847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
4061847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
4161847f8eSopenharmony_ci   * @param { AsyncCallback<Array<LauncherAbilityInfo>> } callback -The callback of the LauncherAbilityInfo object result.
4261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
4361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
4461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
4561847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
4661847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
4761847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
4861847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
4961847f8eSopenharmony_ci   * @systemapi
5061847f8eSopenharmony_ci   * @since 9
5161847f8eSopenharmony_ci   */
5261847f8eSopenharmony_ci  function getLauncherAbilityInfo(bundleName: string,
5361847f8eSopenharmony_ci    userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>): void;
5461847f8eSopenharmony_ci
5561847f8eSopenharmony_ci  /**
5661847f8eSopenharmony_ci   * Obtains launcher abilities info based on a given bundleName and userId.
5761847f8eSopenharmony_ci   *
5861847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
5961847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
6061847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
6161847f8eSopenharmony_ci   * @returns { Promise<Array<LauncherAbilityInfo>> } the LauncherAbilityInfo object.
6261847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
6361847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
6461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
6561847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
6661847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
6761847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
6861847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
6961847f8eSopenharmony_ci   * @systemapi
7061847f8eSopenharmony_ci   * @since 9
7161847f8eSopenharmony_ci   */
7261847f8eSopenharmony_ci  function getLauncherAbilityInfo(bundleName: string, userId: number): Promise<Array<LauncherAbilityInfo>>;
7361847f8eSopenharmony_ci
7461847f8eSopenharmony_ci  /**
7561847f8eSopenharmony_ci   * Obtains launcher abilities info based on a given bundleName and userId.
7661847f8eSopenharmony_ci   *
7761847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
7861847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
7961847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
8061847f8eSopenharmony_ci   * @returns { Array<LauncherAbilityInfo> } the LauncherAbilityInfo object.
8161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
8261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
8361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
8461847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
8561847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
8661847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
8761847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
8861847f8eSopenharmony_ci   * @systemapi
8961847f8eSopenharmony_ci   * @since 10
9061847f8eSopenharmony_ci   */
9161847f8eSopenharmony_ci  function getLauncherAbilityInfoSync(bundleName: string, userId: number): Array<LauncherAbilityInfo>;
9261847f8eSopenharmony_ci
9361847f8eSopenharmony_ci  /**
9461847f8eSopenharmony_ci   * Obtains launcher abilities info based on a given userId.
9561847f8eSopenharmony_ci   *
9661847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
9761847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
9861847f8eSopenharmony_ci   * @param { AsyncCallback<Array<LauncherAbilityInfo>> } callback -The callback of the LauncherAbilityInfo object result.
9961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
10061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
10161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
10261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
10361847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
10461847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
10561847f8eSopenharmony_ci   * @systemapi
10661847f8eSopenharmony_ci   * @since 9
10761847f8eSopenharmony_ci   */
10861847f8eSopenharmony_ci  function getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>): void;
10961847f8eSopenharmony_ci
11061847f8eSopenharmony_ci  /**
11161847f8eSopenharmony_ci   * Obtains launcher abilities info based on a given userId.
11261847f8eSopenharmony_ci   *
11361847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
11461847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
11561847f8eSopenharmony_ci   * @returns { Promise<Array<LauncherAbilityInfo>> } the LauncherAbilityInfo object.
11661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
11761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
11861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
11961847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
12061847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
12161847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
12261847f8eSopenharmony_ci   * @systemapi
12361847f8eSopenharmony_ci   * @since 9
12461847f8eSopenharmony_ci   */
12561847f8eSopenharmony_ci  function getAllLauncherAbilityInfo(userId: number): Promise<Array<LauncherAbilityInfo>>;
12661847f8eSopenharmony_ci
12761847f8eSopenharmony_ci  /**
12861847f8eSopenharmony_ci   * Obtains shortcut info based on a given bundleName.
12961847f8eSopenharmony_ci   *
13061847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
13161847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
13261847f8eSopenharmony_ci   * @param { AsyncCallback<Array<ShortcutInfo>> } callback -The callback of the ShortcutInfo object result.
13361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
13461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
13561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
13661847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
13761847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
13861847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
13961847f8eSopenharmony_ci   * @systemapi
14061847f8eSopenharmony_ci   * @since 9
14161847f8eSopenharmony_ci   */
14261847f8eSopenharmony_ci  function getShortcutInfo(bundleName: string, callback: AsyncCallback<Array<ShortcutInfo>>): void;
14361847f8eSopenharmony_ci
14461847f8eSopenharmony_ci  /**
14561847f8eSopenharmony_ci   * Obtains shortcut info based on a given bundleName.
14661847f8eSopenharmony_ci   *
14761847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
14861847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
14961847f8eSopenharmony_ci   * @returns { Promise<Array<ShortcutInfo>> } the LauncherShortcutInfo object.
15061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
15161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
15261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
15361847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
15461847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
15561847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
15661847f8eSopenharmony_ci   * @systemapi
15761847f8eSopenharmony_ci   * @since 9
15861847f8eSopenharmony_ci   */
15961847f8eSopenharmony_ci  function getShortcutInfo(bundleName: string): Promise<Array<ShortcutInfo>>;
16061847f8eSopenharmony_ci
16161847f8eSopenharmony_ci  /**
16261847f8eSopenharmony_ci   * Obtains shortcut info based on a given bundleName.
16361847f8eSopenharmony_ci   *
16461847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
16561847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
16661847f8eSopenharmony_ci   * @returns { Array<ShortcutInfo> } the LauncherShortcutInfo object.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
16961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
17061847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
17161847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
17261847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
17361847f8eSopenharmony_ci   * @systemapi
17461847f8eSopenharmony_ci   * @since 10
17561847f8eSopenharmony_ci   */
17661847f8eSopenharmony_ci  function getShortcutInfoSync(bundleName: string): Array<ShortcutInfo>;
17761847f8eSopenharmony_ci
17861847f8eSopenharmony_ci
17961847f8eSopenharmony_ci  /**
18061847f8eSopenharmony_ci   * Obtains shortcut info based on bundleName and userId.
18161847f8eSopenharmony_ci   *
18261847f8eSopenharmony_ci   * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
18361847f8eSopenharmony_ci   * @param { string } bundleName - Indicates the application bundle name to be queried.
18461847f8eSopenharmony_ci   * @param { number } userId - Indicates the user ID.
18561847f8eSopenharmony_ci   * @returns { Array<ShortcutInfo> } the LauncherShortcutInfo object.
18661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
18761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
18861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
18961847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
19061847f8eSopenharmony_ci   * @throws { BusinessError } 17700001 - The specified bundle name is not found.
19161847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
19261847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
19361847f8eSopenharmony_ci   * @systemapi
19461847f8eSopenharmony_ci   * @since 13
19561847f8eSopenharmony_ci   */
19661847f8eSopenharmony_ci  function getShortcutInfoSync(bundleName: string, userId: number): Array<ShortcutInfo>;
19761847f8eSopenharmony_ci
19861847f8eSopenharmony_ci  /**
19961847f8eSopenharmony_ci   * Starts shortcut.
20061847f8eSopenharmony_ci   *
20161847f8eSopenharmony_ci   * @permission ohos.permission.START_SHORTCUT
20261847f8eSopenharmony_ci   * @param { ShortcutInfo } shortcutInfo - Indicates the shortcut info which contains shortcut want.
20361847f8eSopenharmony_ci   * @param { StartOptions } [options] - Indicates the start options.
20461847f8eSopenharmony_ci   * @returns { Promise<void> } the promise returned by the function.
20561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Verify permission denied.
20661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
20761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
20861847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not support.
20961847f8eSopenharmony_ci   * @throws { BusinessError } 17700065 - The specified shortcut want in shortcut info is not supported to be started.
21061847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
21161847f8eSopenharmony_ci   * @systemapi
21261847f8eSopenharmony_ci   * @since 12
21361847f8eSopenharmony_ci   */
21461847f8eSopenharmony_ci  function startShortcut(shortcutInfo: ShortcutInfo, options?: StartOptions): Promise<void>;
21561847f8eSopenharmony_ci
21661847f8eSopenharmony_ci  /**
21761847f8eSopenharmony_ci   * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo.
21861847f8eSopenharmony_ci   *
21961847f8eSopenharmony_ci   * @typedef { _LauncherAbilityInfo }
22061847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
22161847f8eSopenharmony_ci   * @systemapi
22261847f8eSopenharmony_ci   * @since 9
22361847f8eSopenharmony_ci   */
22461847f8eSopenharmony_ci  export type LauncherAbilityInfo = _LauncherAbilityInfo;
22561847f8eSopenharmony_ci
22661847f8eSopenharmony_ci  /**
22761847f8eSopenharmony_ci   * Provides information about a shortcut, including the shortcut ID and label.
22861847f8eSopenharmony_ci   *
22961847f8eSopenharmony_ci   * @typedef { _ShortcutInfo }
23061847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
23161847f8eSopenharmony_ci   * @systemapi
23261847f8eSopenharmony_ci   * @since 9
23361847f8eSopenharmony_ci   */
23461847f8eSopenharmony_ci  export type ShortcutInfo = _ShortcutInfo;
23561847f8eSopenharmony_ci  /**
23661847f8eSopenharmony_ci   * Obtains information about the ability that a shortcut will start.
23761847f8eSopenharmony_ci   *
23861847f8eSopenharmony_ci   * @typedef { _ShortcutWant }
23961847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
24061847f8eSopenharmony_ci   * @systemapi
24161847f8eSopenharmony_ci   * @since 9
24261847f8eSopenharmony_ci   */
24361847f8eSopenharmony_ci  export type ShortcutWant = _ShortcutWant;
24461847f8eSopenharmony_ci  /**
24561847f8eSopenharmony_ci   * Indicates the custom parameters in shortcut want.
24661847f8eSopenharmony_ci   *
24761847f8eSopenharmony_ci   * @typedef { _ParameterItem }
24861847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.Launcher
24961847f8eSopenharmony_ci   * @systemapi
25061847f8eSopenharmony_ci   * @since 12
25161847f8eSopenharmony_ci   */
25261847f8eSopenharmony_ci  export type ParameterItem = _ParameterItem;
25361847f8eSopenharmony_ci}
25461847f8eSopenharmony_ci
25561847f8eSopenharmony_ciexport default launcherBundleManager;
256