1 /* 2 * Copyright (c) 2024 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 #ifdef SUPPORT_GRAPHICS 17 #include "ability_first_frame_state_data.h" 18 19 #include "hilog_tag_wrapper.h" 20 21 namespace OHOS { 22 namespace AppExecFwk { Marshalling(Parcel & parcel) const23bool AbilityFirstFrameStateData::Marshalling(Parcel &parcel) const 24 { 25 if (!parcel.WriteString(bundleName)) { 26 return false; 27 } 28 if (!parcel.WriteString(moduleName)) { 29 return false; 30 } 31 if (!parcel.WriteString(abilityName)) { 32 return false; 33 } 34 if (!parcel.WriteInt32(appIndex)) { 35 return false; 36 } 37 if (!parcel.WriteBool(coldStart)) { 38 return false; 39 } 40 return true; 41 } 42 ReadFromParcel(Parcel & parcel)43bool AbilityFirstFrameStateData::ReadFromParcel(Parcel &parcel) 44 { 45 bundleName = parcel.ReadString(); 46 moduleName = parcel.ReadString(); 47 abilityName = parcel.ReadString(); 48 appIndex = parcel.ReadInt32(); 49 coldStart = parcel.ReadBool(); 50 return true; 51 } 52 Unmarshalling(Parcel & parcel)53AbilityFirstFrameStateData *AbilityFirstFrameStateData::Unmarshalling(Parcel &parcel) 54 { 55 AbilityFirstFrameStateData *abilityFirstFrameStateData = new (std::nothrow) AbilityFirstFrameStateData(); 56 if (abilityFirstFrameStateData && !abilityFirstFrameStateData->ReadFromParcel(parcel)) { 57 TAG_LOGW(AAFwkTag::APPMGR, "ReadFromParcel failed"); 58 delete abilityFirstFrameStateData; 59 abilityFirstFrameStateData = nullptr; 60 } 61 return abilityFirstFrameStateData; 62 } 63 } // namespace AppExecFwk 64 } // namespace OHOS 65 #endif