• 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.WriteInt32(accessTokenId) && parcel.WriteBool(isFocused));
25 }
26 
Unmarshalling(Parcel & parcel)27 AppStateData *AppStateData::Unmarshalling(Parcel &parcel)
28 {
29     AppStateData *appStateData = new (std::nothrow) AppStateData();
30     if (appStateData == nullptr) {
31         return nullptr;
32     }
33     appStateData->bundleName = parcel.ReadString();
34     appStateData->uid = parcel.ReadInt32();
35     appStateData->state = parcel.ReadInt32();
36     appStateData->pid = parcel.ReadInt32();
37     appStateData->accessTokenId = parcel.ReadInt32();
38     appStateData->isFocused = parcel.ReadBool();
39     return appStateData;
40 }
41 }  // namespace AccessToken
42 }  // namespace Security
43 }  // namespace OHOS
44