1 /* 2 * Copyright (c) 2020 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 * @addtogroup AbilityKit 18 * @{ 19 * 20 * @brief Provides ability-related functions, including ability lifecycle callbacks and functions for connecting to or 21 * disconnecting from Particle Abilities. 22 * 23 * Abilities are classified into Feature Abilities and Particle Abilities. Feature Abilities support the Page template, 24 * and Particle Abilities support the Service template. An ability using the Page template is called a Page ability for 25 * short and that using the Service template is called a Service ability. 26 * 27 * @since 1.0 28 * @version 1.0 29 */ 30 31 /** 32 * @file ability_state.h 33 * 34 * @brief Declares ability-related functions, including ability lifecycle callbacks and functions for connecting to 35 * or disconnecting from Particle Abilities. 36 * As the fundamental unit of OpenHarmony applications, abilities are classified into Feature Abilities and Particle 37 * Abilities. Feature Abilities support the Page template, and Particle Abilities support the Service template. 38 * An ability using the Page template is called a Page ability for short and that using the Service template 39 * is called a Service ability. 40 * 41 * @since 1.0 42 * @version 1.0 43 */ 44 #ifndef OHOS_ABILITY_STATE_H 45 #define OHOS_ABILITY_STATE_H 46 47 #ifdef __cplusplus 48 #if __cplusplus 49 extern "C" { 50 #endif 51 #endif /* __cplusplus */ 52 /** 53 * @brief Enumerates all lifecycle states that an ability will go through over the course of its lifetime. 54 * 55 * @since 1.0 56 * @version 1.0 57 */ 58 typedef enum { 59 /** 60 * Uninitialized state: An ability is in this state when it has not been initialized after being created. 61 */ 62 STATE_UNINITIALIZED, 63 64 /** 65 * Initial state: An ability is in this state after it is initialized or stopped. 66 */ 67 STATE_INITIAL, 68 69 /** 70 * Inactive state: An ability is in this state when it is switched to the foreground but is not interactive. 71 */ 72 STATE_INACTIVE, 73 74 /** 75 * Active state: An ability is in this state when it is switched to the foreground and is interactive. 76 */ 77 STATE_ACTIVE, 78 79 /** 80 * Background state: An ability is in this state after it returns to the background. 81 */ 82 STATE_BACKGROUND, 83 } State; 84 #ifdef __cplusplus 85 #if __cplusplus 86 } 87 #endif 88 #endif /* __cplusplus */ 89 90 #endif // OHOS_ABILITY_STATE_H