1 /* 2 * Copyright (c) 2021 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 #include "stack_setting.h" 17 18 #include "hilog_wrapper.h" 19 #include "string_ex.h" 20 21 namespace OHOS { 22 namespace AAFwk { ReadFromParcel(Parcel & parcel)23bool StackSetting::ReadFromParcel(Parcel &parcel) 24 { 25 userId = parcel.ReadInt32(); 26 stackId = static_cast<STACK_ID>(parcel.ReadInt32()); 27 maxHoldMission = parcel.ReadInt32(); 28 isSyncVisual = parcel.ReadBool(); 29 return true; 30 } 31 Unmarshalling(Parcel & parcel)32StackSetting *StackSetting::Unmarshalling(Parcel &parcel) 33 { 34 StackSetting *setiing = new (std::nothrow) StackSetting(); 35 if (setiing == nullptr) { 36 return nullptr; 37 } 38 39 if (!setiing->ReadFromParcel(parcel)) { 40 delete setiing; 41 setiing = nullptr; 42 } 43 return setiing; 44 } 45 Marshalling(Parcel & parcel) const46bool StackSetting::Marshalling(Parcel &parcel) const 47 { 48 parcel.WriteInt32(userId); 49 parcel.WriteInt32(static_cast<int32_t>(stackId)); 50 parcel.WriteInt32(maxHoldMission); 51 parcel.WriteBool(isSyncVisual); 52 return true; 53 } 54 } // namespace AAFwk 55 } // namespace OHOS