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_AAFWK_INTERFACES_INNERKITS_ABILITY_RECORD_INFO_H 17 #define OHOS_AAFWK_INTERFACES_INNERKITS_ABILITY_RECORD_INFO_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 BACKGROUND, 34 SUSPENDED, 35 INACTIVATING, 36 ACTIVATING, 37 MOVING_BACKGROUND, 38 TERMINATING, 39 40 /** 41 * State for api > 7. 42 */ 43 FOREGROUND_NEW, 44 BACKGROUND_NEW, 45 FOREGROUNDING_NEW, 46 BACKGROUNDING_NEW, 47 }; 48 49 /** 50 * @struct AbilityRecordInfo 51 * AbilityRecordInfo is used to save information about ability record. 52 */ 53 struct AbilityRecordInfo : public Parcelable { 54 int32_t id = -1; 55 std::string elementName; 56 std::string appName; 57 std::string mainName; 58 int32_t abilityType = 1; // Page=1,Service=2,Data=3 59 std::string previousAppName; 60 std::string previousMainName; 61 std::string nextAppName; 62 std::string nextMainName; 63 AbilityState state = AbilityState::INITIAL; 64 std::string startTime; 65 bool ready = false; 66 bool windowAttached = false; 67 bool lanucher = false; 68 69 bool ReadFromParcel(Parcel &parcel); 70 virtual bool Marshalling(Parcel &parcel) const override; 71 static AbilityRecordInfo *Unmarshalling(Parcel &parcel); 72 }; 73 } // namespace AAFwk 74 } // namespace OHOS 75 #endif // OHOS_AAFWK_INTERFACES_INNERKITS_ABILITY_RECORD_INFO_H