• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H
17 #define OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "ability_info.h"
23 #include "app_mgr_constants.h"
24 #include "parcel.h"
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 enum class AppProcessState {
29     APP_STATE_CREATE = 0,
30     APP_STATE_READY,
31     APP_STATE_FOREGROUND,
32     APP_STATE_FOCUS,
33     APP_STATE_BACKGROUND,
34     APP_STATE_TERMINATED,
35     APP_STATE_END,
36     APP_STATE_CACHED = 100,
37 };
38 
39 enum class WeightReasonCode {
40     REASON_UNKNOWN = 0,
41     WEIGHT_FOREGROUND = 100,
42     WEIGHT_FOREGROUND_SERVICE = 125,
43     WEIGHT_VISIBLE = 200,
44     WEIGHT_PERCEPTIBLE = 230,
45     WEIGHT_SERVICE = 300,
46     WEIGHT_TOP_SLEEPING = 325,
47     WEIGHT_CANT_SAVE_STATE = 350,
48     WEIGHT_CACHED = 400,
49     WEIGHT_GONE = 1000,
50 };
51 
52 struct RunningProcessInfo : public Parcelable {
53     bool isContinuousTask = false;
54     bool isKeepAlive = false;
55     bool isFocused = false;
56     bool isTestProcess = false;
57     bool isAbilityForegrounding = false;
58     bool isTestMode = false;
59     bool isStrictMode = false;
60     bool isDebugApp = false;
61     std::int32_t pid_;
62     std::int32_t uid_;
63     std::int32_t bundleType = 0;
64     std::int32_t appCloneIndex = -1;
65     std::int32_t rssValue = 0;
66     std::int32_t pssValue = 0;
67     PreloadMode preloadMode_ = PreloadMode::PRELOAD_NONE;
68     AppProcessState state_;
69     std::int64_t startTimeMillis_;
70     std::vector<std::string> bundleNames;
71     std::string processName_;
72     std::string instanceKey = "";
73     AppExecFwk::MultiAppModeType appMode = AppExecFwk::MultiAppModeType::UNSPECIFIED;
74 
75     bool ReadFromParcel(Parcel &parcel);
76     virtual bool Marshalling(Parcel &parcel) const override;
77     static RunningProcessInfo *Unmarshalling(Parcel &parcel);
78     ProcessType processType_ = ProcessType::NORMAL;
79     ExtensionAbilityType extensionType_ = ExtensionAbilityType::UNSPECIFIED;
80 };
81 }  // namespace AppExecFwk
82 }  // namespace OHOS
83 
84 #endif  // OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H
85