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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_RUNNING_PROCESS_INFO_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_RUNNING_PROCESS_INFO_H 18 19 #include <string> 20 #include <vector> 21 22 #include "parcel.h" 23 24 namespace OHOS { 25 26 namespace AppExecFwk { 27 28 enum class AppProcessState { 29 APP_STATE_BEGIN = 0, 30 APP_STATE_CREATE = APP_STATE_BEGIN, 31 APP_STATE_READY, 32 APP_STATE_FOREGROUND, 33 APP_STATE_BACKGROUND, 34 APP_STATE_SUSPENDED, 35 APP_STATE_TERMINATED, 36 APP_STATE_END, 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 std::string processName_; 54 std::int32_t pid_; 55 std::int32_t uid_; 56 AppProcessState state_; 57 58 bool ReadFromParcel(Parcel &parcel); 59 virtual bool Marshalling(Parcel &parcel) const override; 60 static RunningProcessInfo *Unmarshalling(Parcel &parcel); 61 }; 62 63 } // namespace AppExecFwk 64 } // namespace OHOS 65 66 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_RUNNING_PROCESS_INFO_H 67