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 "parcel.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 enum class AppProcessState { 27 APP_STATE_BEGIN = 0, 28 APP_STATE_CREATE = APP_STATE_BEGIN, 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 WeightReasonCode { 38 REASON_UNKNOWN = 0, 39 WEIGHT_FOREGROUND = 100, 40 WEIGHT_FOREGROUND_SERVICE = 125, 41 WEIGHT_VISIBLE = 200, 42 WEIGHT_PERCEPTIBLE = 230, 43 WEIGHT_SERVICE = 300, 44 WEIGHT_TOP_SLEEPING = 325, 45 WEIGHT_CANT_SAVE_STATE = 350, 46 WEIGHT_CACHED = 400, 47 WEIGHT_GONE = 1000, 48 }; 49 50 struct RunningProcessInfo : public Parcelable { 51 std::string processName_; 52 std::int32_t pid_; 53 std::int32_t uid_; 54 AppProcessState state_; 55 std::vector<std::string> bundleNames; 56 std::int64_t startTimeMillis_; 57 bool isContinuousTask = false; 58 bool isKeepAlive = false; 59 bool isFocused = false; 60 bool isTestProcess = false; 61 62 bool ReadFromParcel(Parcel &parcel); 63 virtual bool Marshalling(Parcel &parcel) const override; 64 static RunningProcessInfo *Unmarshalling(Parcel &parcel); 65 }; 66 } // namespace AppExecFwk 67 } // namespace OHOS 68 69 #endif // OHOS_ABILITY_RUNTIME_RUNNING_PROCESS_INFO_H 70