• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_PRIVACY_PROCESS_DATA_H
17 #define OHOS_PRIVACY_PROCESS_DATA_H
18 
19 #include <sys/types.h>
20 
21 #include "parcel.h"
22 #include "iremote_object.h"
23 
24 namespace OHOS {
25 namespace Security {
26 namespace AccessToken {
27 enum class AppProcessState {
28     APP_STATE_CREATE = 0,
29     APP_STATE_READY,
30     APP_STATE_FOREGROUND,
31     APP_STATE_FOCUS,
32     APP_STATE_BACKGROUND,
33     APP_STATE_TERMINATED,
34     APP_STATE_END,
35 };
36 
37 enum class ProcessType {
38     NORMAL = 0,
39     EXTENSION,
40     RENDER,
41 };
42 
43 struct ProcessData : public Parcelable {
44     /**
45      * @brief read this Sequenceable object from a Parcel.
46      *
47      * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
48      * @return Returns true if read successed; returns false otherwise.
49      */
50     bool ReadFromParcel(Parcel &parcel);
51 
52     /**
53      * @brief Marshals this Sequenceable object into a Parcel.
54      *
55      * @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
56      */
57     virtual bool Marshalling(Parcel &parcel) const override;
58 
59     /**
60      * @brief Unmarshals this Sequenceable object from a Parcel.
61      *
62      * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
63      */
64     static ProcessData *Unmarshalling(Parcel &parcel);
65 
66     std::string bundleName;
67     int32_t pid = 0;
68     int32_t uid = 0;
69     int32_t renderUid = -1;
70     AppProcessState state;
71     bool isContinuousTask = false;
72     bool isKeepAlive = false;
73     bool isFocused = false;
74     int32_t requestProcCode = 0;
75     int32_t processChangeReason = 0;
76     std::string processName;
77     ProcessType processType = ProcessType::NORMAL;
78     int32_t extensionType;
79 };
80 }  // namespace AccessToken
81 }  // namespace Security
82 }  // namespace OHOS
83 #endif  // OHOS_PRIVACY_PROCESS_DATA_H
84