• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 type { AsyncCallback } from './@ohos.base';
22import type Want from './@ohos.app.ability.Want';
23
24/**
25 * The context of insight intent executor.
26 *
27 * @syscap SystemCapability.Ability.AbilityRuntime.Core
28 * @StageModelOnly
29 * @atomicservice
30 * @since 11
31 */
32export default class InsightIntentContext {
33  /**
34   * Starts a new ability.
35   * This interface only allows you to start abilities within the same bundle and specify the bundleName.
36   * This interface only allows called in UIAbility insight intent execute mode.
37   *
38   * @param { Want } want - Indicates the ability to start.
39   * @param { AsyncCallback<void> } callback - The callback of startAbility.
40   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
41   * @throws { BusinessError } 16000001 - The specified ability does not exist.
42   * @throws { BusinessError } 16000004 - Can not start invisible component.
43   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
44   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
45   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
46   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
47   * @throws { BusinessError } 16000011 - The context does not exist.
48   * @throws { BusinessError } 16000012 - The application is controlled.
49   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
50   * @throws { BusinessError } 16000050 - Internal error.
51   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
52   * @throws { BusinessError } 16000055 - Installation-free timed out.
53   * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle.
54   * @throws { BusinessError } 16200001 - The caller has been released.
55   * @syscap SystemCapability.Ability.AbilityRuntime.Core
56   * @StageModelOnly
57   * @atomicservice
58   * @since 11
59   */
60  startAbility(want: Want, callback: AsyncCallback<void>): void;
61
62  /**
63   * Starts a new ability.
64   * This interface only allows you to start abilities within the same bundle and specify the bundleName.
65   * This interface only allows called in UIAbility insight intent execute mode.
66   *
67   * @param { Want } want - Indicates the ability to start.
68   * @returns { Promise<void> } The promise returned by the function.
69   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
70   * @throws { BusinessError } 16000001 - The specified ability does not exist.
71   * @throws { BusinessError } 16000004 - Can not start invisible component.
72   * @throws { BusinessError } 16000005 - The specified process does not have the permission.
73   * @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
74   * @throws { BusinessError } 16000008 - The crowdtesting application expires.
75   * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode.
76   * @throws { BusinessError } 16000011 - The context does not exist.
77   * @throws { BusinessError } 16000012 - The application is controlled.
78   * @throws { BusinessError } 16000013 - The application is controlled by EDM.
79   * @throws { BusinessError } 16000050 - Internal error.
80   * @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
81   * @throws { BusinessError } 16000055 - Installation-free timed out.
82   * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle.
83   * @throws { BusinessError } 16200001 - The caller has been released.
84   * @syscap SystemCapability.Ability.AbilityRuntime.Core
85   * @StageModelOnly
86   * @atomicservice
87   * @since 11
88   */
89  startAbility(want: Want): Promise<void>;
90}
91