• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) const21 bool 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) && parcel.WriteInt32(callerUid)
27         && parcel.WriteBool(isFloatingWindowMode) && parcel.WriteInt32(appIndex) && parcel.WriteBool(isPreloadModule)
28         && parcel.WriteBool(isFromWindowFocusChanged));
29 }
30 
Unmarshalling(Parcel & parcel)31 AppStateData *AppStateData::Unmarshalling(Parcel &parcel)
32 {
33     AppStateData *appStateData = new (std::nothrow) AppStateData();
34     if (appStateData == nullptr) {
35         return nullptr;
36     }
37     appStateData->bundleName = parcel.ReadString();
38     appStateData->uid = parcel.ReadInt32();
39     appStateData->state = parcel.ReadInt32();
40     appStateData->pid = parcel.ReadInt32();
41     appStateData->accessTokenId = parcel.ReadUint32();
42     appStateData->isFocused = parcel.ReadBool();
43     appStateData->extensionType = parcel.ReadInt32();
44     parcel.ReadInt32Vector(&appStateData->renderPids);
45     appStateData->callerBundleName = parcel.ReadString();
46     appStateData->isSplitScreenMode = parcel.ReadBool();
47     appStateData->callerUid = parcel.ReadInt32();
48     appStateData->isFloatingWindowMode = parcel.ReadBool();
49     appStateData->appIndex = parcel.ReadInt32();
50     appStateData->isPreloadModule = parcel.ReadBool();
51     appStateData->isFromWindowFocusChanged = parcel.ReadBool();
52     return appStateData;
53 }
54 }  // namespace AccessToken
55 }  // namespace Security
56 }  // namespace OHOS
57