1 /* 2 * Copyright (c) 2021-2022 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_LIFECYCLE_STATE_INFO_H 17 #define OHOS_ABILITY_RUNTIME_LIFECYCLE_STATE_INFO_H 18 19 #include <string> 20 21 #include "ability_start_setting.h" 22 #include "caller_info.h" 23 #include "launch_param.h" 24 #include "parcel.h" 25 26 namespace OHOS { 27 namespace AAFwk { 28 /** 29 * @enum AbilityLifeCycleState 30 * AbilityLifeCycleState defines the life cycle state of ability. 31 */ 32 enum AbilityLifeCycleState { 33 ABILITY_STATE_INITIAL = 0, 34 ABILITY_STATE_INACTIVE, 35 ABILITY_STATE_ACTIVE, 36 ABILITY_STATE_BACKGROUND, 37 ABILITY_STATE_STARTED_NEW, 38 ABILITY_STATE_FOREGROUND_NEW, 39 ABILITY_STATE_BACKGROUND_NEW, 40 ABILITY_STATE_STOPED_NEW, 41 ABILITY_STATE_FOREGROUND_FAILED, 42 ABILITY_STATE_INVALID_WINDOW_MODE, 43 ABILITY_STATE_WINDOW_FREEZED, 44 }; 45 46 /** 47 * @struct LifeCycleStateInfo 48 * LifeCycleStateInfo is used to save information about ability life cycle state. 49 */ 50 struct LifeCycleStateInfo : public Parcelable { 51 AbilityLifeCycleState state = AbilityLifeCycleState::ABILITY_STATE_INITIAL; 52 bool isNewWant = false; 53 int missionId = -1; 54 CallerInfo caller; 55 std::shared_ptr<AbilityStartSetting> setting = nullptr; 56 LaunchParam launchParam; 57 uint32_t sceneFlag = 0; 58 uint32_t sceneFlagBak = 0; 59 60 bool ReadFromParcel(Parcel &parcel); 61 virtual bool Marshalling(Parcel &parcel) const override; 62 static LifeCycleStateInfo *Unmarshalling(Parcel &parcel); 63 }; 64 } // namespace AAFwk 65 } // namespace OHOS 66 #endif // OHOS_ABILITY_RUNTIME_LIFECYCLE_STATE_INFO_H 67