161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2022-2024 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 { BundleInfo } from './bundleManager/BundleInfo';
2361847f8eSopenharmony_ciimport { ElementName } from './bundleManager/ElementName';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * Default application manager.
2761847f8eSopenharmony_ci *
2861847f8eSopenharmony_ci * @namespace defaultAppManager
2961847f8eSopenharmony_ci * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
3061847f8eSopenharmony_ci * @since 9
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_cideclare namespace defaultAppManager {
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * The constant for application type.
3561847f8eSopenharmony_ci   *
3661847f8eSopenharmony_ci   * @enum { number }
3761847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
3861847f8eSopenharmony_ci   * @since 9
3961847f8eSopenharmony_ci   */
4061847f8eSopenharmony_ci  export enum ApplicationType {
4161847f8eSopenharmony_ci    /**
4261847f8eSopenharmony_ci     * Default browser identifier.
4361847f8eSopenharmony_ci     *
4461847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
4561847f8eSopenharmony_ci     * @since 9
4661847f8eSopenharmony_ci     */
4761847f8eSopenharmony_ci    BROWSER = 'Web Browser',
4861847f8eSopenharmony_ci    /**
4961847f8eSopenharmony_ci     * Default image identifier.
5061847f8eSopenharmony_ci     *
5161847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
5261847f8eSopenharmony_ci     * @since 9
5361847f8eSopenharmony_ci     */
5461847f8eSopenharmony_ci    IMAGE = 'Image Gallery',
5561847f8eSopenharmony_ci    /**
5661847f8eSopenharmony_ci     * Default audio identifier.
5761847f8eSopenharmony_ci     *
5861847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
5961847f8eSopenharmony_ci     * @since 9
6061847f8eSopenharmony_ci     */
6161847f8eSopenharmony_ci    AUDIO = 'Audio Player',
6261847f8eSopenharmony_ci    /**
6361847f8eSopenharmony_ci     * Default video identifier.
6461847f8eSopenharmony_ci     *
6561847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
6661847f8eSopenharmony_ci     * @since 9
6761847f8eSopenharmony_ci     */
6861847f8eSopenharmony_ci    VIDEO = 'Video Player',
6961847f8eSopenharmony_ci    /**
7061847f8eSopenharmony_ci     * Default PDF identifier.
7161847f8eSopenharmony_ci     *
7261847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
7361847f8eSopenharmony_ci     * @since 9
7461847f8eSopenharmony_ci     */
7561847f8eSopenharmony_ci    PDF = 'PDF Viewer',
7661847f8eSopenharmony_ci    /**
7761847f8eSopenharmony_ci     * Default word identifier.
7861847f8eSopenharmony_ci     *
7961847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
8061847f8eSopenharmony_ci     * @since 9
8161847f8eSopenharmony_ci     */
8261847f8eSopenharmony_ci    WORD = 'Word Viewer',
8361847f8eSopenharmony_ci    /**
8461847f8eSopenharmony_ci     * Default excel identifier.
8561847f8eSopenharmony_ci     *
8661847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
8761847f8eSopenharmony_ci     * @since 9
8861847f8eSopenharmony_ci     */
8961847f8eSopenharmony_ci    EXCEL = 'Excel Viewer',
9061847f8eSopenharmony_ci    /**
9161847f8eSopenharmony_ci     * Default PPT identifier.
9261847f8eSopenharmony_ci     *
9361847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
9461847f8eSopenharmony_ci     * @since 9
9561847f8eSopenharmony_ci     */
9661847f8eSopenharmony_ci    PPT = 'PPT Viewer',
9761847f8eSopenharmony_ci    /**
9861847f8eSopenharmony_ci     * Default email identifier.
9961847f8eSopenharmony_ci     *
10061847f8eSopenharmony_ci     * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
10161847f8eSopenharmony_ci     * @since 12
10261847f8eSopenharmony_ci     */
10361847f8eSopenharmony_ci    EMAIL = 'Email'
10461847f8eSopenharmony_ci  }
10561847f8eSopenharmony_ci
10661847f8eSopenharmony_ci  /**
10761847f8eSopenharmony_ci   * Query whether the caller is default application based on type.
10861847f8eSopenharmony_ci   *
10961847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
11061847f8eSopenharmony_ci   * @param { AsyncCallback<boolean> } callback - The callback of querying default application result.
11161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
11261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
11361847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
11461847f8eSopenharmony_ci   * @since 9
11561847f8eSopenharmony_ci   */
11661847f8eSopenharmony_ci  function isDefaultApplication(type: string, callback: AsyncCallback<boolean>): void;
11761847f8eSopenharmony_ci
11861847f8eSopenharmony_ci  /**
11961847f8eSopenharmony_ci   * Query whether the caller is default application based on type.
12061847f8eSopenharmony_ci   *
12161847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
12261847f8eSopenharmony_ci   * @returns { Promise<boolean> } Return true if caller is default application; return false otherwise.
12361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
12461847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
12561847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
12661847f8eSopenharmony_ci   * @since 9
12761847f8eSopenharmony_ci   */
12861847f8eSopenharmony_ci  function isDefaultApplication(type: string): Promise<boolean>;
12961847f8eSopenharmony_ci
13061847f8eSopenharmony_ci  /**
13161847f8eSopenharmony_ci   * Query whether the caller is default application based on type.
13261847f8eSopenharmony_ci   *
13361847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
13461847f8eSopenharmony_ci   * @returns { boolean } Return true if caller is default application; return false otherwise.
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 supported.
13761847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
13861847f8eSopenharmony_ci   * @since 10
13961847f8eSopenharmony_ci   */
14061847f8eSopenharmony_ci  function isDefaultApplicationSync(type: string): boolean;
14161847f8eSopenharmony_ci
14261847f8eSopenharmony_ci  /**
14361847f8eSopenharmony_ci   * Get default application based on type.
14461847f8eSopenharmony_ci   *
14561847f8eSopenharmony_ci   * @permission ohos.permission.GET_DEFAULT_APPLICATION
14661847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
14761847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
14861847f8eSopenharmony_ci   * @param { AsyncCallback<BundleInfo> } callback - The callback of the BundleInfo object result.
14961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
15061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
15161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
15261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
15361847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
15461847f8eSopenharmony_ci   * @throws { BusinessError } 17700023 - The specified default app does not exist.
15561847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
15661847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
15761847f8eSopenharmony_ci   * @systemapi
15861847f8eSopenharmony_ci   * @since 9
15961847f8eSopenharmony_ci   */
16061847f8eSopenharmony_ci  function getDefaultApplication(type: string, userId: number, callback: AsyncCallback<BundleInfo>): void;
16161847f8eSopenharmony_ci
16261847f8eSopenharmony_ci  /**
16361847f8eSopenharmony_ci   * Get default application based on type.
16461847f8eSopenharmony_ci   *
16561847f8eSopenharmony_ci   * @permission ohos.permission.GET_DEFAULT_APPLICATION
16661847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
16761847f8eSopenharmony_ci   * @param { AsyncCallback<BundleInfo> } callback - The callback of the BundleInfo object result.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
16961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
17061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
17161847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
17261847f8eSopenharmony_ci   * @throws { BusinessError } 17700023 - The specified default app does not exist.
17361847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
17461847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
17561847f8eSopenharmony_ci   * @systemapi
17661847f8eSopenharmony_ci   * @since 9
17761847f8eSopenharmony_ci   */
17861847f8eSopenharmony_ci  function getDefaultApplication(type: string, callback: AsyncCallback<BundleInfo>): void;
17961847f8eSopenharmony_ci
18061847f8eSopenharmony_ci  /**
18161847f8eSopenharmony_ci   * Get default application based on type.
18261847f8eSopenharmony_ci   *
18361847f8eSopenharmony_ci   * @permission ohos.permission.GET_DEFAULT_APPLICATION
18461847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
18561847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
18661847f8eSopenharmony_ci   * @returns { Promise<BundleInfo> } Return the BundleInfo object.
18761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
18861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
18961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
19061847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
19161847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
19261847f8eSopenharmony_ci   * @throws { BusinessError } 17700023 - The specified default app does not exist.
19361847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
19461847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
19561847f8eSopenharmony_ci   * @systemapi
19661847f8eSopenharmony_ci   * @since 9
19761847f8eSopenharmony_ci   */
19861847f8eSopenharmony_ci  function getDefaultApplication(type: string, userId?: number): Promise<BundleInfo>;
19961847f8eSopenharmony_ci
20061847f8eSopenharmony_ci  /**
20161847f8eSopenharmony_ci   * Get default application based on type.
20261847f8eSopenharmony_ci   *
20361847f8eSopenharmony_ci   * @permission ohos.permission.GET_DEFAULT_APPLICATION
20461847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
20561847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
20661847f8eSopenharmony_ci   * @returns { BundleInfo } Return the BundleInfo object.
20761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
20861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
20961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
21061847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
21161847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
21261847f8eSopenharmony_ci   * @throws { BusinessError } 17700023 - The specified default app does not exist.
21361847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
21461847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
21561847f8eSopenharmony_ci   * @systemapi
21661847f8eSopenharmony_ci   * @since 10
21761847f8eSopenharmony_ci   */
21861847f8eSopenharmony_ci  function getDefaultApplicationSync(type: string, userId?: number): BundleInfo;
21961847f8eSopenharmony_ci
22061847f8eSopenharmony_ci  /**
22161847f8eSopenharmony_ci   * Set default application based on type.
22261847f8eSopenharmony_ci   *
22361847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
22461847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
22561847f8eSopenharmony_ci   * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility.
22661847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
22761847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setting default application result.
22861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
22961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
23061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
23161847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
23261847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
23361847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
23461847f8eSopenharmony_ci   * @throws { BusinessError } 17700028 - The specified ability does not match the type.
23561847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
23661847f8eSopenharmony_ci   * @systemapi
23761847f8eSopenharmony_ci   * @since 9
23861847f8eSopenharmony_ci   */
23961847f8eSopenharmony_ci  function setDefaultApplication(type: string,
24061847f8eSopenharmony_ci    elementName: ElementName, userId: number, callback: AsyncCallback<void>): void;
24161847f8eSopenharmony_ci
24261847f8eSopenharmony_ci  /**
24361847f8eSopenharmony_ci   * Set default application based on type.
24461847f8eSopenharmony_ci   *
24561847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
24661847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
24761847f8eSopenharmony_ci   * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility.
24861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setting default application result.
24961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
25061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
25161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
25261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
25361847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
25461847f8eSopenharmony_ci   * @throws { BusinessError } 17700028 - The specified ability does not match the type.
25561847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
25661847f8eSopenharmony_ci   * @systemapi
25761847f8eSopenharmony_ci   * @since 9
25861847f8eSopenharmony_ci   */
25961847f8eSopenharmony_ci  function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback<void>): void;
26061847f8eSopenharmony_ci
26161847f8eSopenharmony_ci  /**
26261847f8eSopenharmony_ci   * Set default application based on type.
26361847f8eSopenharmony_ci   *
26461847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
26561847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
26661847f8eSopenharmony_ci   * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility.
26761847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
26861847f8eSopenharmony_ci   * @returns { Promise<void> } The result of setting default application.
26961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
27061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
27161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
27261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
27361847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
27461847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
27561847f8eSopenharmony_ci   * @throws { BusinessError } 17700028 - The specified ability does not match the type.
27661847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
27761847f8eSopenharmony_ci   * @systemapi
27861847f8eSopenharmony_ci   * @since 9
27961847f8eSopenharmony_ci   */
28061847f8eSopenharmony_ci  function setDefaultApplication(type: string, elementName: ElementName, userId?: number): Promise<void>;
28161847f8eSopenharmony_ci
28261847f8eSopenharmony_ci  /**
28361847f8eSopenharmony_ci   * Set default application based on type.
28461847f8eSopenharmony_ci   *
28561847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
28661847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
28761847f8eSopenharmony_ci   * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility.
28861847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
28961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
29061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
29161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
29261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
29361847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
29461847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
29561847f8eSopenharmony_ci   * @throws { BusinessError } 17700028 - The specified ability does not match the type.
29661847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
29761847f8eSopenharmony_ci   * @systemapi
29861847f8eSopenharmony_ci   * @since 10
29961847f8eSopenharmony_ci   */
30061847f8eSopenharmony_ci  function setDefaultApplicationSync(type: string, elementName: ElementName, userId?: number): void;
30161847f8eSopenharmony_ci
30261847f8eSopenharmony_ci  /**
30361847f8eSopenharmony_ci   * Reset default application based on type.
30461847f8eSopenharmony_ci   *
30561847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
30661847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
30761847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
30861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of resetting default application result.
30961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
31061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
31161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
31261847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
31361847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
31461847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
31561847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
31661847f8eSopenharmony_ci   * @systemapi
31761847f8eSopenharmony_ci   * @since 9
31861847f8eSopenharmony_ci   */
31961847f8eSopenharmony_ci  function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback<void>): void;
32061847f8eSopenharmony_ci
32161847f8eSopenharmony_ci  /**
32261847f8eSopenharmony_ci   * Reset default application based on type.
32361847f8eSopenharmony_ci   *
32461847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
32561847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
32661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of resetting default application result.
32761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
32861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
32961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
33061847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
33161847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
33261847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
33361847f8eSopenharmony_ci   * @systemapi
33461847f8eSopenharmony_ci   * @since 9
33561847f8eSopenharmony_ci   */
33661847f8eSopenharmony_ci  function resetDefaultApplication(type: string, callback: AsyncCallback<void>): void;
33761847f8eSopenharmony_ci
33861847f8eSopenharmony_ci  /**
33961847f8eSopenharmony_ci   * Reset default application based on type.
34061847f8eSopenharmony_ci   *
34161847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
34261847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
34361847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
34461847f8eSopenharmony_ci   * @returns { Promise<void> } The result of resetting default application.
34561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
34661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
34761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
34861847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
34961847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
35061847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
35161847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
35261847f8eSopenharmony_ci   * @systemapi
35361847f8eSopenharmony_ci   * @since 9
35461847f8eSopenharmony_ci   */
35561847f8eSopenharmony_ci  function resetDefaultApplication(type: string, userId?: number): Promise<void>;
35661847f8eSopenharmony_ci
35761847f8eSopenharmony_ci  /**
35861847f8eSopenharmony_ci   * Reset default application based on type.
35961847f8eSopenharmony_ci   *
36061847f8eSopenharmony_ci   * @permission ohos.permission.SET_DEFAULT_APPLICATION
36161847f8eSopenharmony_ci   * @param { string } type - Application type or a file type that conforms to media type format.
36261847f8eSopenharmony_ci   * @param { number } userId - Indicates the id for the user.
36361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
36461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
36561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
36661847f8eSopenharmony_ci   * @throws { BusinessError } 801 - Capability not supported.
36761847f8eSopenharmony_ci   * @throws { BusinessError } 17700004 - The specified user ID is not found.
36861847f8eSopenharmony_ci   * @throws { BusinessError } 17700025 - The specified type is invalid.
36961847f8eSopenharmony_ci   * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp
37061847f8eSopenharmony_ci   * @systemapi
37161847f8eSopenharmony_ci   * @since 10
37261847f8eSopenharmony_ci   */
37361847f8eSopenharmony_ci  function resetDefaultApplicationSync(type: string, userId?: number): void;
37461847f8eSopenharmony_ci}
37561847f8eSopenharmony_ci
37661847f8eSopenharmony_ciexport default defaultAppManager;
377