1 /* 2 * Copyright (c) 2025 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 "hilog_tag_wrapper.h" 17 #include "kiosk_status.h" 18 #include "string_ex.h" 19 20 namespace OHOS { 21 namespace AAFwk { ReadFromParcel(Parcel & parcel)22bool KioskStatus::ReadFromParcel(Parcel &parcel) 23 { 24 isKioskMode_ = parcel.ReadBool(); 25 kioskBundleName_ = Str16ToStr8(parcel.ReadString16()); 26 kioskBundleUid_ = parcel.ReadInt32(); 27 return true; 28 } 29 Unmarshalling(Parcel & parcel)30KioskStatus *KioskStatus::Unmarshalling(Parcel &parcel) 31 { 32 KioskStatus *info = new KioskStatus(); 33 if (!info->ReadFromParcel(parcel)) { 34 TAG_LOGE(AAFwkTag::ABILITYMGR, "ReadFromParcel failed"); 35 delete info; 36 info = nullptr; 37 } 38 return info; 39 } 40 Marshalling(Parcel & parcel) const41bool KioskStatus::Marshalling(Parcel &parcel) const 42 { 43 if (!parcel.WriteBool(isKioskMode_)) { 44 TAG_LOGE(AAFwkTag::ABILITYMGR, "write isKioskMode_ failed"); 45 return false; 46 } 47 48 if (!parcel.WriteString16(Str8ToStr16(kioskBundleName_))) { 49 TAG_LOGE(AAFwkTag::ABILITYMGR, "write kioskBundleName_ failed"); 50 return false; 51 } 52 53 if (!parcel.WriteInt32(kioskBundleUid_)) { 54 TAG_LOGE(AAFwkTag::ABILITYMGR, "write kioskBundleUid_ failed"); 55 return false; 56 } 57 return true; 58 } 59 Clear()60void KioskStatus::Clear() 61 { 62 isKioskMode_ = false; 63 kioskBundleUid_ = 0; 64 kioskBundleName_.clear(); 65 kioskToken_ = nullptr; 66 } 67 } // namespace AAFwk 68 } // namespace OHOS 69