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 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_STATE_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_STATE_H 18 19 #include <string> 20 21 #include "parcel.h" 22 23 namespace OHOS { 24 namespace AAFwk { 25 /** 26 * @enum AbilityState 27 * AbilityState defines the life cycle state of ability. 28 */ 29 enum AbilityState { 30 INITIAL = 0, 31 INACTIVE, 32 ACTIVE, 33 INACTIVATING = 5, 34 ACTIVATING, 35 TERMINATING = 8, 36 37 /** 38 * State for api > 7. 39 */ 40 FOREGROUND, 41 BACKGROUND, 42 FOREGROUNDING, 43 BACKGROUNDING, 44 FOREGROUND_FAILED, 45 BACKGROUND_FAILED, 46 FOREGROUND_INVALID_MODE, 47 FOREGROUND_WINDOW_FREEZED, 48 FOREGROUND_DO_NOTHING, 49 }; 50 51 enum Reason { 52 REASON_MIN = 0, 53 REASON_UNKNOWN = REASON_MIN, 54 REASON_NORMAL, 55 REASON_CPP_CRASH, 56 REASON_JS_ERROR, 57 REASON_APP_FREEZE, 58 REASON_PERFORMANCE_CONTROL, 59 REASON_RESOURCE_CONTROL, 60 REASON_UPGRADE, 61 REASON_MAX = REASON_UPGRADE, 62 }; 63 } // namespace AAFwk 64 } // namespace OHOS 65 #endif // OHOS_ABILITY_RUNTIME_ABILITY_STATE_H 66