161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023-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 type { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type insightIntent from './@ohos.app.ability.insightIntent';
2361847f8eSopenharmony_ci
2461847f8eSopenharmony_ci/**
2561847f8eSopenharmony_ci * Insight intent driver.
2661847f8eSopenharmony_ci *
2761847f8eSopenharmony_ci * @namespace insightIntentDriver
2861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core
2961847f8eSopenharmony_ci * @systemapi
3061847f8eSopenharmony_ci * @StageModelOnly
3161847f8eSopenharmony_ci * @since 11
3261847f8eSopenharmony_ci */
3361847f8eSopenharmony_cideclare namespace insightIntentDriver {
3461847f8eSopenharmony_ci  /**
3561847f8eSopenharmony_ci   * Param when execute insight intent.
3661847f8eSopenharmony_ci   *
3761847f8eSopenharmony_ci   * @typedef ExecuteParam
3861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.Core
3961847f8eSopenharmony_ci   * @systemapi
4061847f8eSopenharmony_ci   * @StageModelOnly
4161847f8eSopenharmony_ci   * @since 11
4261847f8eSopenharmony_ci   */
4361847f8eSopenharmony_ci  interface ExecuteParam {
4461847f8eSopenharmony_ci    /**
4561847f8eSopenharmony_ci     * Indicates the bundle name.
4661847f8eSopenharmony_ci     *
4761847f8eSopenharmony_ci     * @type { string }
4861847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
4961847f8eSopenharmony_ci     * @systemapi
5061847f8eSopenharmony_ci     * @StageModelOnly
5161847f8eSopenharmony_ci     * @since 11
5261847f8eSopenharmony_ci     */
5361847f8eSopenharmony_ci    bundleName: string;
5461847f8eSopenharmony_ci
5561847f8eSopenharmony_ci    /**
5661847f8eSopenharmony_ci     * Indicates the module name.
5761847f8eSopenharmony_ci     *
5861847f8eSopenharmony_ci     * @type { string }
5961847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
6061847f8eSopenharmony_ci     * @systemapi
6161847f8eSopenharmony_ci     * @StageModelOnly
6261847f8eSopenharmony_ci     * @since 11
6361847f8eSopenharmony_ci     */
6461847f8eSopenharmony_ci    moduleName: string;
6561847f8eSopenharmony_ci
6661847f8eSopenharmony_ci    /**
6761847f8eSopenharmony_ci     * Indicates the ability name.
6861847f8eSopenharmony_ci     *
6961847f8eSopenharmony_ci     * @type { string }
7061847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
7161847f8eSopenharmony_ci     * @systemapi
7261847f8eSopenharmony_ci     * @StageModelOnly
7361847f8eSopenharmony_ci     * @since 11
7461847f8eSopenharmony_ci     */
7561847f8eSopenharmony_ci    abilityName: string;
7661847f8eSopenharmony_ci
7761847f8eSopenharmony_ci    /**
7861847f8eSopenharmony_ci     * Indicates the insight intent name.
7961847f8eSopenharmony_ci     *
8061847f8eSopenharmony_ci     * @type { string }
8161847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
8261847f8eSopenharmony_ci     * @systemapi
8361847f8eSopenharmony_ci     * @StageModelOnly
8461847f8eSopenharmony_ci     * @since 11
8561847f8eSopenharmony_ci     */
8661847f8eSopenharmony_ci    insightIntentName: string;
8761847f8eSopenharmony_ci
8861847f8eSopenharmony_ci    /**
8961847f8eSopenharmony_ci     * Indicates the insight intent param.
9061847f8eSopenharmony_ci     *
9161847f8eSopenharmony_ci     * @type { Record<string, Object> }
9261847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
9361847f8eSopenharmony_ci     * @systemapi
9461847f8eSopenharmony_ci     * @StageModelOnly
9561847f8eSopenharmony_ci     * @since 11
9661847f8eSopenharmony_ci     */
9761847f8eSopenharmony_ci    insightIntentParam: Record<string, Object>;
9861847f8eSopenharmony_ci
9961847f8eSopenharmony_ci    /**
10061847f8eSopenharmony_ci     * Indicates the execute mode.
10161847f8eSopenharmony_ci     *
10261847f8eSopenharmony_ci     * @type { insightIntent.ExecuteMode }
10361847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
10461847f8eSopenharmony_ci     * @systemapi
10561847f8eSopenharmony_ci     * @StageModelOnly
10661847f8eSopenharmony_ci     * @since 11
10761847f8eSopenharmony_ci     */
10861847f8eSopenharmony_ci    executeMode: insightIntent.ExecuteMode;
10961847f8eSopenharmony_ci
11061847f8eSopenharmony_ci    /**
11161847f8eSopenharmony_ci     * Indicates the display Id, only works when executeMode is UIAbility foreground.
11261847f8eSopenharmony_ci     *
11361847f8eSopenharmony_ci     * @type { ?number }
11461847f8eSopenharmony_ci     * @syscap SystemCapability.Ability.AbilityRuntime.Core
11561847f8eSopenharmony_ci     * @systemapi
11661847f8eSopenharmony_ci     * @StageModelOnly
11761847f8eSopenharmony_ci     * @since 12
11861847f8eSopenharmony_ci     */
11961847f8eSopenharmony_ci    displayId?: number;
12061847f8eSopenharmony_ci  }
12161847f8eSopenharmony_ci
12261847f8eSopenharmony_ci  /**
12361847f8eSopenharmony_ci   * Execute insight intent.
12461847f8eSopenharmony_ci   * If the caller application is in foreground, you can use this method to execute insight intent;
12561847f8eSopenharmony_ci   * If the caller application is in background, you need to apply for permission: ohos.permission.START_ABILITIES_FROM_BACKGROUND.
12661847f8eSopenharmony_ci   *
12761847f8eSopenharmony_ci   * @permission ohos.permission.EXECUTE_INSIGHT_INTENT
12861847f8eSopenharmony_ci   * @param { ExecuteParam } param - Execute parameter.
12961847f8eSopenharmony_ci   * @param { AsyncCallback<insightIntent.ExecuteResult> } callback - The callback of executeIntent.
13061847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
13161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not system application.
13261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
13361847f8eSopenharmony_ci   * 2. Incorrect parameter types.
13461847f8eSopenharmony_ci   * @throws { BusinessError } 16000001 - The specified ability does not exist.
13561847f8eSopenharmony_ci   * @throws { BusinessError } 16000002 - Incorrect ability type.
13661847f8eSopenharmony_ci   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
13761847f8eSopenharmony_ci   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
13861847f8eSopenharmony_ci   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
13961847f8eSopenharmony_ci   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
14061847f8eSopenharmony_ci   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
14161847f8eSopenharmony_ci   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
14261847f8eSopenharmony_ci   * @throws { BusinessError } 16000011 - The context does not exist.
14361847f8eSopenharmony_ci   * @throws { BusinessError } 16000012 - The application is controlled.
14461847f8eSopenharmony_ci   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
14561847f8eSopenharmony_ci   * @throws { BusinessError } 16000050 - Internal error.
14661847f8eSopenharmony_ci   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
14761847f8eSopenharmony_ci   * @throws { BusinessError } 16000055 - Installation-free timed out.
14861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.Core
14961847f8eSopenharmony_ci   * @systemapi
15061847f8eSopenharmony_ci   * @StageModelOnly
15161847f8eSopenharmony_ci   * @since 11
15261847f8eSopenharmony_ci   */
15361847f8eSopenharmony_ci  function execute(param: ExecuteParam, callback: AsyncCallback<insightIntent.ExecuteResult>): void;
15461847f8eSopenharmony_ci
15561847f8eSopenharmony_ci  /**
15661847f8eSopenharmony_ci   * Execute insight intent.
15761847f8eSopenharmony_ci   * If the caller application is in foreground, you can use this method to execute insight intent;
15861847f8eSopenharmony_ci   * If the caller application is in background, you need to apply for permission: ohos.permission.START_ABILITIES_FROM_BACKGROUND.
15961847f8eSopenharmony_ci   *
16061847f8eSopenharmony_ci   * @permission ohos.permission.EXECUTE_INSIGHT_INTENT
16161847f8eSopenharmony_ci   * @param { ExecuteParam } param - Execute parameter.
16261847f8eSopenharmony_ci   * @returns { Promise<insightIntent.ExecuteResult> } Returns the execute result.
16361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied.
16461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Not system application.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
16661847f8eSopenharmony_ci   * 2. Incorrect parameter types.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 16000001 - The specified ability does not exist.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 16000002 - Incorrect ability type.
16961847f8eSopenharmony_ci   * @throws { BusinessError } 16000004 - Failed to start the invisible ability.
17061847f8eSopenharmony_ci   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
17161847f8eSopenharmony_ci   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
17261847f8eSopenharmony_ci   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
17361847f8eSopenharmony_ci   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
17461847f8eSopenharmony_ci   * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden.
17561847f8eSopenharmony_ci   * @throws { BusinessError } 16000011 - The context does not exist.
17661847f8eSopenharmony_ci   * @throws { BusinessError } 16000012 - The application is controlled.
17761847f8eSopenharmony_ci   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
17861847f8eSopenharmony_ci   * @throws { BusinessError } 16000050 - Internal error.
17961847f8eSopenharmony_ci   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
18061847f8eSopenharmony_ci   * @throws { BusinessError } 16000055 - Installation-free timed out.
18161847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.Core
18261847f8eSopenharmony_ci   * @systemapi
18361847f8eSopenharmony_ci   * @StageModelOnly
18461847f8eSopenharmony_ci   * @since 11
18561847f8eSopenharmony_ci   */
18661847f8eSopenharmony_ci  function execute(param: ExecuteParam): Promise<insightIntent.ExecuteResult>;
18761847f8eSopenharmony_ci}
18861847f8eSopenharmony_ci
18961847f8eSopenharmony_ciexport default insightIntentDriver;
190