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 16import UIAbility from '../@ohos.app.ability.UIAbility'; 17 18/** 19 * Provide methods for matching monitored Ability objects that meet specified conditions. 20 * The most recently matched Ability objects will be saved in the AbilityMonitor object. 21 * 22 * @interface AbilityMonitor 23 * @syscap SystemCapability.Ability.AbilityRuntime.Core 24 * @since 9 25 */ 26/** 27 * Provide methods for matching monitored Ability objects that meet specified conditions. 28 * The most recently matched Ability objects will be saved in the AbilityMonitor object. 29 * 30 * @interface AbilityMonitor 31 * @syscap SystemCapability.Ability.AbilityRuntime.Core 32 * @crossplatform 33 * @since 10 34 */ 35/** 36 * Provide methods for matching monitored Ability objects that meet specified conditions. 37 * The most recently matched Ability objects will be saved in the AbilityMonitor object. 38 * 39 * @interface AbilityMonitor 40 * @syscap SystemCapability.Ability.AbilityRuntime.Core 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45export interface AbilityMonitor { 46 /** 47 * The name of the ability to monitor. 48 * 49 * @type { string } 50 * @syscap SystemCapability.Ability.AbilityRuntime.Core 51 * @since 9 52 */ 53 /** 54 * The name of the ability to monitor. 55 * 56 * @type { string } 57 * @syscap SystemCapability.Ability.AbilityRuntime.Core 58 * @crossplatform 59 * @since 10 60 */ 61 /** 62 * The name of the ability to monitor. 63 * 64 * @type { string } 65 * @syscap SystemCapability.Ability.AbilityRuntime.Core 66 * @crossplatform 67 * @atomicservice 68 * @since 11 69 */ 70 abilityName: string; 71 72 /** 73 * The name of the module to monitor. 74 * 75 * @type { ?string } 76 * @syscap SystemCapability.Ability.AbilityRuntime.Core 77 * @since 9 78 */ 79 /** 80 * The name of the module to monitor. 81 * 82 * @type { ?string } 83 * @syscap SystemCapability.Ability.AbilityRuntime.Core 84 * @crossplatform 85 * @since 10 86 */ 87 /** 88 * The name of the module to monitor. 89 * 90 * @type { ?string } 91 * @syscap SystemCapability.Ability.AbilityRuntime.Core 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 */ 96 moduleName?: string; 97 98 /** 99 * Called back when the ability is created for initialization. 100 * 101 * @syscap SystemCapability.Ability.AbilityRuntime.Core 102 * @since 9 103 */ 104 /** 105 * Called back when the ability is created for initialization. 106 * 107 * @syscap SystemCapability.Ability.AbilityRuntime.Core 108 * @crossplatform 109 * @since 10 110 */ 111 /** 112 * Called back when the ability is created for initialization. 113 * 114 * @syscap SystemCapability.Ability.AbilityRuntime.Core 115 * @crossplatform 116 * @atomicservice 117 * @since 11 118 */ 119 onAbilityCreate?: (ability: UIAbility) => void; 120 121 /** 122 * Called back when the state of the ability changes to foreground. 123 * 124 * @syscap SystemCapability.Ability.AbilityRuntime.Core 125 * @since 9 126 */ 127 /** 128 * Called back when the state of the ability changes to foreground. 129 * 130 * @syscap SystemCapability.Ability.AbilityRuntime.Core 131 * @crossplatform 132 * @since 10 133 */ 134 /** 135 * Called back when the state of the ability changes to foreground. 136 * 137 * @syscap SystemCapability.Ability.AbilityRuntime.Core 138 * @crossplatform 139 * @atomicservice 140 * @since 11 141 */ 142 onAbilityForeground?: (ability: UIAbility) => void; 143 144 /** 145 * Called back when the state of the ability changes to background. 146 * 147 * @syscap SystemCapability.Ability.AbilityRuntime.Core 148 * @since 9 149 */ 150 /** 151 * Called back when the state of the ability changes to background. 152 * 153 * @syscap SystemCapability.Ability.AbilityRuntime.Core 154 * @crossplatform 155 * @since 10 156 */ 157 /** 158 * Called back when the state of the ability changes to background. 159 * 160 * @syscap SystemCapability.Ability.AbilityRuntime.Core 161 * @crossplatform 162 * @atomicservice 163 * @since 11 164 */ 165 onAbilityBackground?: (ability: UIAbility) => void; 166 167 /** 168 * Called back before the ability is destroyed. 169 * 170 * @syscap SystemCapability.Ability.AbilityRuntime.Core 171 * @since 9 172 */ 173 /** 174 * Called back before the ability is destroyed. 175 * 176 * @syscap SystemCapability.Ability.AbilityRuntime.Core 177 * @crossplatform 178 * @since 10 179 */ 180 /** 181 * Called back before the ability is destroyed. 182 * 183 * @syscap SystemCapability.Ability.AbilityRuntime.Core 184 * @crossplatform 185 * @atomicservice 186 * @since 11 187 */ 188 onAbilityDestroy?: (ability: UIAbility) => void; 189 190 /** 191 * Called back when an ability window stage is created. 192 * 193 * @syscap SystemCapability.Ability.AbilityRuntime.Core 194 * @since 9 195 */ 196 /** 197 * Called back when an ability window stage is created. 198 * 199 * @syscap SystemCapability.Ability.AbilityRuntime.Core 200 * @crossplatform 201 * @since 10 202 */ 203 /** 204 * Called back when an ability window stage is created. 205 * 206 * @syscap SystemCapability.Ability.AbilityRuntime.Core 207 * @crossplatform 208 * @atomicservice 209 * @since 11 210 */ 211 onWindowStageCreate?: (ability: UIAbility) => void; 212 213 /** 214 * Called back when an ability window stage is restored. 215 * 216 * @syscap SystemCapability.Ability.AbilityRuntime.Core 217 * @since 9 218 */ 219 /** 220 * Called back when an ability window stage is restored. 221 * 222 * @syscap SystemCapability.Ability.AbilityRuntime.Core 223 * @atomicservice 224 * @since 11 225 */ 226 onWindowStageRestore?: (ability: UIAbility) => void; 227 228 /** 229 * Called back when an ability window stage is destroyed. 230 * 231 * @syscap SystemCapability.Ability.AbilityRuntime.Core 232 * @since 9 233 */ 234 /** 235 * Called back when an ability window stage is destroyed. 236 * 237 * @syscap SystemCapability.Ability.AbilityRuntime.Core 238 * @crossplatform 239 * @since 10 240 */ 241 /** 242 * Called back when an ability window stage is destroyed. 243 * 244 * @syscap SystemCapability.Ability.AbilityRuntime.Core 245 * @crossplatform 246 * @atomicservice 247 * @since 11 248 */ 249 onWindowStageDestroy?: (ability: UIAbility) => void; 250} 251 252export default AbilityMonitor; 253