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'; 22import StartOptions from '../@ohos.app.ability.StartOptions'; 23 24/** 25 * Provides the information required for triggering a WantAgent. 26 * 27 * @typedef TriggerInfo 28 * @syscap SystemCapability.Ability.AbilityRuntime.Core 29 * @since 7 30 */ 31/** 32 * Provides the information required for triggering a WantAgent. 33 * 34 * @typedef TriggerInfo 35 * @syscap SystemCapability.Ability.AbilityRuntime.Core 36 * @atomicservice 37 * @since arkts {'1.1':'12', '1.2':'20'} 38 * @arkts 1.1&1.2 39 */ 40export interface TriggerInfo { 41 /** 42 * Result code. 43 * 44 * @type { number } 45 * @syscap SystemCapability.Ability.AbilityRuntime.Core 46 * @since 7 47 */ 48 /** 49 * Result code. 50 * 51 * @type { number } 52 * @syscap SystemCapability.Ability.AbilityRuntime.Core 53 * @atomicservice 54 * @since arkts {'1.1':'12', '1.2':'20'} 55 * @arkts 1.1&1.2 56 */ 57 code: number; 58 59 /** 60 * Extra Want. 61 * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid. 62 * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE, 63 * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter 64 * will be used to replace the corresponding attributes in the original Want, respectively. 65 * If this parameter is null, the original Want remains unchanged. 66 * 67 * @type { ?Want } 68 * @syscap SystemCapability.Ability.AbilityRuntime.Core 69 * @since 7 70 */ 71 /** 72 * Extra Want. 73 * If flags in WantAgentInfo contain CONSTANT_FLAG, this parameter is invalid. 74 * If flags contain REPLACE_ELEMENT, REPLACE_ACTION, REPLACE_URI, REPLACE_ENTITIES, and REPLACE_BUNDLE, 75 * the element, action, uri, entities, and bundleName attributes of the Want specified in this parameter 76 * will be used to replace the corresponding attributes in the original Want, respectively. 77 * If this parameter is null, the original Want remains unchanged. 78 * 79 * @type { ?Want } 80 * @syscap SystemCapability.Ability.AbilityRuntime.Core 81 * @atomicservice 82 * @since arkts {'1.1':'12', '1.2':'20'} 83 * @arkts 1.1&1.2 84 */ 85 want?: Want; 86 87 /** 88 * Permission required for a WantAgent recipient. 89 * This parameter is valid only when the WantAgent is triggered to send common events. 90 * If permission is null, no permission is required on the recipient. 91 * 92 * @type { ?string } 93 * @syscap SystemCapability.Ability.AbilityRuntime.Core 94 * @since 7 95 */ 96 /** 97 * Permission required for a WantAgent recipient. 98 * This parameter is valid only when the WantAgent is triggered to send common events. 99 * If permission is null, no permission is required on the recipient. 100 * 101 * @type { ?string } 102 * @syscap SystemCapability.Ability.AbilityRuntime.Core 103 * @atomicservice 104 * @since arkts {'1.1':'12', '1.2':'20'} 105 * @arkts 1.1&1.2 106 */ 107 permission?: string; 108 109 /** 110 * Custom extra data you want to add for triggering a WantAgent. 111 * 112 * @type { ?object } 113 * @syscap SystemCapability.Ability.AbilityRuntime.Core 114 * @since 7 115 */ 116 /** 117 * Custom extra data you want to add for triggering a WantAgent. 118 * 119 * @type { ?object } 120 * @syscap SystemCapability.Ability.AbilityRuntime.Core 121 * @atomicservice 122 * @since 12 123 */ 124 extraInfo?: { [key: string]: any }; 125 126 /** 127 * Custom extra data you want to add for triggering a WantAgent. 128 * 129 * @type { ?Record<string, Object> } 130 * @syscap SystemCapability.Ability.AbilityRuntime.Core 131 * @since 20 132 * @arkts 1.2 133 */ 134 extraInfo?: Record<string, Object>; 135 136 /** 137 * Custom extra data you want to add for triggering a WantAgent. 138 * The ability of this property is same as extraInfo. If both are set, this property will be used. 139 * 140 * @type { ?Record<string, Object> } 141 * @syscap SystemCapability.Ability.AbilityRuntime.Core 142 * @since 11 143 */ 144 /** 145 * Custom extra data you want to add for triggering a WantAgent. 146 * The ability of this property is same as extraInfo. If both are set, this property will be used. 147 * 148 * @type { ?Record<string, Object> } 149 * @syscap SystemCapability.Ability.AbilityRuntime.Core 150 * @atomicservice 151 * @since arkts {'1.1':'12', '1.2':'20'} 152 * @arkts 1.1&1.2 153 */ 154 extraInfos?: Record<string, Object>; 155 156 /** 157 * Specific options for triggering a wantagent which is used for starting an ability. 158 * 159 * @type { ?StartOptions } 160 * @syscap SystemCapability.Ability.AbilityRuntime.Core 161 * @systemapi 162 * @stagemodelonly 163 * @since arkts {'1.1':'12', '1.2':'20'} 164 * @arkts 1.1&1.2 165 */ 166 startOptions?: StartOptions; 167} 168