1/* 2 * Copyright (c) 2021-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 Want from '../@ohos.app.ability.Want'; 22/*** if arkts 1.1 */ 23import wantAgent from '../@ohos.wantAgent'; 24/*** endif */ 25import type abilityWantAgent from '../@ohos.app.ability.wantAgent'; 26 27 28/** 29 * Provides the information required for triggering a WantAgent. 30 * 31 * @typedef WantAgentInfo 32 * @syscap SystemCapability.Ability.AbilityRuntime.Core 33 * @since 7 34 */ 35/** 36 * Provides the information required for triggering a WantAgent. 37 * 38 * @typedef WantAgentInfo 39 * @syscap SystemCapability.Ability.AbilityRuntime.Core 40 * @atomicservice 41 * @since arkts {'1.1':'12', '1.2':'20'} 42 * @arkts 1.1&1.2 43 */ 44export interface WantAgentInfo { 45 /** 46 * An array of all Wants for starting abilities or sending common events. Only Wants can be displayed. 47 * 48 * @type { Array<Want> } 49 * @syscap SystemCapability.Ability.AbilityRuntime.Core 50 * @since 7 51 */ 52 /** 53 * An array of all Wants for starting abilities or sending common events. Only Wants can be displayed. 54 * 55 * @type { Array<Want> } 56 * @syscap SystemCapability.Ability.AbilityRuntime.Core 57 * @atomicservice 58 * @since arkts {'1.1':'12', '1.2':'20'} 59 * @arkts 1.1&1.2 60 */ 61 wants: Array<Want>; 62 63 /** 64 * Type of the action specified in a Want. 65 * 66 * @type { ?wantAgent.OperationType } 67 * @syscap SystemCapability.Ability.AbilityRuntime.Core 68 * @since 7 69 * @deprecated since 11 70 * @useinstead WantAgentInfo#actionType 71 */ 72 /** 73 * Type of the action specified in a Want. 74 * 75 * @type { ?wantAgent.OperationType } 76 * @syscap SystemCapability.Ability.AbilityRuntime.Core 77 * @atomicservice 78 * @since 12 79 * @deprecated since 11 80 * @useinstead WantAgentInfo#actionType 81 */ 82 operationType?: wantAgent.OperationType; 83 84 /** 85 * Type of the action specified in a Want. 86 * 87 * @type { ?abilityWantAgent.OperationType } 88 * @syscap SystemCapability.Ability.AbilityRuntime.Core 89 * @since 11 90 */ 91 /** 92 * Type of the action specified in a Want. 93 * 94 * @type { ?abilityWantAgent.OperationType } 95 * @syscap SystemCapability.Ability.AbilityRuntime.Core 96 * @atomicservice 97 * @since arkts {'1.1':'12', '1.2':'20'} 98 * @arkts 1.1&1.2 99 */ 100 actionType?: abilityWantAgent.OperationType; 101 102 /** 103 * Request code defined by the user. 104 * 105 * @type { number } 106 * @syscap SystemCapability.Ability.AbilityRuntime.Core 107 * @since 7 108 */ 109 /** 110 * Request code defined by the user. 111 * 112 * @type { number } 113 * @syscap SystemCapability.Ability.AbilityRuntime.Core 114 * @atomicservice 115 * @since 12 116 */ 117 requestCode: number; 118 119 /** 120 * An array of flags for using the WantAgent. 121 * 122 * @type { ?Array<wantAgent.WantAgentFlags> } 123 * @syscap SystemCapability.Ability.AbilityRuntime.Core 124 * @since 7 125 * @deprecated since 11 126 * @useinstead WantAgentInfo#actionFlags 127 */ 128 /** 129 * An array of flags for using the WantAgent. 130 * 131 * @type { ?Array<wantAgent.WantAgentFlags> } 132 * @syscap SystemCapability.Ability.AbilityRuntime.Core 133 * @atomicservice 134 * @since 12 135 * @deprecated since 11 136 * @useinstead WantAgentInfo#actionFlags 137 */ 138 wantAgentFlags?: Array<wantAgent.WantAgentFlags>; 139 140 /** 141 * An array of flags for using the WantAgent. 142 * 143 * @type { ?Array<abilityWantAgent.WantAgentFlags> } 144 * @syscap SystemCapability.Ability.AbilityRuntime.Core 145 * @since 11 146 */ 147 /** 148 * An array of flags for using the WantAgent. 149 * 150 * @type { ?Array<abilityWantAgent.WantAgentFlags> } 151 * @syscap SystemCapability.Ability.AbilityRuntime.Core 152 * @atomicservice 153 * @since arkts {'1.1':'12', '1.2':'20'} 154 * @arkts 1.1&1.2 155 */ 156 actionFlags?: Array<abilityWantAgent.WantAgentFlags>; 157 158 /** 159 * Extra information about how the Want starts an ability. 160 * If there is no extra information to set, this constant can be left empty. 161 * 162 * @type { ?object } 163 * @syscap SystemCapability.Ability.AbilityRuntime.Core 164 * @since 7 165 */ 166 /** 167 * Extra information about how the Want starts an ability. 168 * If there is no extra information to set, this constant can be left empty. 169 * 170 * @type { ?object } 171 * @syscap SystemCapability.Ability.AbilityRuntime.Core 172 * @atomicservice 173 * @since 12 174 */ 175 extraInfo?: { [key: string]: any }; 176 177 /** 178 * Extra information about how the Want starts an ability. 179 * If there is no extra information to set, this constant can be left empty. 180 * 181 * @type { ?Record<string, Object> } 182 * @syscap SystemCapability.Ability.AbilityRuntime.Core 183 * @since 20 184 * @arkts 1.2 185 */ 186 extraInfo?: Record<string, Object>; 187 188 /** 189 * Extra information about how the Want starts an ability. 190 * If there is no extra information to set, this constant can be left empty. 191 * The ability of this property is same as extraInfo. If both are set, this property will be used. 192 * 193 * @type { ?Record<string, Object> } 194 * @syscap SystemCapability.Ability.AbilityRuntime.Core 195 * @since 11 196 */ 197 /** 198 * Extra information about how the Want starts an ability. 199 * If there is no extra information to set, this constant can be left empty. 200 * The ability of this property is same as extraInfo. If both are set, this property will be used. 201 * 202 * @type { ?Record<string, Object> } 203 * @syscap SystemCapability.Ability.AbilityRuntime.Core 204 * @atomicservice 205 * @since arkts {'1.1':'12', '1.2':'20'} 206 * @arkts 1.1&1.2 207 */ 208 extraInfos?: Record<string, Object>; 209} 210 211/** 212 * Provides the information required to create a local WantAgent. 213 * 214 * @typedef LocalWantAgentInfo 215 * @syscap SystemCapability.Ability.AbilityRuntime.Core 216 * @systemapi 217 * @stagemodelonly 218 * @since 20 219 */ 220export interface LocalWantAgentInfo { 221 /** 222 * An array of all Wants for starting abilities or sending common events. 223 * 224 * @type { Array<Want> } 225 * @syscap SystemCapability.Ability.AbilityRuntime.Core 226 * @systemapi 227 * @stagemodelonly 228 * @since 20 229 */ 230 wants: Array<Want>; 231 232 /** 233 * Type of the action specified in a Want. 234 * 235 * @type { ?abilityWantAgent.OperationType } 236 * @syscap SystemCapability.Ability.AbilityRuntime.Core 237 * @systemapi 238 * @stagemodelonly 239 * @since 20 240 */ 241 operationType?: abilityWantAgent.OperationType; 242 243 /** 244 * Request code defined by the user. 245 * 246 * @type { number } 247 * @syscap SystemCapability.Ability.AbilityRuntime.Core 248 * @systemapi 249 * @stagemodelonly 250 * @since 20 251 */ 252 requestCode: number; 253} 254