1 /* 2 * Copyright (c) 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 #include "app_state_data.h" 17 18 namespace OHOS { 19 namespace Security { 20 namespace AccessToken { Marshalling(Parcel & parcel) const21bool AppStateData::Marshalling(Parcel &parcel) const 22 { 23 return (parcel.WriteString(bundleName) && parcel.WriteInt32(uid) && parcel.WriteInt32(state) 24 && parcel.WriteInt32(pid) && parcel.WriteUint32(accessTokenId) && parcel.WriteBool(isFocused) 25 && parcel.WriteInt32(extensionType) && parcel.WriteInt32Vector(renderPids) 26 && parcel.WriteString(callerBundleName) && parcel.WriteBool(isSplitScreenMode) 27 && parcel.WriteBool(isFloatingWindowMode) && parcel.WriteInt32(appIndex) && parcel.WriteBool(isPreloadModule)); 28 } 29 Unmarshalling(Parcel & parcel)30AppStateData *AppStateData::Unmarshalling(Parcel &parcel) 31 { 32 AppStateData *appStateData = new (std::nothrow) AppStateData(); 33 if (appStateData == nullptr) { 34 return nullptr; 35 } 36 appStateData->bundleName = parcel.ReadString(); 37 appStateData->uid = parcel.ReadInt32(); 38 appStateData->state = parcel.ReadInt32(); 39 appStateData->pid = parcel.ReadInt32(); 40 appStateData->accessTokenId = parcel.ReadUint32(); 41 appStateData->isFocused = parcel.ReadBool(); 42 appStateData->extensionType = parcel.ReadInt32(); 43 parcel.ReadInt32Vector(&appStateData->renderPids); 44 appStateData->callerBundleName = parcel.ReadString(); 45 appStateData->isSplitScreenMode = parcel.ReadBool(); 46 appStateData->isFloatingWindowMode = parcel.ReadBool(); 47 appStateData->appIndex = parcel.ReadInt32(); 48 appStateData->isPreloadModule = parcel.ReadBool(); 49 return appStateData; 50 } 51 } // namespace AccessToken 52 } // namespace Security 53 } // namespace OHOS 54